Repository navigation
Replace gpu/kittens with ferro-kittens; bump cuda-oxide to 20a5616 - #71
Conversation
…nt surface `gpu/kittens` was frozen at the 2026-07-26 extraction while ferro-kittens took ~167 PRs on top of the same snapshot. Replace it with a pinned git dependency (`caa6075`) and bump cuda-oxide b099f64 -> 20a5616 in all seven remaining `gpu/*` manifests, their lockfiles, `modal_app.py`, and the SPEC citations — the pins have to match, since kittens takes cuda_device/cuda_core types in its signatures. ferro-kittens' `[lib] name` is still `kittens`, so no import path moves. What moved is the surface: - `ldst::store_fragment_bf16` -> element-generic `store_fragment`. - `Semaphore::multicast_alias` -> `Semaphore::at_rank(0)`, returning a `ClusterSemaphore` that may be arrived at but not waited on. Only rank 0 charges, now via `TransactionBytes::across_ranks`. - Every TMA load hands back a `#[must_use]` `TransactionBytes` and `expect_tx` takes only that, so the byte counts the kernels wrote by hand are gone: the charge is summed from the loads that earned it. Partial-height loads need `tma_load_at::<TILE>` (feitreim/ferro-kittens#168). - `RegVec<N>`/`RegTile<S, V>` count logical rows and columns against a layout now, not per-thread slots: `RegVec<32, BaseLdtm>`, `RegTile<32, 128, BaseLdtm>`. `value_column(v)` folds into `BaseLdtm::column(lane, v)` and `add_assign` into `bin_map_assign::<Add>`. - `mma_*` derive element, accumulator and both transpose flags from the operands and the entry point, so all fifteen instruction-descriptor builders collapse to one shape — `MMA_SHAPE` in flash-attn, a literal in gemm — and the four MMA helpers lose a parameter that had become a constant. - `pipeline::Job` gained a defaulted `RANKS` and `run` deals items by `%clusterid`; at this kernel's one-CTA cluster both degenerate to the loop already written. Refs #66.
|
B200 validation of this branch via
Runs: ap-owYWr892pYYBZqaCahe1hQ, ap-YrcTroJBwmzbkqCVIyG25f, ap-5pAv26D3Lo17moalcNyxsw. Review of the diff itself is on the issue thread's side: charge sums reproduce the old byte constants, RegVec/RegTile re-parameterizations preserve per-thread storage, no hand-counted |
Not drift from the kittens swap — `gpu/model/src/bin/sample.rs` is byte identical to main here and has not compiled since 0ec4ad6 (2026-07-23), which added the `L` layer count and split `GpuDenseWorkspace` into `GpuMoeWorkspace`. Nothing builds this binary: `modal_app.py` runs `train` and `profile`, and no host without a CUDA toolkit can `cargo check` it, so the arity rotted in silence for three days before ferro-kittens existed. `checkpoint::load` takes thirteen const generics and was given twelve; `GpuDenseWorkspace` takes eight and was given eleven, and is not what `GpuDense::forward` accepts anyway. Follow train.rs: `GpuMoeWorkspace` with `L`, and the canonical 12-block MoE configuration both other bins run — the old 1_536-wide/64-head numbers would have failed the checkpoint header check at runtime even once the types lined up. Refs #66.
|
Pushed It is not drift from this PR. Worth stating plainly, because the B200 validation above stands and I don't want this read as a hole in it:
The two arity errors and the fix
The third error is the knock-on: I also aligned the config block to the canonical 12-block MoE that Verification
Clean across all of The checker lives in my scratchpad, not in this diff — the repo has no CI and no Still unverified by me: |
|
Follow-up verification of |
Closes #66.
gpu/kittensis deleted;gemm,flash-attnandmodelnow takekittens = { package = "ferro-kittens", git = ..., rev = "caa6075" }, andcuda-oxide moves
b099f64→20a5616in the seven remaininggpu/*manifests, all lockfiles,
modal_app.py:CUDA_OXIDE_REF, and the three SPEC.mdcitations (repointed for the live pin, dated for the two historical claims).
The
features = ["host"]split is preserved —flash-attnandmodelenableit,
gemmdoes not, andgemmstill builds without it.ferro-kittens'[lib] nameis stillkittens, so nousepath changed.This is the drift-only port the issue asked for: no
SharedPlan, noStoreRing, nokittens::lane(), nomm_*.Drift fixes, each break → its fix
Anticipated in #66
ldst::store_fragment_bf16goneldst::store_fragment— element-generic,Einferred from theSwizzledChunks<Bf16>the tile hands out. 5 call sites.Semaphore::multicast_alias()removed (ferro#50)tma_sem.at_rank(0), giving aClusterSemaphoreboth ranks aim their halves at. Rank 0 alone charges, nowcharge.across_ranks(2)instead of the hand-written(128*64*2)*4.gemm/src/optimized.rs:60.pipeline::Jobreshaped (ferro#51)RANKSdefaults to 1 andinit/inval/workare unchanged, soPersistentForwardstill conforms.runnow deals items by%clusteridand takes the boundary atRANKSscope; the persistent forward is not#[cluster_launch], so its cluster is one CTA and both degenerate to theblockIdx.x/sync_threadsloop it already had. Documented at the kernel.Not anticipated — the bulk of the diff
tma_load*returns#[must_use] TransactionBytes;expect_txtakes only that, notu32let charge = k.tma_load(..) + v.tma_load(..); full.expect_tx(charge);. Conditional stages accumulate into amut chargeand pay once, replacing the two-branchif i == 0 { expect_tx(A) } else { expect_tx(B) }. 17 sites. I re-derived every one against the old constant — all agree (Panel16384 B,PairedPanelbox-of-TILE16384 B,KStage/MnStage16384 B, cluster stage 65536 B).tma_load_atgained an uninferrableconst BOX_ROWStma_load_at::<TILE>at 12 sites. This one has a hole —BOX_ROWSscales the returned charge and nothing ties it to the tensor map — so I filed feitreim/ferro-kittens#168 rather than working around it silently.tma_load_2d_multicast_cg2takesClusterSemaphore, notSemaphoreat_rankfix above.RegVec<N>→RegVec<M, L: RowLayout<M>>,RegTile<SLOTS, VALUES>→RegTile<M, N, L>BaseLdtm,SLOTS = M/8andVALUES = N/4, soRegVec<4>→RegVec<32, BaseLdtm>andRegTile<4, 32>→RegTile<32, 128, BaseLdtm>— same storage, same registers..0[slot][value]still indexes, andFragmentkeeps its spelling.reg::value_column(v)removedBaseLdtm::column(lane, v), which islane_column + value_column(v)in one call; the separatelane_columnlocals go with it. 4 sites.RegVec::add_assignremovedbin_map_assign::<Add>.mma_ab/mma_abt/mma_walk_cg2takeMmaShape, not a packedu32descriptor, and gained a leadingE: MmaElementmma_abt⇒ no transpose,mma_ab⇒transpose_b,mma_walk_cg2⇒ fromOperandWalk::transposed) — which is exactly what the 15Tcgen05InstructionDescriptor::builder()chains were saying by hand, includingoptimized.rs'stranspose_a/b(transposed)(its walks already carry that). All 15 collapse to one shape:MMA_SHAPE = M128_N64in flash-attn,M128_N128/M256_N256literals in gemm. Four MMA helpers lose a parameter that had become a constant.mma_walk_cg2::<4>→mma_walk_cg2::<Bf16, 4>.Net: −2684/+340 lines, and −92 lines in
tcgen05.rsalone from the descriptorbuilders going away.
Verified locally (macOS, no CUDA toolkit)
cargo checkon the GPU crates is impossible on this host and was before thisPR too: all three consumers depend on
cuda-host/cuda-core, which pullcuda-bindings, whose build script wantscuda.h. So:ferro-kittensitself builds clean at20a5616as a dependency, bothdefault and via the consumers' resolution.
crate depending only on
cuda-device+ferro-kittensand pulled ingemm/src/lib.rs(+ itsinclude!doptimized.rs) andflash-attn/src/tcgen05.rsby#[path], with#[cuda_module]/#[kernel]stripped (those expand to host launchers needing
cuda-core) and gemm'shostmodule stubbed to its five consts. That is every line the migrationtouched.
cargo build— not justcheck— so post-monomorphizationconstasserts fire: I confirmed the harness catches them by breaking oneon purpose (
tma_load_at::<512>⇒ "a box taller than the tile cannot landin it"), then restored it. Clean at HEAD, no warnings beyond the ones the
attribute stripping itself creates.
cargo fmt --checkclean ingpu/gemmandgpu/flash-attn.cargo test --workspace— 51 CPU tests pass.cargo oxide build --arch sm_100a. No B200 runwas made, so nothing here is validated as PTX or numerically.
Needs the B200 tier
cargo oxide build --arch sm_100afor all four kernel crates, then thedevice tests and numeric gates for gemm, flash-attn and model.
made this identical cuda-oxide bump in The pin moves to 20a5616, and two doc claims did not survive the audit ferro-kittens#152 with zero
non-comment Rust changes and still moved 46 of 272 register counts. Any gate
in
bench_util::enforce_kernel_budgetsthat pins a count should bere-baselined against a fresh run rather than read as a regression — and note
that this PR is not a pure toolchain bump on top of that: the epilogue and
softmax paths changed shape (
RegTilelayout parameter,MmaShape), soliveness at those call sites is worth a look if a count moves a lot.
at_rank(0)cluster charge ingemm/src/optimized.rsis the one changewith a runtime failure mode that no host check can reach (an over-charge
hangs, an under-charge races). Its arithmetic matches the old constant
exactly, but synccheck on the pair-UMMA GEMM would be the cheap confirmation.
Filed upstream
tma_load_at'sBOX_ROWSis an uninferrableconst the caller restates, and it scales the returned
TransactionBytes, sowriting it wrong is a silent mis-charge. The one place the new receipt type
does not close the loop it was introduced to close.