Abstract
Prism is a domain-specific language for GPU programming that introduces "typed perspectives" to reconcile the tension between single-thread programming models and collective hardware execution. By embedding the GPU's compute hierarchy into its type system, Prism enables the development of modular, reusable, and high-performance kernels. This paper describes the design of Prism, its core calculus Bundl, and demonstrates that it achieves performance parity with hand-tuned CUDA libraries like cuBLAS and CUB while providing static safety guarantees.
Introduction
Writing high-performance GPU code is notoriously difficult due to a fundamental conceptual clash. While GPU programs (like CUDA) are written from the perspective of a single thread, the hardware achieves peak performance through collective operations—where groups of threads, such as warps or blocks, must act in perfect synchronization to utilize features like Tensor Cores or shared memory.
Currently, if a programmer calls a collective function inside a divergent code path, the result is often a deadlock or undefined behavior. This makes modularity nearly impossible; libraries like NVIDIA's CUB must rely on extensive documentation and naming conventions to warn users about hidden requirements. Prism addresses this by materializing the programmer's mental model of the GPU hierarchy into the type system using Typed Perspectives.
Methods
Prism introduces a formal way to track the granularity at which a programmer is controlling threads.
- Perspectives: These describe execution scopes (e.g.,
grid[1],block[1], orthread[32]). - The
@Syntax: Prism tracks the "frequency" of variables. A variable marked@ thread[1]can hold different values for every thread, while one marked@ block[1]must be uniform across the entire block. This ensures that collective operations receive the uniform data they require.
- Core Constructs: The language uses
groupto replicate code across broader perspectives andsplitto shard perspectives into unequal groups (enabling warp-specialization). Operations likepartitionandclaimallow threads to safely "narrow" their view of memory, enabling independent writes without race conditions. - Automatic Synchronization: The Prism compiler constructs a data-control-flow graph to automatically insert synchronization barriers (like
__syncthreads()) exactly where memory views diverge or reconverge.
Evaluation and Results
The authors evaluated Prism by implementing several "speed-of-light" GPU kernels and comparing them against industry-standard baselines like cuBLAS and CUB on both consumer-grade (RTX 4070 Ti Super) and server-grade (H100) hardware.
Prism demonstrates that safety does not have to come at the cost of performance:
- Matrix Multiplication (HGEMM): On the H100, Prism's implementation came within 15% of cuBLAS, an impressive feat for a high-level language.
- Parallel Prefix Scan: Prism achieved bandwidth within 7% of the CUB library, proving it can handle complex, memory-bound algorithms.
- Productivity: The authors successfully implemented complex features like the H100's new
wgmma(warpgroup-level matrix multiply) and TMA (Tensor Memory Accelerator) using these perspective-based abstractions.
Key Insights
Prism enforces a strict "Read Up, Write Down" rule: code can read data from a broader (more global) perspective but can only write to data at its current or a narrower perspective. This prevents threads from accidentally clobbering shared data without proper coordination. Furthermore, Prism’s type system tracks thread alignment statically, ensuring that collective operations—which often require threads to be aligned to specific boundaries (e.g., multiples of 32)—are called correctly.
Discussion and Future Work
While Prism offers "fearless composition" by making perspectives part of function signatures, some limitations remain. Pipeline ergonomics currently require manual unrolling for overlapping data movement, and the system does not yet provide a full formal guarantee of data-race freedom or liveness. Future directions include extending Prism to support newer architectures like Blackwell and exploring its application in distributed systems. Overall, Prism provides a robust framework for building safe, modular, and high-performance GPU software.
Summary updated