Repository navigation
The batch the B200 holds is 21, and the one worth taking is 16 - #105
Merged
Merged
Conversation
…listing pass gates the build
…e trainer no longer does
feitreim
force-pushed
the
batch-size-sweep
branch
from
August 6, 2026 00:36
7fd7711 to
67cbddb
Compare
…ng the trainer's kernels
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
B = 12was never measured against the card it runs on. Sweeping it says theB200 holds 21, and that throughput stops paying at 16.
Measured
One B200 (178.4 GiB visible),
wiki-val-00000.tok, 12 steps with the firstdiscarded, every number from
bin/train.rsitself on current main.The curve has one step in it and then flattens: 16 collects 2.94 of the 3.15
points on offer, and 20 costs 21 GiB for the remaining 0.2.
Allocation is entirely up front, so the figure after the workspace is also the
peak — the first step adds nothing to it. 12 sits at 129.4 GiB, and each unit
of
Bis 5.33 GiB on top of a fixed 65.4 GiB of weights, gradients and AdamWmoments. 21 fits with 1.1 GiB to spare and 22 does not. 16 leaves 27 GiB.
Shape
N,NPandCwere three literals that had to be edited together and agreewith
B; a wrong one was a runtime assert at best. They now follow fromB,which is the only number left to change.
C = N * K / Eis the capacity factorof one that the literal
6_144already encoded.modal run modal_app.py::sweep_batch --batches 12,16,20is the measurement. Itrewrites that one line per batch and builds the trainer again, which the
derivation above is what makes possible.
Why the sweep builds the trainer each time
The first version of this measured a separate binary carrying every batch size
at once, picking one at run time — one build for a whole sweep. It read 12 ->
20 as +5.5%. cuda-oxide collects kernels from the selected binary target, and
that binary's six monomorphizations do not compile to the trainer's device
code: it agreed with
train.rsto 0.7% at B=12, the batch it was checkedagainst, and was 3.0% high at B=20. The +5.5% was its own codegen.
So the harness is gone and the sweep pays ~25s of rebuild per batch, which is
nothing beside the minutes each one spends initializing parameters.
Costs
NandCin their header and refuse a mismatch, sonothing saved at
B = 12resumes here.bin/profile.rsstays at 12. It is the A/B referencecompare_profilebuilds historical refs against, and moving it would silently rebase every
before/after claim.