Repository navigation
[rocjitsu] Add --cpu-thread-budget to rocjitsu and mirage - #12245
Conversation
✅ All Checks Passed — Ready for Review
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🎉 All checks passed! This PR is ready for review. |
kuhar
left a comment
There was a problem hiding this comment.
We should preserve the loader's accepted syntax when applying --cpu-thread-budget, and add regression cases for adjacent comments and quoted field names. In emulation/rocjitsu/lib/rocjitsu/src/rocjitsu/config/effective_config.cpp:101, scalar scanning consumes comment openers: "cpu_thread_budget":32// ceiling followed by a newline and comma, or 32/*,}*/, parses without the override but fails after replacement. At line 128, single-quoted keys are rejected and "cpu_thread_budge\u0074":32 is compared without decoding, so the rewrite inserts a duplicate budget field. Each form works with --thread-budget-table on the shipped gfx942 config but fails when --cpu-thread-budget 4 is added. Compatible tokenization and decoded key matching would let the launch-only override work with these existing configs.
…mirage Give one launch its own execution-thread ceiling without editing the config file it was given. The launcher copies the config to effective_config.json in that invocation's runtime directory, sets cpu_thread_budget there, and runs from the copy, so the override reaches the native table, VFIO, daemon and local routes alike and is reclaimed with the rest of that directory. The budget is a property of a simulation's config rather than of a process, so nothing process-wide carries it: the rewritten JSON is reparsed and the field read back before use, which turns any mistake into a refusal instead of a run under the wrong ceiling. The flag is refused with --attach, which joins a daemon that already built its machine, and with a config naming a dbt_guest.simulator_config, which is resolved relative to the file declaring it and is where the budget would have to land. mirage run gains the same --cpu-thread-budget. Unlike -o, it composes with --config, because upstream rocjitsu takes the two together; the supplied file is left alone and the run loads a session copy carrying the budget. Co-authored-by: Cursor <cursoragent@cursor.com>
965315a to
243fb33
Compare
TheRock Submodule Bump ActivityNewest first
|
Fix #12245. Add e2e tests and fix the parser. Issue ID: #12234 --- <sub>Stack created with <a href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
…-only tests PR #12475 added the first host-only coverage of `src/gin/gin_host.cc` (the GIN proxy NUMA affinity pin) and PR #12245 the GIN_PROXY_NTHREADS progress-thread behaviour, which together left the file at 59% of lines and 34% of branches. This builds out the rest, so every function in the file now has a test. The test TU's `ncclGin_t` fake grows a uniform `ScriptedFailure` per plugin entry point ("fail call N of this function"), recorders for the `ginConfig`s and `regMrSym`/`deregMrSym` arguments, and knobs for a NULL-returning `createContext` and a `queryLastError` that reports an error on a chosen call. That makes each failure arm reachable without a bespoke fake per test. The same mechanism now also covers `ncclTopoGetLocalGinDevs` and `bootstrapAllGather`, and the rail team's stride is a knob so the stride-validation branches are reachable. New suites, one per entry point: `GinHostTypeQueryMicrotest`, `GinHostSignalRequestMicrotest`, `GinHostConnectOnceMicrotest`, `GinHostBackendSelectMicrotest`, `GinHostDevCommSetupMicrotest`, `GinHostDevCommFreeMicrotest`, `GinHostFinalizeMicrotest`, `GinHostRegisterMicrotest` and `GinHostQueryLastErrorMicrotest`. They all start with `GinHost`, so the existing `GinHost*` CTest pattern picks them up without touching the categories yaml beyond its description. Coverage of `gin_host.cc` in `rccl-UnitTestsMicroGinHost` goes from 59.01% to 100% of lines, 66.67% to 100% of functions, and 33.79% to 74.43% of branches; no source-level branch is left uncovered, the remainder being `NCCLCHECK`/`WARN` macro expansions at call sites whose failure arm no test drives. Testing: `run_host_tests.sh all` passes (80 GinHost tests, shuffled); ten mutations of the hipified `gin_host.cc` -- dropping the NULL-window check, the multi-segment DMABUF requirement, the stride-multiple check, the empty-slot skip, the early return on a reported error, the context round-up, the connectivity check in `ncclGetGinType`, the VA-signal requirement check, the devComm reset on failure, and the fail-path `closeListen` -- each turn exactly the matching test red. Co-authored-by: Pi Agent
…13225) Brings `src/gin/gin_host.cc` to full host-only test coverage in `rccl-UnitTestsMicroGinHost`, and tidies the surrounding microtest infrastructure the work exposed. PR #12475 added the first host-only coverage of this file (the GIN proxy NUMA affinity pin) and PR #12245 the `GIN_PROXY_NTHREADS` progress-thread behaviour, which together left it at 59% of lines and 34% of branches. This builds out the rest: every function in the file now has a test, across nine new suites (one per entry point) covering type query, signal requests, connect-once, backend select, devComm setup/free, finalize, register and last-error query. Coverage of `gin_host.cc` goes from 59.01% to 100% of lines, 66.67% to 100% of functions, and 33.79% to 74.43% of branches; no source-level branch is left uncovered, the remainder being `NCCLCHECK`/`WARN` macro expansions at call sites whose failure arm no test drives. The test TU's `ncclGin_t` fake gains a uniform `ScriptedFailure` per plugin entry point ("fail call N of this function") plus argument recorders, so each failure arm is reachable without a bespoke fake per test. `FakeGin` hands out tagged handles rather than relying on a file-scope singleton, so tests that hold more than one context stay independent. Four reusable utilities that had accumulated inside the test TU are promoted to shared headers for the other host-only suites: `ScopeExit.h`, `ScriptedFailure.h`, `WaitUntil.h` and `JoinThreadsOnExit.h`. Externals the suite had been defining locally move onto the fakes file named for the production TU that defines each, per `MICROTEST_README.md`: `bootstrapAllGather` to `fakes/bootstrap_stubs.cc`, `ncclOsCpuCount`/`ncclOsSetAffinity` to `fakes/os_fakes.cc`, `ncclSetThreadName` to `fakes/nccl_fakes.cc`, and the `ncclTeam*` accessors to a new `fakes/nccl_device_core_fakes.cc`. Each moved seam picks up `ASSERT_HOOK_MATCHES_PROD` signature-drift checking from its new home. Testing: `run_host_tests.sh all` passes — all 13 host-only binaries green, 87 `GinHost` tests, shuffled. Ten mutations of the hipified `gin_host.cc` (dropping the NULL-window check, the multi-segment DMABUF requirement, the stride-multiple check, the empty-slot skip, the early return on a reported error, the context round-up, the connectivity check in `ncclGetGinType`, the VA-signal requirement check, the devComm reset on failure, and the fail-path `closeListen`) each turn exactly the matching test red. JIRA ID : AICOMRCCL-2642
Motivation
Add --cpu-thread-budget to the Rocjitsu and Mirage CLIs to launch Rocjitsu with the desired thread budget without modifying the target JSON configuration file.
Technical Details
--cpu-thread-budgetor--cpu-thread-budget=0uses the default thread allocation.--cpu-thread-budget Ncreateseffective_config.jsonin the invocation runtime directory and launches from that copy.--thread-budget-tableapplies the override in memory and does not create a file.--attachrejects--cpu-thread-budgetbecause the daemon already owns its configuration.dbt_guest.simulator_configreject the flag; the budget must be set in the referenced host config.mirage runsupports the same flag. It is shorthand for-o cpu_thread_budget=Nand takes precedence over that option.--configfile unchanged and uses a session copy. Non-plain JSON configs are rejected.Two refusals rather than silent wrong answers:
--attachjoins a daemon that has already built its machine from its own config, so there is nothing left for a budget to apply to.dbt_guest.simulator_configis resolved relative to the file declaring it,and that file, not this one, is what the host VM is built from — so a copy
elsewhere would both break the path and miss the config the budget has to
reach.
Issue Tracking
#12234
Test Plan
Test Result
Tests passed.
Submission Checklist