Repository navigation
fix(fuzzer): parse a Rust type past the semicolon inside an array - #766
Merged
nihalpasham merged 4 commits intoAug 10, 2026
Merged
nihalpasham merged 4 commits into
nihalpasham merged 4 commits into
Conversation
The adapter captured types with `[^;]+`, which reads a Rust type as
everything up to the first semicolon. An array type carries a semicolon
inside its brackets, so `[u128; 1]` was captured as `[u128`.
Two sites suffered. The anchor that inserts the dump-local declarations
matched `type RET = [^;]+;`, so on an array return type it stopped mid
type and left the remainder stranded after the inserted declarations:
type RET = [u128;
let __rl_dump0: (u64,); 1];
which rustc reads as a statement and refuses. The local-declaration scan
truncated the same way, so an array-typed local was recorded as `[i32`
and reported under that name when the trace API declined to hash it.
split_type_at_semicolon tracks bracket depth over `(` and `[` in the
idiom split_args already uses, and stops at the first semicolon outside
them. Both sites now share it.
Neither fault was reachable with `composite_count = 0`: no signature in
seeds 300-499 contains a semicolon. That setting is what kept the whole
composite space out of the fuzzer, including the aggregate constants that
issue NVIDIA#393 turned out to live in. It is raised to 3 here, with
`adt_count` left at 0 since the adapter extracts one function and carries
no user-defined type definitions with it.
When the adapted function carries dump locals but the `type RET = ..;` alias (or its depth-0 terminating `;`) cannot be found, the adapter silently skipped inserting the declarations. The rewritten dump calls then referenced undeclared locals, rustc rejected the case, and run_seed.py misreported the adapter's own parse gap as a backend COMPILE_FAIL. Raise SystemExit instead, in the file's existing style, so the seed reports as UNSUPPORTED [adapter] with the real reason.
run_seed.py printed absolute log paths, so every printed summary (and any transcript quoted from it) was tied to one particular checkout, while the README's quoted transcripts showed repo-relative paths that the tool never actually printed. Render the paths relative to the repo root at every print site and in summary.jsonl, so the quoted transcripts are the literal output of the quoted commands.
Raising composite_count to 3 changes what every seed generates, which staled the README's seed-specific claims: seed 192 no longer produces the quoted two-dump-site case (it is now UNSUPPORTED, dumping [i128; 1]), and seed 162 no longer reproduces the checked-in generated_case.rs (it now dumps a (bool,) tuple and adapts to nothing). Re-anchor the two-dump-site illustration on seed 33, which under the shipped config emits exactly the previously quoted dump sites and passes CPU/GPU comparison on sm_120. Keep the checked-in snapshot as is, since no nearby seed under the new config calls libdevice and the fmaf64 coverage is why it exists; state in the README and in its header that it predates the composite config and cannot be regenerated from its seed. Quote the seed 0/1 transcript from a real run: it needs --keep-going, because seed 0's UNSUPPORTED otherwise stops the run before seed 1, and its seed 0 line carries the log path.
Collaborator
|
Verified:
Pushed three follow-ups on the branch:
One note: the two-seed transcript needs |
nihalpasham
approved these changes
Aug 10, 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 adapter captured Rust types with
[^;]+, which reads a type as everything up to the first semicolon. An array type carries a semicolon inside its brackets, so[u128; 1]was captured as[u128.Summary
Adds
split_type_at_semicolon, uses it at both sites that captured a type, and raisescomposite_countfrom 0 to 3 now that the adapter survives what that produces.Changes
crates/fuzzer/tools/mir_generator.py:split_type_at_semicolon, tracking bracket depth over(and[in the idiomsplit_argsalready uses. Thetype RET = ..;insertion anchor and the local-declaration scan both use it.composite_count = 3inTINY_CONFIG, and the module docstring no longer says the generated program is scalar-only.crates/fuzzer/README.md: refreshes the two quoted--start 0 --count 2transcripts, which the config change makes stale.Rationale
The insertion anchor matched
type RET = [^;]+;. On an array return type it stopped mid type and left the remainder stranded after the inserted declarations:rustc reads that as a
letstatement in expression position and refuses the case. The local-declaration scan truncated the same way, so an array-typed local was recorded as[i32and reported under that truncated name when the trace API declined to hash it. Since anUNSUPPORTEDreason is how the next widening of the trace API gets chosen, a truncated type name misdirects that choice.Neither fault was reachable as checked in. No
fn0signature in seeds 300-499 contains a semicolon atcomposite_count = 0, because that setting keeps tuples and arrays out of the generated program entirely. The knobs above it inTINY_CONFIG(tuple_max_len,array_max_len) have been inert.That is the reason to raise it. The fuzzer's most valuable find so far, the silent miscompile behind #393, lived in aggregate constants with padding, and the configuration excludes that whole space.
adt_countstays at 0: the adapter extracts one function and carries no user-defined type definitions with it, so a generatedAdt20fails to resolve. Widening to ADTs is a separate change.Validation
RTX 5060 Laptop GPU, compute capability 12.0, CUDA 13.3, driver 610.43.03.
Seeds 300-359, changing only the adapter, both runs at the
composite_count = 3andadt_count = 0this PR ships:Both failures in the before column were the stranded-type syntax error rather than a backend refusal, and both become passing device runs.
Seeds 1000-1999 on the fixed adapter at the same configuration:
Six of those seven are #765. The seventh is a separate backend fault that llc rejects, reported separately.
Aggregate reach over the same 60 seeds, counting programs whose locals or return type hold an array or a multi-field tuple:
The remaining 18 are
UNSUPPORTED, refused at the trace boundary because a dump site or return position holds the aggregate itself. Hashing an aggregate by its scalar leaves would convert most of them and is the obvious next step.The truncation fix is visible in the reason text, which now names the whole type:
#765 was surfaced by that sweep and the checked-in configuration cannot reach it.