Skip to content

tp: parse the runner's command before taking any resource (carried from #636) - #1126

Closed
jayleaton wants to merge 2 commits into
ashhart:mainfrom
jayleaton:carry/tp-command-preflight
Closed

jayleaton wants to merge 2 commits into
ashhart:mainfrom
jayleaton:carry/tp-command-preflight

Conversation

@jayleaton

Copy link
Copy Markdown
Contributor

What this changes

tf-tp-test parses its whole command before it reads any configuration or opens a driver, bootstrap or fate channel. A malformed command exits 2 with the usage line and takes no resource.

This is the first of three carries from #636, as asked in its closing comment (#636 (comment)): the command parser and its invalid-command controls, from @cwschroeder's series (88418d8, 4c69b0d). Both commits keep @cwschroeder as author, with -x provenance and the Reported-by: Bizuayeu trailer.

gpu_main: args → cli.parse (gpu_cli.zig) → usage + exit 2 on any malformed command
                          ↓ valid
          kernel | roce-host | hca | Config.fromEnv → session → suite | failfast
  • zig/src/fabric/tp/gpu_cli.zig (new): the command grammar, its unit tests, and the invalid table of malformed commands.
  • zig/src/fabric/tp/gpu_main.zig: dispatches on the parsed command. The failfast host-only refusal, kernel, roce-host and hca behave as before.
  • zig/build/tp.zig: test-tp-cli runs the parser's tests on every host. On a native Linux build, every invalid command runs tf-tp-test with TF_TP_WORLD=invalid. Each must exit 2 and print exactly the usage line, which proves the command is refused before configuration. Without an embedded mailbox kernel, kernel must exit 1 and print mailbox kernel 0 B. test-tp depends on test-tp-cli.

Adaptation onto main: build/tp.zig keeps main's portable test-tp and Linux compile check. The CLI step sits beside them, and every negative control is kept.

Receipt

  • Environment: GitHub Actions on this PR (ubuntu-latest zig, windows-latest zig-windows), Zig 0.17.0, base d1018b31.
  • Tests: the controls run in zig build test (results in this PR's checks).
  • Not run: no GPU or RDMA run; no hardware claim. No local Zig build; CI is the test environment.

Checklist

  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off. (Test runner only.)
  • No precision traded for speed. No bits change.
  • No GPU kernel added or changed.
  • New tests fail before the change, pass after it. (Not re-run against the old runner here; the old runner read configuration before refusing some malformed commands and printed "unknown command" instead of the usage.)
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths. No AI attribution lines.

(cherry picked from commit 854b57c)
Reported-by: Bizuayeu <ashhart#636 (comment)>
(cherry picked from commit 88418d8)
(cherry picked from commit 602a0fd)
Reported-by: Bizuayeu <ashhart#636 (comment)>
(cherry picked from commit 4c69b0d)
@jayleaton
jayleaton marked this pull request as ready for review October 20, 2026 20:04
@ashhart

ashhart commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Thank you for carrying this from #636. It is on main as 094a090, with @cwschroeder as author and you as co-author: tf-tp-test parses its whole command before it reads configuration or opens a driver, bootstrap or fate channel, and a malformed command exits 2 with the usage line. On our side the build hooks keep the release branch's Windows guard for the POSIX socket suite, and your 18 entry-point controls run in the Linux test set. It ships with the next release. Closing as landed.

- Synthema, Ash's AI Assistant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants