test(odc): add unit/integration tests for ODC (PR #864)#899
Open
botaohu001 wants to merge 2 commits into
Open
Conversation
Add CPU-only tests that exercise the ODC feature wiring and gate the
GPU/rocSHMEM-turbo parts behind clean skips.
tests/runner/test_odc_run_launcher.sh (registered in run_all_tests.sh):
Bash unit test for run_odc.sh launch/config wiring -- mori vs rocshmem
backend env, the pad|nopad no-op arg, PYTHONPATH so `import odc` resolves,
PRIMUS_TURBO_PATH prepend, extra KEY=VAL export, EXP/exp-name/MASTER_PORT
plumbing, and that ODC feature switches are now config items, not env.
tests/trainer/test_odc_megatron_trainer.py (+ .yaml fixture):
- TestOdcRuntimeConfig: stdlib-only unit tests for the config-driven ODC
runtime config (defaults, set_config override/None/unknown handling, the
gda_pipe -> PRIMUS_TURBO_ODC_GDA_PIPE bridge, odc package re-exports).
- TestOdcPatchWiring: before_train patch registration + enable_odc /
use_torch_fsdp2 / enable_odc_lb_mini gating, LB-Mini aligned-vs-decoupled
mode, the #856 device_id patch skip under ODC, and the trainer-config ->
runtime-config bridge. Skips where torch is unavailable.
- TestOdcConfigFixture: asserts the fixture declares the ODC FSDP2 path.
- TestOdcMegatronTrainerE2E: FSDP2 pretrain smoke test that skips cleanly
without ROCm GPU + Primus-Turbo rocSHMEM ops.
Co-authored-by: Cursor <cursoragent@cursor.com>
botaohu001
requested review from
Xiaoming-AMD,
limou102 and
wenxie-amd
as code owners
July 21, 2026 09:15
| gates exactly on the ODC config items. No training is run. | ||
| """ | ||
|
|
||
| def _import_patches(self, dotted: str): |
…sence
The E2E smoke needs Primus-Turbo built WITH the rocSHMEM ops (a stock/pip
primus_turbo is compiled with -DDISABLE_ROCSHMEM and has neither op). Replace
the coarse find_spec("primus_turbo") guard with a hasattr check for the op this
single-node rocshmem fixture uses (odc_rocshmem_host), so a "GPU present but
turbo lacks ODC ops" host skips cleanly instead of crashing mid-run. Comment
points to building a host-capable Primus-Turbo per the repro guide (§6.3).
Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Added CPU-only test, covering ODC assembly logic; GPU/rocSHMEM-turbo parts are cleanly skipped.
tests/runner/test_odc_run_launcher.sh (registered into run_all_tests.sh): Tests the startup/configuration assembly of run_odc.sh—backend environment (mori vs rocshmem), pad|nopad no-op, PYTHONPATH can import odc, PRIMUS_TURBO_PATH is set to the front, KEY=VAL is passed through, EXP/exp-name/MASTER_PORT, and the ODC switch is now a configuration item instead of the environment.
tests/trainer/test_odc_megatron_trainer.py(+ YAML fixture):TestOdcRuntimeConfig: Configures the driver's runtime config (default values, override/None/unknown keys forset_config, gda_pipe→PRIMUS_TURBO_ODC_GDA_PIPE bridging, odc package re-export).TestOdcPatchWiring: Registers and gates three before_train patches (enable_odc/use_torch_fsdp2/enable_odc_lb_mini), LB-Mini alignment/decoupling, skips #856 device_id under ODC, config→runtime bridging (skips if no torch).TestOdcConfigFixture: The fixture indeed declares the ODC FSDP2 path.TestOdcMegatronTrainerE2E: FSDP2 training smoke test, cleanly skipped without GPU + turbo.