Repository navigation
fix(ignition): forward recipe b12x_environment to multi-host peer ranks - #675
Closed
Reederey87 wants to merge 1 commit into
Closed
Reederey87 wants to merge 1 commit into
Reederey87 wants to merge 1 commit into
Conversation
Why this change is needed:
Multi-host preparation (`ignition export --ranks` and `ignition debug-serve --ranks`
paired with `ignition join`) applies `plan.recipe.b12x_environment` on rank zero in
`ignition/cli/serve.py`, whereas remote peers running `join` call
`environment.apply(configuration, (gpu,))` with an empty b12x mapping before
contacting rank zero. `environment.apply` invokes `runtime_patches.apply()`, which
imports `b12x.preparation` through `workers.register_hooks()`, so recipe-declared
`B12X_*` settings (such as `B12X_W4A16_A4_PREFILL=1` on `glm53` or
`B12X_W4A16_SMALL_M_HOST_BARRIER_RESET=0` on `kimi3`/`kimi31`) never reach remote
ranks unless manually exported on every peer host. On multi-host tensor-parallel
exports this causes rank zero and remote ranks to prepare with asymmetric b12x
environment settings.
What changed:
- `ignition/preparation/host_ranks.py`:
- Added `_validate_b12x_environment` enforcing the same `B12X_*` string-value
contract as `Recipe.__post_init__` (`ignition/declaration.py`).
- Added an optional `b12x_environment=()` parameter to `HostRendezvous.__init__`,
validated before binding the listening socket, and included
`"b12x_environment"` in the control-channel admission JSON reply in
`HostRendezvous._admit`.
- Updated `knock` to validate `reply.get("b12x_environment", {})` (closing the
control socket without opening an executor connection on rejection) and return
`(control, executor, b12x_environment)`.
- `ignition/cli/serve.py`:
- Passed `b12x_environment=model.recipe.b12x_environment` into `HostRendezvous` in
both `_export_hosts` and `debug_serve`.
- Reordered `join` to compute `source_identity()` and call `knock(...)` before
calling `environment.apply(configuration, (gpu,), b12x_environment)`—matching
rank zero's ordering—and closing both sockets if `environment.apply` raises.
- `tests/preparation/test_host_ranks.py`:
- Added tests covering multi-rank propagation, pre-bind rejection of invalid
settings, peer-side rejection and socket cleanup on malformed replies, `join`
applying received `B12X_*` variables before `runtime_patches.apply()` and
`serve_peer()`, and socket cleanup when `environment.apply` fails.
Claimed benefit:
Every rank in a multi-host preparation or export session receives and applies the
recipe's declared `b12x_environment` before PyTorch, Triton, or `b12x` is imported,
matching single-host rank inheritance without manual per-host environment variables
or new CLI flags.
Evidence and limitations:
- Ran `pytest tests/cli tests/preparation/test_host_ranks.py tests/preparation/test_checkpoint_source.py`
on Linux aarch64 with `flare_heliopause` and `protoc` (`CUDA_VISIBLE_DEVICES=""`):
195 passed, 0 failed.
- Limitations: Live multi-host CUDA export (`FLARE_RUN_TP_CUDA_TESTS=1`) was not
re-executed on this commit; CPU tests exercise the real `HostRendezvous`, `knock`,
and `ignition.cli.serve.join` entry points over loopback sockets with stubbed GPU
discovery and `serve_peer`.
Design-Signed-Off-By: Artem Matskevych; design-review=2e5b
Signed-off-by: Artem Matskevych <52060443+Reederey87@users.noreply.github.com>
Collaborator
|
A case file has been opened for 675. Future reviews will auto-run 90 minutes after code updates are pushed.
|
Collaborator
Review StoppedAuto-Review halted due to finding: Another open pull request already covers this change, or more of it. |
Author
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.
Why this change is needed
During multi-host preparation (
ignition export --ranksandignition debug-serve --rankspaired withignition join), rank zero appliesplan.recipe.b12x_environmentviaenvironment.applyinignition/cli/serve.py. Remote peer ranks runningjoincallenvironment.apply(configuration, (gpu,))with an emptyb12xmapping before callingknock(). Becauseenvironment.applyinvokesruntime_patches.apply(), which importsb12x.preparationthroughworkers.register_hooks(), recipe-declaredB12X_*settings (such asB12X_W4A16_A4_PREFILL=1inglm53orB12X_W4A16_SMALL_M_HOST_BARRIER_RESET=0inkimi3/kimi31) never reach remote peer ranks unless operators export them manually on every worker host. As a result, rank zero and remote ranks prepare and export with asymmetric b12x settings.What changed
ignition/preparation/host_ranks.py_validate_b12x_environmentenforcing the sameB12X_*key prefix andstrvalue invariant asRecipe.__post_init__(ignition/declaration.py).b12x_environment=()parameter toHostRendezvous.__init__(validated before binding the listening socket) and included"b12x_environment"in the control-channel admission JSON reply inHostRendezvous._admit.knockto validatereply.get("b12x_environment", {})(closing the control socket without opening an executor connection on rejection) and return(control, executor, b12x_environment).ignition/cli/serve.pyb12x_environment=model.recipe.b12x_environmenttoHostRendezvousin both_export_hostsanddebug_serve.jointo computesource_identity()and completeknock(...)before callingenvironment.apply(configuration, (gpu,), b12x_environment)—matching rank zero's ordering—and closing both sockets ifenvironment.applyraises.tests/preparation/test_host_ranks.pyjoinapplying receivedB12X_*variables beforeruntime_patches.apply()andserve_peer(), and socket cleanup onenvironment.applyfailure.Claimed benefit
Multi-host preparation and export sessions propagate recipe-declared
b12x_environmentsettings to every peer rank before PyTorch, Triton, orb12xis imported, matching single-host rank inheritance with no manual per-host environment configuration and no new CLI flags.Supporting evidence and limitations
CUDA_VISIBLE_DEVICES="" pytest tests/cli tests/preparation/test_host_ranks.py tests/preparation/test_checkpoint_source.pyon Linux aarch64 withflare_heliopauseandprotoc: 195 passed, 0 failed.HostRendezvous,knock, andignition.cli.serve.join, verifying both happy-path ordering and rejection without partial mutation or leaked sockets.FLARE_RUN_TP_CUDA_TESTS=1) was not re-executed on this commit.Discord: no username provided