Skip to content

ci: check the device names the book puts in prose and tables - #846

Merged
nihalpasham merged 1 commit into
NVIDIA:mainfrom
vyncint:ci/book-api-names-prose-and-braces
Aug 13, 2026
Merged

nihalpasham merged 1 commit into
NVIDIA:mainfrom
vyncint:ci/book-api-names-prose-and-braces

Conversation

@vyncint

@vyncint vyncint commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

The gap, with the receipt

#819 reads only ```rust fenced blocks, and said so on purpose: a call is something a reader pastes, while a name in running text might be a PTX mnemonic or another project's function. That scoping left half of the very bug it was written for uncovered.

#815 removed two things from the API quick reference:

-// i32 variants
-let partner_i = warp::shuffle_xor_i32(val, mask);      <- #819 catches this
...
-| `shuffle_xor_{f32,i32}(val, mask)`    | Exchange with lane `id ^ mask`    |
-| `shuffle_down_{f32,i32}(val, delta)`  | Read from lane `id + delta`       |
-| `shuffle_up_{f32,i32}(val, delta)`    | Read from lane `id - delta`       |   <- it does not
-| `shuffle_{f32,i32}(val, src)`         | Read from specific lane           |

Only the first is a call. Reinstating one of those table rows today passes the guard.

The change

A second pass over everything outside a fenced block, restricted to backticked, module-qualified names. Backticks are what make it precise: a backticked warp::foo is a claim about this API wherever it appears, so the false positives that motivated the code-block-only scope do not arise.

_{a,b,c} families are expanded, so a family with one bad member fails on that member rather than passing as an unrecognised literal. The notation is live today in thread::threadIdx_{x,y,z}(), and it is exactly what carried #815's rows.

What it still cannot do

Unqualified table entries stay out of scope. #815's rows as literally written (shuffle_xor_{f32,i32}, no warp::) would need a section-to-module mapping, and inventing one is guesswork — so this catches them only in the qualified form the book now tends to use. I would rather state that limit than imply the hole is fully closed.

Verified

Passes clean: 34 calls in 271 Rust blocks, 31 qualified names in prose and tables, against cuda-device's 1161 exported functions. Exits 1 under four mutations:

mutation reported
#815's table row reinstated, qualified warp::shuffle_xor_i32
bad axis in the live shorthand thread::threadIdx_q
broken call in a code block (pre-existing pass) warp::popc_nope
prose regex rotted parse self-test failed: found 0 qualified device names

Both passes now self-test for a non-empty result, since the new regex is the likelier of the two to break quietly. One implementation note that cost a debug cycle: the brace group must not require its own leading _, because the identifier class is greedy and otherwise swallows the _ in threadIdx_{x,y,z}, leaving the truncated threadIdx_ reported as missing. No GPU needed.

NVIDIA#819 reads only ```rust fenced blocks, and said so: a call is something a reader
pastes, while a name in running text might be a PTX mnemonic or another
project's function. That scoping left half of the very bug it was written for
uncovered.

NVIDIA#815 removed two things from the API quick reference. One code-block line,
`warp::shuffle_xor_i32(val, mask)`, which NVIDIA#819 now catches. And four *table*
rows, written `shuffle_xor_{f32,i32}(val, mask)` -- which it does not, because
they are not in a code block and not literal names. Reinstating that row today
passes the guard.

Adds a second pass over everything outside a fenced block, restricted to
backticked, module-qualified names. Backticks are what make it precise: a
backticked `warp::foo` is a claim about this API wherever it appears, so the
false positives that motivated the code-block-only scope do not arise.
Unqualified table entries stay out of scope -- deciding which module a bare
`shuffle_xor` belongs to is guesswork, and that is the one thing this cannot do
without inventing a mapping.

`_{a,b,c}` families are expanded, so a family with one bad member fails on that
member instead of passing as an unrecognised literal. That notation is live
today in `thread::threadIdx_{x,y,z}()`, and it is what carried NVIDIA#815's rows.

Both passes now self-test for a non-empty result, since the new regex is the
likelier of the two to break quietly.

Verified: passes clean (34 calls in 271 blocks, 31 names in prose and tables,
against 1161 exported fns) and exits 1 under four mutations -- NVIDIA#815's exact
table row reinstated (reports `warp::shuffle_xor_i32`), a bad axis in the live
shorthand (reports `thread::threadIdx_q`), a broken call in a code block
(the pre-existing pass, unchanged), and a rotted prose regex (self-test).

Signed-off-by: Vyncint Ng <[email protected]>
@nihalpasham nihalpasham added enhancement New feature or request build-related Build scripts, toolchain discovery, or compilation setup documentation Improvements or additions to documentation labels Aug 13, 2026
@nihalpasham

Copy link
Copy Markdown
Collaborator

Gist: extends the book-API guard from ```rust blocks to prose and tables, which is where the #815 ghost (warp::shuffle_xor_i32) actually lived. The lookbehind that rejects `::`-prefixed module paths keeps compiler-internal mentions like `intrinsics::warp::...` out of scope, and the reinstated quick-reference row makes the new mode's value concrete.

Verified here (reproduced from a scratch extraction of main + this head):

Landing once CI is green.

@nihalpasham
nihalpasham merged commit c95e219 into NVIDIA:main Aug 13, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-related Build scripts, toolchain discovery, or compilation setup documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants