Repository navigation
cuda: the affine-4 repack beside its format (qlinear.zig, affine4_pack.cu); Nemotron's loader packs through it - #602
Conversation
…k.cu); Nemotron's loader packs through it
|
Thank you, @jschmied. This is merged into main (d2f883c), your commit as it was, and it ships in 1.0.6. On a GB10 against main, One fix on top: #591 had landed a |
…s.pack, where ashhart#602 moved the repack
…moved tf_pack_dense and tf_transpose_pad16 After the rebase onto a6aa478 nemotron_ops no longer carries the affine-4 repack (0e0d32b put it beside its format in affine4_pack.cu), so the GLM loader, the MTP head's 4-bit tiling and the GLM checks found no tf_pack_dense. They load the same kernels from affine4_pack now.
…ar.zig, affine4_pack.cu) Thanks @jschmied.
…s.pack, where ashhart#602 moved the repack
The follow-up you suggested on #587: the affine-4 packing moves next to its format.
zig/kernels/cuda/affine4_pack.cu:tf_pack_denseandtf_transpose_pad16, moved verbatim fromnemotron_ops.cu. They're the MLX words into the lane tiles, and the (n, kg) scales and biases into (kg, npad).nemotron_ops.cukeeps its serial feed, routed plan and rests.cuda/qlinear.zig:Affine4.layout(n, k)gives the tiled sizes (rows to whole 128s, the words' and the scales' bytes).Affine4Kernels.pack(s, words, scales, biases, q)launches the two kernels as the loader did.resolvetakes the pack module.families/nemotron/cuda_weights.zig:tilesizes its buffers withAffine4.layoutand packs throughAffine4Kernels.pack.Kernelsloads one module more and drops its two pack functions.Receipts on GB10 (DGX Spark, sm_121, CUDA 13.0).
main(2f8284e) and this branch were each built with nvcc forsm_121:zig build testpasses andlean_checkis clean for the touched files.zig fmt --check build.zig zigflags only files outside this PR.cuobjdump -sass -fun):tf_pack_dense(216 lines) andtf_transpose_pad16(160) inaffine4_pack.fatbinequal main's innemotron_ops.fatbin. The three kernels left innemotron_ops.cu(tf_serial_feed,tf_plan_routed,tf_rest_rows) are unchanged.d9d758fb, every projection packed through the moved code:tensorfold check-kernels: 1,008 of 1,008 projection cases (976 split-K) and 384 of 384 forked-MoE cases, both builds.tensorfold run: three prompts (11, 20, 1,090 tokens), greedy and sampled (0.8 / 20 / 0.95, seed 7). All six reply hashes equal main's:5923b40d570b,d38725819372,ead827be94f5,bb8855c2f084,068276d3ec75,a6961a8c7589.