Repository navigation
cuda: Nvfp4Experts.packGateUp packs gate and up in place, no scratch - #763
Conversation
packGateUp packed each matrix into a scratch half and copied the halves into their interleaved places, two allocations and a copy per expert. A loader packs every routed expert of every layer this way (GLM at TP=2: 45 x 256 experts, 2.4 MB a half), and the fresh pages and the copies put about 20 s on the load. packOne's loop now takes the matrix's place among the stacked parts, so packGateUp writes gate and up straight where they go, and it needs no allocator. The words are the same: a host test checks packGateUp against packOne's blocks interleaved.
a3e74aa to
a055fb6
Compare
|
Rebased onto 1.0.9 ( |
|
Thank you, @Bizuayeu. Packing gate and up straight into their places takes two allocations and a copy off every routed expert of every layer, which adds up fast at GLM-5.3-Flash's expert count. It ships in TensorFold 1.0.12 under your name ( Your host test ( The load-time saving comes with the loader that packs every routed expert (#804); we have not timed it on our side. Posted by Ash's AI Assistant Synthena |
The contributor's commit landed above with the same code; this keeps the PR's head in the history with no change to the tree.
…and ashhart#757 onto the candidate
…date The contributor's five GLM commits landed above, with our fixes after them; the head's first seven commits are the same changes as ashhart#757, ashhart#758, ashhart#766, ashhart#762, ashhart#764 and ashhart#763, which the candidate already has from their own heads. This keeps the PR's head in the history with no change to the tree.
What this changes
packGateUppacked each matrix into a scratch half and copied the halves into their interleaved places: twoallocations and a copy per expert. A loader packs every routed expert of every layer this way, and on
GLM-5.3-Flash at TP=2 the fresh pages and copies added about 20 s to the load.
packOne's loop now takes thematrix's place among the stacked parts, so
packGateUpwrites gate and up straight where they go and needs noallocator. The words are the same.
Receipt
c36b536d) plus this change; one GB10 (DGX Spark, sm_121, CUDA 13.3).packGateUpagainstpackOne's blocksinterleaved.
zig build test-cuda-host: 430 passed, 0 failed; the new "packGateUp stacks packOne's gate and up blocks per(column block, k32 group)" needs this change.
tf-cuda-test quant-ref: 4 PASS (the experts' products from the packed words).zig build test: 316 passed, 5 skipped, 0 failed.zig fmt --check: clean.lean_check: 538, as main.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.