$ show NVIDIA/cuda-tile
This repository implements `cuda_tile`, an MLIR-based compiler dialect and toolchain for GPU tile programming, primarily targeting NVIDIA CUDA architectures. It defines a rich set of operations for tile-level computation (arithmetic, matrix multiply, memory views, atomics, control flow) with explicit memory ordering and synchronization. The project includes a custom bytecode serialization format (.tileirbc) with versioned backward compatibility, allowing efficient IR transport and JIT compilation. Key tools are `cuda-tile-opt` (dialect testing), `cuda-tile-translate` (MLIR-to-bytecode conversion), `cuda-tile-optimize` (bytecode-to-bytecode optimization passes), and `cuda-tile-tblgen` (TableGen-based code generation for bytecode readers/writers). Python bindings enable programmatic IR construction. The architecture is a set of modular libraries (dialect, bytecode, optimizer, C API) that can be integrated into larger compiler pipelines. External dependencies are LLVM/MLIR at a pinned commit and CUDA. The codebase demonstrates high engineering rigor with extensive test coverage (bytecode stability, version compatibility, round-trip, transformation passes) and careful version management for evolving the IR format. While primarily a compiler infrastructure application, the project's focus on low-precision matrix operations (FP8, FP4) and tensor core optimizations touches on ML research areas.
The LLM identified 3 files worth highlighting for reuse:
Provides `MinVersionAnalyzer` that computes the minimum required bytecode version for a set of operations, types, and attributes. It uses `BytecodeVersion` and per-op version metadata from TableGen-generated code. This is a self-contained utility for ensuring serialized bytecode is compatible with readers of a given version. It is reusable across any MLIR dialect that adopts similar versioning, requiring only the version-check functions generated by the dialect's TableGen backend.
Declares shared verifier functions for common type/shape/modifier checks across arithmetic, memory, and atomic operations. Functions like `verifySameType`, `verifyShape`, `verifyRoundingMode`, etc., decouple verification logic from individual op definitions. This pattern could be extracted and reused in other MLIR dialects to reduce duplication and enforce consistent semantics.
Defines a structured remark system for optimization passes, categorizing remarks as Pass, Miss, Fail, or Analysis, with optional suggestions and reasons. This is a clean abstraction for emitting user-facing diagnostics that can be consumed by tools (e.g., `opt-viewer`). It is independent of the dialect's IR and could be adopted in any MLIR-based optimizer to provide actionable optimization insights.