Repository navigation
fix(ptx-schedule): the usage string omits the --output spelling it accepts - #1109
Merged
nihalpasham merged 1 commit intoAug 21, 2026
Merged
Conversation
…cepts
`main.rs` parses the output path as `"-o" | "--output"`, but its usage line
shows only `[-o OUTPUT]`:
usage: ptx-schedule INPUT.ptx [--list-sites] [--seed N] [--intensity F]
[--max-sleep-ns N] [--focus TEXT] [-o OUTPUT] [--decisions-json FILE]
Every other flag the loop accepts appears there, so `--output` is the one
working spelling a reader cannot discover. Nothing is broken -- both forms work
-- but the usage text is the only help this binary has, since it hand-rolls its
argument parsing rather than deriving `--help` from clap.
Name both, as the arm does.
Checked the rest of the tree for the same gap: comparing every flag a
hand-written usage string documents against the flags its parser accepts,
`ptx-schedule` was the only real mismatch. `smoketest.sh` documents all eight
of its flags; the `cargo-oxide` and `cuda-intrinsics-gen` binaries derive help
from clap, so there is no hand-written string to drift; and the `--output-file`
/ `--verbose` / `--version` strings in `cuda-artifact-finalizer` are arguments
it passes to ptxas, not flags of its own.
Verified: the documented set and the parsed set are now equal in both
directions; fmt clean, `clippy --all-targets -- -D warnings` clean, and the
crate's 9 tests pass.
Signed-off-by: Vyncint Ng <[email protected]>
Collaborator
|
nihalpasham
approved these changes
Aug 21, 2026
nihalpasham
added a commit
that referenced
this pull request
Aug 23, 2026
…#1136) * fix(ptx-schedule): the usage line brackets an option the CLI requires #1109's review flagged this: the brackets mark `-o|--output` optional, but outside `--list-sites` the output path is required, and the binary exits with the usage message when it is missing. ptx-schedule INPUT.ptx [--list-sites] ... [-o|--output OUTPUT] ... One bracketed list cannot state this CLI's shape. `--output` is required to perturb and meaningless when listing, so bracketing it is wrong in one mode and misleading in the other. It becomes one line per invocation form, which is what `cuda-intrinsics-gen`'s usage text already does for the same reason: usage: ptx-schedule INPUT.ptx --list-sites print the schedule-sensitive sites as JSON; the options below are ignored ptx-schedule INPUT.ptx -o|--output OUTPUT [--seed N] [--intensity F] [--max-sleep-ns N] [--focus TEXT] [--decisions-json FILE] write a perturbed copy of INPUT.ptx to OUTPUT The second half of the same problem: every way to get the command line wrong printed the identical block with nothing said about which way. `usage_because` prefixes the reason, and the six copies of `args.next().unwrap_or_else(|| usage())` -- each meaning "this flag needs a value", none saying so -- become one `next_value` helper that names the flag. Before, all four of these printed the same wall of text; now: ptx-schedule error: an input PTX file is required ptx-schedule x.ptx --seed error: --seed needs a value ptx-schedule x.ptx --bogus error: unrecognized argument "--bogus" ptx-schedule x.ptx --seed 7 error: -o|--output is required unless --list-sites is given Exit code stays 2 in every case, and both working forms are unchanged -- verified against a real module: `--list-sites` prints the JSON, and `--seed 7 -o out.ptx` reports `sites=2 injected=2`. Two tests. The first turns #1109's hand-checked parity into an assertion: the usage text names exactly the long flags the parser accepts, both directions, reading the arms out of the source (an arm can name two spellings, `"-o" | "--output"`, so it takes every quoted flag on the line). The second pins the shape this PR is about -- `--output` is not bracketed on the form that requires it, and does not appear on the listing form. They fail respectively when a flag is dropped from the text and when the brackets are put back. The README needs no change: its two examples are already the two forms, one with `-o` and one without. Verified: 16 tests pass, fmt clean, `clippy --all-targets -- -D warnings` clean, `cargo doc --document-private-items` clean. Signed-off-by: Vyncint Ng <[email protected]> * fix(ptx-schedule): parse exclusive modes with clap Model list and rewrite as exclusive modes, reject malformed commands before file access, and exercise both valid forms through the binary. Signed-off-by: nihalp <[email protected]> --------- Signed-off-by: Vyncint Ng <[email protected]> Signed-off-by: nihalp <[email protected]> Co-authored-by: nihalp <[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.
main.rsparses the output path as"-o" | "--output", but its usage line shows only[-o OUTPUT]:Every other flag the loop accepts appears there, so
--outputis the one working spelling a reader cannot discover. Nothing is broken — both forms work — but this usage text is the only help the binary has, since it hand-rolls its argument parsing rather than deriving--helpfrom clap.Name both, as the match arm does.
The rest of the tree is clean on this
I compared every hand-written usage string's flags against the flags its parser accepts.
ptx-schedulewas the only real mismatch:smoketest.shdocuments all eight of its flags.cargo-oxideandcuda-intrinsics-genbinaries derive help from clap, so there is no hand-written string to drift from.--output-file/--verbose/--versionstrings incuda-artifact-finalizerare arguments it passes to ptxas, not flags of its own.Verified: the documented set and the parsed set are now equal in both directions; fmt clean,
clippy --all-targets -- -D warningsclean, and the crate's 9 tests pass.