logo

Compiling Zig Kernels to CUDA PTX (Zigton Phase 1)

Posted by lovesahaj |2 hours ago |1 comments

lovesahaj 2 hours ago

Author. The host-runtime side (Phase 0) is an earlier post on the same blog; this one is the kernel side. End-to-end pipeline ends up being Zig → LLVM IR → patch the IR to drop the alias NVPTX rejects → llc → PTX → @embedFile, all driven from build.zig.

The IR patch lives in tools/fix_ptx_ir.sh and it's a sed script. I'd rather Zig's NVPTX backend just stop emitting the alias, but until then, this works.