Skip to content

Bump cuda-oxide to b099f64 - #60

Merged
feitreim merged 3 commits into
mainfrom
chore/issue-56-cuda-oxide-b099f64
Jul 26, 2026
Merged

feitreim merged 3 commits into
mainfrom
chore/issue-56-cuda-oxide-b099f64

Conversation

@feitreim

Copy link
Copy Markdown
Owner

Summary

  • pin all seven GPU crates, lockfiles, and the Modal image to cuda-oxide b099f64c1a32869b74be99f4f88242fb68655b51
  • migrate kernel launches and Modal build/profile flows to the updated contracts
  • preserve Blackwell stmatrix support with a local ptx_asm! shim and harden rounded kernel launches against out-of-bounds accesses
  • update SPEC §2 and the decision log

Validation

  • cargo test --workspace --all-targets
  • cargo fmt --all -- --check
  • Python compilation and manifest/lock pin audit
  • B200 correctness: vecadd, tensor-gpu, ops, gemm, flash-attn, and model
  • B200 model parity, AdamW/Muon checks, checkpoint resume, and tiny overfit gates
  • candidate full-step profile: 648.0966 ms (645.7602 ms kernels)

The same-container pre-bump profile could not reach measurement: after installing the matching historical cuda-oxide CLI, the v0.2.1 gemm.ptx fails B200 JIT with DriverError(218). The candidate profile and all correctness gates are green. Compute Sanitizer also reports this B200 as unsupported with the available toolkit/driver.

Closes #56

feitreim added 3 commits July 25, 2026 18:20
Bring the cuda-oxide b099f64 bump up to date with #47, #53, #54, #55, #57,
and #59, giving every launch site those merges added the same unsafe-launcher
treatment the bump requires.

Conflict resolution:

- gpu/ops/src/main.rs: took main's file wholesale (its check_moe_routing was
  restructured around the split/merge router wgrad kernels and the bit-identity
  determinism assert) and re-applied the bump's mechanical transformation on
  top -- per-check outer `unsafe` blocks with SAFETY comments, the two inline
  wraps in check_group_split_join, the `[ops]` progress lines, and the relaxed
  rmsnorm dw fast-vs-naive tolerance. check_moe_scatter_dy_case and
  check_moe_tie_routing already launch inside `unsafe`, so they were left alone.
- gpu/model/src/lib.rs: main's semantics won everywhere they collided --
  bf16-master `copy_device_region` refreshes instead of the retired
  convert-on-sync, `adamw_bf16_master_packed_grad` for the lm-head, packed
  expert panels in the SwiGLU forward, and `muon_apply_bf16` closing
  muon_step_raw inside the bump's function-level unsafe block.
- gpu/tensor-gpu/src/main.rs: took main's rewritten check_adamw_master.
- SPEC.md: kept both decision-log rows; main's bf16-masters row keeps 23 and
  the cuda-oxide pin moves to 24.
- modal_app.py: kept main's dump_ptx (sm_100a pin plus every .ptx emitted)
  alongside the bump's baseline-toolchain install in compare_profile.

Newly unsafe-wrapped launch sites from main's six merges:

- gpu/model/src/lib.rs: GpuLinear::backward_into and
  GpuGroupedLinear::backward_into weight-gradient quantizes, ExpertPanel::
  fill_zero, the SwiGLU forward panel match, and the fp32 oracle paths in
  expert_linear_forward / expert_linear_backward.
- gpu/tensor-gpu/src/lib.rs: GpuBf16Tensor::widen_into and ::adamw_step.
- gpu/tensor-gpu/src/main.rs: both arms of check_adamw_master's run closure.

The gemm transpose_probe bin, flash-attn's function_profile, and the
ExpertPanel upload paths needed no change: the probe already launches inside
`unsafe`, and the other two are host-side.
Two containers on the merged branch measure 576.68 and 572.73 ms at the §13.9
shape, per-span spread <=0.71 ms on a 44 ms span. The pre-merge branch's
648.1 ms is not reproducible: it was that branch's missing-merge state plus
container luck, not the codegen backend.

The residual against main's recorded 552.80 ms is +21 ms (+3.9%) and splits
cleanly. `optimizer.experts.sync_compute` (5.52 -> 7.11, +29%) and
`optimizer.lm_head.sync_w_t` (0.242 -> 0.306, +26%) are the only spans in the
step that move more than a few percent, and both are `transpose_bf16_pairs` --
about 1.7 ms of the 21, which #58 largely deletes. Everything else sits at a
uniform +3% across memory-bound AdamW and compute-bound tcgen05 alike, and the
flash kernel benches -- the one measurement comparable across the pin -- come
back at their recorded values (persistent 1.929 ms / 227.1 TFLOP/s vs
1.937 / 226; ptxas budgets identical, persistent forward still 206 regs).

No same-container A/B is possible across this pin: the baseline's own v0.2.1
CLI emits a gemm.ptx the B200 refuses to JIT (DriverError 218).

Gates on the merged branch (B200): vecadd, ops, tensor-gpu, gemm (including
the transposed M256 case), flash-attn flash (parity + budgets), and all 14
model gates including checkpoint v5 resume and v4 rejection. The model suite's
first run missed the aligned-MoE overfit gate at 0.0515 against a 0.05
threshold and the rerun landed at 0.000033 -- that gate's known knife-edge, not
a merge artifact.
@feitreim

Copy link
Copy Markdown
Owner Author

Brought the branch up to date with main (b46b711 merges 31e1a9c — all six merges since the fork: #47/#53/#54/#55/#57/#59) and revalidated end-to-end on B200: vecadd/ops/tensor-gpu/gemm (incl. the transposed M256 case)/flash-attn/model all green (one documented knife-edge overfit flake, clean on rerun). Every launch site added by the six merges got the unsafe + SAFETY treatment (found via a sweep over all 110 kernel names, not the compiler alone); main's dump_ptx multi-artifact fix and the branch's compare_profile baseline-toolchain install both survived; decision-log renumbered (bf16 masters = 23, this pin = 24).

The 648 ms question is retired. Two containers on the merged branch: 576.68 / 572.73 ms (span spread ≤0.7%). The original 648.1 was the pre-merge branch state plus container luck, not the new backend. Residual vs main's 552.80: +3.9%, which decomposes as (a) a uniform +3% across all spans including memory-bound ones — container epoch signature, corroborated by flash benches returning byte-identical recorded numbers (persistent 206 regs, 1.929 ms / 227.1 TFLOP/s) — and (b) one real regression: transpose_bf16_pairs is ~28% slower under b099f64 (experts.sync_compute 5.52→7.11 ms, lm_head.sync_w_t 0.242→0.306), ≈1.7 ms of step. #58 deletes those spans entirely, so the practical exposure is a window; noted in SPEC §13.9. If we'd rather understand the transpose codegen change before merging, this branch is now a working platform to bisect it on — otherwise this is mergeable as-is from my side.

@feitreim
feitreim merged commit 4471225 into main Jul 26, 2026
@feitreim
feitreim deleted the chore/issue-56-cuda-oxide-b099f64 branch July 26, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bump cuda-oxide pin to upstream main @ b099f64 (tcgen05.st landed)

1 participant