Repository navigation
docs(book): document the launch-bounds spill warning and its escape hatch - #798
Merged
nihalpasham merged 2 commits intoAug 11, 2026
Merged
Conversation
…atch NVIDIA#757 taught the backend to warn when a `#[launch_bounds]` kernel spills registers. The warning is user-facing and nothing in the book mentions it, so the first time anyone meets it is in their own build output. Two things make that worse than an ordinary documentation gap: * The build still succeeds. A bound that ptxas can only satisfy by spilling to local memory is a silent trade -- occupancy bought, then paid for again on every access to a spilled value -- and the warning is the only signal. * `#[allow(...)]` does not silence it. These are raw span diagnostics rather than lints, so the attribute a Rust user reaches for first does nothing, and the only escape hatch is `CUDA_OXIDE_NO_SPILL_WARN=1`, which appears in no documentation at all. So the `#[launch_bounds]` section now carries the diagnostic's actual shape, what it means, the usual responses, and the environment variable -- framed for builds that measured the spill and accepted it, which is the intent recorded on `emit_launch_bounds_spill_warnings`. It also says plainly that spilling is not automatically wrong, since a kernel can be faster spilling a little at high occupancy than not spilling at low. Every message string is quoted from `crates/rustc-codegen-cuda/src/lib.rs` rather than paraphrased; the byte and register figures are illustrative and labelled as such. Verified with `sphinx-build -W --keep-going`. Note for triage: issue NVIDIA#708 asked for this warning and is still open even though NVIDIA#757 merged it, so it looks like another squash-merge where the `Closes` did not fire. Signed-off-by: Vyncint Ng <[email protected]>
The warning is emitted from write_device_artifact_object only when a materialized cubin exists; plain PTX builds never run ptxas, so there is no resource report to inspect. Say so, and show --materialize-cubin in the escape-hatch example command.
Collaborator
|
Gist: the warning existed, the escape hatch existed, the book knew about neither. This documents both, with the diagnostic quoted verbatim and the honest note that a measured spill can be a fair trade. I pushed one commit ( Verified here: emission point re-checked in the backend source; book builds warning-free with the fix. Merging. We'll close #708 against #757 separately, as your PR body flags. |
nihalpasham
approved these changes
Aug 11, 2026
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.
The gap
#757 taught the backend to warn when a
#[launch_bounds]kernel spillsregisters. The warning is user-facing and nothing in the book mentions it, so
the first time anyone meets it is in their own build output.
Two things make that worse than an ordinary documentation gap:
local memory is a silent trade — occupancy bought, then paid for again on
every access to a spilled value. The warning is the only signal that happened.
#[allow(...)]does not silence it. These are raw span diagnostics ratherthan lints, so the attribute a Rust user reaches for first does nothing. The
only escape hatch is
CUDA_OXIDE_NO_SPILL_WARN=1, which appears in nodocumentation — it exists solely as a doc comment on
emit_launch_bounds_spill_warnings.The change
The
#[launch_bounds]section now carries the diagnostic's actual shape:…plus what it means, that only kernels carrying
#[launch_bounds]are checked,the usual responses, and the environment variable in a
warningadmonition sothe
#[allow]dead end is hard to miss.It also says plainly that spilling is not automatically wrong — a kernel can
be faster spilling a little at high occupancy than not spilling at low — because
the point of the warning is to make that a deliberate trade rather than an
accidental one, which is the intent recorded on the emitting function.
Every message string is quoted from
crates/rustc-codegen-cuda/src/lib.rsrather than paraphrased (I diffed them against the source). The byte and
register figures are illustrative and labelled as such, since they are whatever
ptxas reports for a given kernel.
Verification
sphinx-build -W --keep-going -b html, as the book gate runs it: exit 0.Note for triage
Issue #708 asked for exactly this warning and is still open even though #757
merged it — looks like another squash merge where the
Closesdid not fire.Flagging rather than touching it.