r/CUDA • u/NoVibeCoding • Oct 21 '26
Hackathon: Implement PTX Compiler
We're running a hackathon to build a simplified PTX compiler running from October 21st to October 27th, 2026.
The goal is to generate efficient PTX from an internal kernel representation. The parser is provided, so you don't need to implement the full CUDA compiler frontend, and you don't need to find an efficient schedule. The goal is to generate efficient PTX code to run the program.
Here is an example of IR for RMSNorm:
Tile[a0, a1_co] (N=8192)
for a1 in a1_co..1024:128
in2 = load x[a0, a1]
f32 v1 = multiply(in2, in2)
f32 acc0 <- add(acc0, v1)
WarpShuffle(acc0, length=32)
Smem float acc0_smem[4]
if ((lane == 0)):
acc0_smem[warp] = acc0
Sync
TreeHalve(acc0, length=4, tid=warp)
in1 = load mean_count[0]
f32 v0 = reciprocal(in1)
f32 v2 = multiply(acc0, v0)
in0 = load add_c1[0]
f32 v3 = add(in0, v2)
f32 v4 = sqrt(v3)
f32 v5 = reciprocal(v4)
for a2 in a1_co..1024:128
in3 = load x[a0, a2]
f32 v6 = multiply(in3, v5)
in4 = load w[a2]
f32 v7 = multiply(in4, v6)
mul_1[a0, a2] = v7 Tile[a0, a1_co] (N=8192)
for a1 in a1_co..1024:128
in2 = load x[a0, a1]
f32 v1 = multiply(in2, in2)
f32 acc0 <- add(acc0, v1)
WarpShuffle(acc0, length=32)
Smem float acc0_smem[4]
if ((lane == 0)):
acc0_smem[warp] = acc0
Sync
TreeHalve(acc0, length=4, tid=warp)
in1 = load mean_count[0]
f32 v0 = reciprocal(in1)
f32 v2 = multiply(acc0, v0)
in0 = load add_c1[0]
f32 v3 = add(in0, v2)
f32 v4 = sqrt(v3)
f32 v5 = reciprocal(v4)
for a2 in a1_co..1024:128
in3 = load x[a0, a2]
f32 v6 = multiply(in3, v5)
in4 = load w[a2]
f32 v7 = multiply(in4, v6)
mul_1[a0, a2] = v7The prize pool is $ 2,750, and we offer internship opportunities to participants with interesting submissions.
Info: https://riftstack.ai/hackathon
Intro lectures:
4
u/tilingSmith Oct 22 '26 edited Oct 23 '26
I really do not see the point of this competition to be about compile time: The end goal for all of the CUDA system is basically generate as efficient kernel to run on (racks of) NVGPU(s) as possible. In terms of compile time, compiling CUDA using nvcc is basically template metaprogrammed C++ compilation which is deemed to be slow, and if I want fast compile speed, I would just write CUTE DSL python to (almost) 1-to-1 match to sass by their own mlir python binding from python to sass. (assuming I know how the cute dsl python ops corresponds with sass)
As for performance, if you do not have their propriety SASS knowledge, most of your observed optimization would be just "coincidence" or "magick", considering their SIMT hardware can do additional handling unlike VLIW ASICs which I work on and have full control even on the MLIR level.
1
u/c-cul Oct 28 '26
btw do you planning to disclose results? no personal data - just what perf winner(s) achieved comparing to nvcc/cute dsl?
1
u/c-cul Oct 21 '26
aaaaaand main prize will go to nvcc from nvidia, he-he: https://www.reddit.com/r/CUDA/comments/1wzvxgy/comparison_of_ptxsass_code_from_nvcc_vs_clang/