Introduction
Programming modern GPUs has reached a critical point of complexity. Architectures like NVIDIA’s Hopper (H100) have transitioned away from simple bulk-synchronous execution models. To achieve peak performance, developers must now orchestrate a swarm of asynchronous, specialized units, including Tensor Cores for matrix mathematics and the Tensor Memory Accelerator (TMA) for data movement.
This shift requires "warp specialization"—the practice of dedicating specific thread groups to data movement while others perform computation—and the management of deep, software-pipelined buffers. Manually implementing these optimizations in CUDA or CUTLASS is notoriously error-prone, often resulting in difficult-to-debug data races. Meanwhile, high-level compilers like Triton frequently rely on heuristics that may fail to utilize the optimal memory tier. Cypress emerges as a solution to this "Goldilocks" problem, automating synchronization while providing experts with precise control over hardware mapping.
The Cypress Programming Model
Cypress introduces a novel two-part programming structure that decouples the algorithm's logic from its physical execution. This separation allows developers to focus on the mathematical correctness of their kernels without becoming mired in the minutiae of hardware-specific synchronization.
1. Logical Description
The programmer defines the algorithm as a tree of tasks operating on tensors. This code maintains sequential semantics, appearing as a standard program without explicit barriers or asynchronous "wait" commands. This high-level abstraction significantly reduces the surface area for bugs related to data movement.
2. Mapping Specification
In a separate specification, the programmer dictates the physical execution details: which processors (e.g., Warpgroup or Thread) execute specific tasks and which memory tiers (e.g., Global, Shared, or Registers) house specific tensors.
Hardware Mapping and Memory Hierarchy
Cypress is designed to map tasks across the complex hierarchy of modern GPU Streaming Multiprocessors (SMs). By explicitly defining the relationship between processors and memory, Cypress can optimize data locality and register usage.
One notable feature is the "None" memory option. Cypress allows programmers to map a tensor to none memory, forcing the compiler to ensure the tensor is never materialized in its entirety. Instead, it exists only in partitioned pieces across registers. This technique is vital for fitting large accumulators into the limited register files of a GPU SM.
The Cypress Compiler
Built on the MLIR framework, the Cypress compiler performs several critical automated tasks:
- Dependence Analysis: It automatically infers where hardware barriers (such as
arriveandwait) are required to preserve the sequential logic of the program. - Warp Specialization: It partitions the program into producer (DMA) and consumer (Compute) warps automatically.
- Static Scheduling: Unlike traditional task-based systems that rely on a dynamic runtime, Cypress resolves scheduling at compile-time. This generates lean, high-performance CUDA C++ code suitable for the extreme constraints of GPU hardware.
Evaluation and Results
The authors evaluated Cypress using compute-intensive linear algebra kernels essential for modern AI, including General Matrix Multiply (GEMM) variants and Flash Attention 2 & 3. Benchmarks were conducted against industry standards such as cuBLAS, cuDNN, CUTLASS, and Triton.
Key Performance Metrics
- Competitive with Vendor Libraries: Cypress achieved 0.88x–1.06x the performance of hand-tuned cuBLAS on GEMM and 0.80x–0.98x of the best-known Flash Attention 3 implementations.
- Outperforming Triton: On fused kernels like GEMM+Reduction, Cypress outperformed Triton by up to 2.18x. This advantage stems from Cypress's ability to manually place reduction accumulators in registers, whereas Triton’s heuristics often mistakenly spill them to slower shared memory.
Conclusion and Future Work
Cypress demonstrates that task-based models can achieve near-peak GPU performance while significantly improving developer productivity. By automating synchronization and data movement, it allows developers to iterate on complex kernels by simply modifying a mapping file rather than rewriting core logic.
Future work aims to address current limitations, such as the verbosity of mapping specifications and the lack of support for "persistent kernels." Additionally, the authors envision "autotuning" capabilities that could eventually discover optimal hardware mappings automatically, further lowering the barrier to high-performance GPU programming.
Summary updated