Repository navigation
feat: add schedule perturbation campaign - #1065
Merged
Merged
Conversation
Merged
…drain pipes, and survive per-seed errors
Collaborator
|
nihalpasham
approved these changes
Aug 20, 2026
This was referenced Aug 21, 2026
nihalpasham
pushed a commit
that referenced
this pull request
Aug 21, 2026
…a pass (#1112) `has_skip_marker` accepts `skipping:` and nothing else. The convention it is implementing has two spellings, and `scripts/smoketest.sh` -- which owns it -- accepts both: if grep -qiE '^[[:space:]]*(skipping:|pass \(skipped\))' "${log}"; then Its own comment names the second form in so many words: "`PASS (skipped): ...` form below sm_75". `generated_ldmatrix` prints exactly that: println!( "PASS (skipped): ldmatrix.m8n8.x4.b16 requires sm_75+; device is sm_{major}{minor}" ); An example declining that way exits 0 and prints no mismatch marker, so `run_binary` classifies the run `RunKind::Pass`. That matters because the campaign gates on it: if !matches!(baseline.kind, RunKind::Pass) { ... println!("schedule-fuzz: BASELINE FAILURE: {:?}; no schedule variants were run", ...) With the right kind the campaign stops there and says so. With `Pass` it proceeds: it patches the PTX, sweeps every seed, and each variant declines identically -- same exit code, same output, so not even `OutputChanged` fires. The campaign reports a clean sweep of a kernel that never launched. This is #665's bug in the second consumer of the same convention. That fix put it as "a skip the function fails to recognise is not merely missing its `(skipped)` annotation -- it is promoted to a full execution PASS", and taught `verdict_standard` the second spelling. `ptx-schedule`'s campaign arrived later (#1065) with only the first. A silent all-clear is the worst outcome available to a bug-finding tool, and it is the one this produces on any device below an example's floor. Hoist both spellings into a `SKIP_MARKERS` constant and check the line against each, with the coupling to the smoketest's pattern recorded next to it. Case-insensitivity is unchanged and already correct: `run_binary` lowercases before classifying, which is what makes this match the smoketest's `grep -i`. Two tests: both spellings are recognised with and without leading whitespace, and the near-misses are not -- a bare `pass`, `pass: 1024 elements verified`, `success`, and a mid-line `no skipping: here`, since the marker is anchored to the start of the line in the smoketest too. Both fail with the second marker removed. Verified: 11 tests pass, fmt clean, `clippy --all-targets -- -D warnings` clean, and `cargo doc --document-private-items` clean. Signed-off-by: Vyncint Ng <[email protected]>
nihalpasham
pushed a commit
that referenced
this pull request
Aug 21, 2026
…#1116) `ptx-schedule` landed in #1065 and depends on both PTX crates. Neither one's README says so, and one of them is now wrong rather than merely short. **`ptx-parse`** lists its consumers in a table: `cuda-oxide-codegen`, `cuda-host`, `cuda-intrinsics-gen`, `cargo-oxide`, `dialect-ptx`. Six crates declare `ptx-parse` as a dependency; that is five of them. `ptx-schedule` takes `Document`, `EditScript`, `Instruction` and `ParseError`, which is as central a use as any row already there. Every other row checks out, including the file-level detail -- `export.rs` and `ptx.rs` in `cuda-oxide-codegen`, and `embedded.rs` in `cuda-host`, all three exist and all three reference `ptx_parse`. **`dialect-ptx`** has a section headed "First consumers" that reads: > The first in-tree consumers of the native CFG are IKET PTX instrumentation > (`dialect-iket`), which needs verified block boundaries and successor edges > to place probes, and the Tile-to-SIMT interop epic (#96) ... Neither is a consumer. `dialect-iket` does not depend on `dialect-ptx` and contains no reference to it; #96 is still an open tracking issue. Meanwhile the one crate that does depend on `dialect-ptx` -- `ptx-schedule`, and it depends on nothing else from it but `cfg::ControlFlow` -- goes unmentioned. So the section states a plan in the present tense, and the reader looking for who actually exercises the native CFG is pointed at two crates that do not. Rename it to "Consumers", name `ptx-schedule` and what it uses the CFG for (back-edge discovery, which is what makes a spin loop perturbable whatever its label, predicate or branch spelling), and keep the other two where they belong, as planned work that does not depend on the crate yet. Verified: `check-book-api-names.sh` reports OK across 159 READMEs; no relative links were added, so crates.io rendering is unaffected (the correction from #981's review). Signed-off-by: Vyncint Ng <[email protected]>
nihalpasham
added a commit
that referenced
this pull request
Aug 21, 2026
* docs(ptx-schedule): the one published crate with no README `ptx-schedule` arrived with #1065 and is the only publishable crate in the workspace with neither a `readme` key nor a README.md on disk. Checked across `cargo metadata`: every other publishable member has both. crates.io renders that file as the package page, so this one would publish with an empty body. This is the same gap #981 closed for `ptx-parse`, and the README follows that one's shape. Content is taken from the crate rather than from the commit that added it: - The purpose and the "owns neither CUDA execution nor an input generator" boundary come from `lib.rs`'s module header. - The seven `SiteKind` variants and the eight campaign `RunKind` verdicts are each enumerated in full, since a partial list of a closed enum is the thing that rots (#978, #1045, #1056). - `InjectionOptions`' four fields, `DEFAULT_MAX_SLEEP_NS` (64 µs), the `nanosleep.u32` insertion, and the `confirm_runs` re-run before a finding is reported are all as implemented. - `cargo oxide fuzz-schedule` is named as the user-facing entry point, with the crate's own binary shown for single-file work; the flags in the example come from `main.rs`'s usage string. One detail carried over from #981's review: the License link is absolute rather than `../../LICENSE`, because crates.io rewrites relative README links against the repository root and the relative form 404s there. Verified: `cargo metadata` now reports `readme: README.md` for the crate and the file resolves; all seven `SiteKind` and eight `RunKind` names appear; `check-crate-inventory.sh`, `check-spdx-headers.sh` and `check-book-api-names.sh` pass; no relative `../` links remain. Signed-off-by: Vyncint Ng <[email protected]> * docs(ptx-schedule): align the README with the code it describes Six statements did not match the crate as it stands: - the execution disclaimer claimed the whole crate owns no CUDA execution while campaign.rs two sections down builds, launches, watchdogs and assigns verdicts; the section now scopes the claim to analyze_ptx/perturb_ptx and points at the campaign layer; - intensity is a probability dial (0.75 x intensity per site, and it scales the drawn sleep lengths), not a fraction of sites touched; - focus re-weights selection by substring over each site's opcode and instruction text (0.95x hits, 0.15x misses); it never restricts the sweep to one callable; - Skipped is assigned only when the example prints a skip marker; a zero-injection seed still runs and reports like the baseline; - findings are reported with their confirmation counts attached, not gated on confirmation; - a seed pins the rewrite, not the schedule the GPU then picks. Smaller table fixes from the same read of classify_instruction: the Barrier row now names mbarrier.*, OrderedMemory names the ordering qualifiers it actually matches (a scope alone never classifies), the Backedge row describes the conservative same-or-earlier-block test (no dominance is computed), and the block-index field is called out as back-edge-only. The injection knobs move into a bulleted list so each one can state its own semantics. --------- Signed-off-by: Vyncint Ng <[email protected]> Co-authored-by: nihalpasham <[email protected]>
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.
this pr adds a schedule perturbation campaign for existing cuda-oxide examples.
the campaign builds an example once, inserts deterministic
nanosleep.u32delays at structural synchronization sites in the generated PTX (atomics, mbarriers, fences, ordered loads/stores, warp collectives, loop back-edges), patches a copy of the executable's embedded artifact, and runs each variant behind a watchdog. the code and inputs never change; only warp timing does, and every mutation is a pure function of the seed so a finding replays exactly.outputs
that finding is a real race: on 1x B200 (
sm_100a), sweeping seeds 0..140 with--focus mbarriersurfaced aTILE_INFOmailbox race in the gemm_sol phase 4B kernel: the producer warp can republish tile coordinates before all five reader warps have copied them, leaving 264 of 1024 output tiles unwritten. seeds 56 and 135 each reproduce it 3/3 against a passing pristine baseline. the fix (and full failure output) is in #1066findings are reported as schedule-sensitive outcomes rather than proof of a data race or deadlock:
CORRECTNESS FAILURE,OUTPUT CHANGE(with--compare-output),TIMEOUT,CRASH, orGPU WEDGEcandidates. a finding is rerun up to--confirm-runstimes, and a timeout is rechecked with pristine PTX so a wedged device is not misreported. mutated PTX, decisions, logs,replay.sh,sites.json, andsummary.jsonland undercrates/fuzzer/artifacts/schedule/<example>/; the standaloneptx-schedulebinary can also--list-sitesor rewrite a PTX file directly. details are incrates/fuzzer/README.md.cargo test -p ptx-schedulepasses (7 tests) andcargo fmt --all -- --checkis clean.please let me know if I should make any changes or adjust the approach. Thanks!