mirror of
https://github.com/zml/zml.git
synced 2026-11-16 19:11:09 +00:00
Adds a Zig DSL for Metal kernels over the AIR dialect, and moves the Metal paged attention kernels onto it. - `mlir/dialects/air`: a `thread` address space. Each op has an `llvmBuilder` that calls its `air.*` builtin with Apple's attributes, and the dialect's translation interface builds the `!air.kernel` metadata, so lowering to LLVM IR is MLIR's own translation. The verifier rejects what Apple's compiler can't take: bool, scalable and n-D vectors, buffers of non-Metal scalars, scalar f32 converts, and `air.kernel` on a declaration. - `dsl/metal`: an MSL-shaped builder. It emits `air` plus the `arith`/`cf`/`vector`/`llvm` IR that clang produces for MSL, and covers MSL's math, SIMD-group, barrier and `simdgroup_matrix` functions. - `zml.kernel.metal` / `ops.metal`: wrap a kernel into a `__gpu$xla.gpu.air` custom call. XLA lowers it, compiles it to a metallib and launches it.
439 lines
21 KiB
439 lines
21 KiB