Skip to content

[ROCm]---Theory--- force ROCm xdist worker GPU env override#749

Open
magaonka-amd wants to merge 8 commits into
ROCm:amd-mainfrom
magaonka-amd:fix/conftest-rocm-xdist-env-override
Open

[ROCm]---Theory--- force ROCm xdist worker GPU env override#749
magaonka-amd wants to merge 8 commits into
ROCm:amd-mainfrom
magaonka-amd:fix/conftest-rocm-xdist-env-override

Conversation

@magaonka-amd

Copy link
Copy Markdown

Use os.environ assignment for ROCR_VISIBLE_DEVICES (not setdefault) so CI runner pre-injected visibility (e.g. gha-gpu-isolation-settings) cannot leave every xdist worker seeing all GPUs.

Set HIP_VISIBLE_DEVICES=0 after narrowing ROCR so workers do not inherit a multi-device HIP filter from the parent environment.

@magaonka-amd magaonka-amd force-pushed the fix/conftest-rocm-xdist-env-override branch 4 times, most recently from 2f7fd82 to 3a6d174 Compare April 15, 2026 01:34
psanal35 and others added 6 commits April 14, 2026 22:53
Use os.environ assignment for ROCR_VISIBLE_DEVICES (not setdefault) so CI
runner pre-injected visibility (e.g. gha-gpu-isolation-settings) cannot leave
every xdist worker seeing all GPUs. ROCm pinning uses ROCR only; do not set
HIP_VISIBLE_DEVICES in conftest.

Allow ROCm plugin/PJRT wheel builds from this repo again (remove build.py
guard) so fork/PR wheel continuous workflows match jax-ml behavior. Plugin
releases remain documented at ROCm/rocm-jax.
Instead of pinning each worker to a single GPU (which skips all
multi-GPU tests), rotate the device ordering so every worker sees
all GPUs but with a different primary device.

Example with 4 GPUs:
  gw0: ROCR_VISIBLE_DEVICES=0,1,2,3
  gw1: ROCR_VISIBLE_DEVICES=1,2,3,0
  gw2: ROCR_VISIBLE_DEVICES=2,3,0,1
  gw3: ROCR_VISIBLE_DEVICES=3,0,1,2

This spreads single-GPU test load across physical devices while
keeping multi-GPU tests runnable. Reads existing ROCR_VISIBLE_DEVICES
from CI runner isolation settings and rotates within that subset.
Ensures import jax loads from the checkout (jax/ under the repo root)
before any jax in site-packages, matching tests/ to the tree that
contains conftest.py and internal modules like jax._src.*.
The PallasCallMultimemTest and PallasCallMultimemThreadUnsafeTest
classes access cuda_versions.cuda_supports_multicast() in setUp
without first checking that cuda_versions is not None. On ROCm
(and other non-CUDA platforms) this raises an AttributeError.

Add an early skip when cuda_versions is None since multicast
memory is a CUDA-specific hardware feature.
@magaonka-amd magaonka-amd force-pushed the fix/conftest-rocm-xdist-env-override branch from 53448ad to 5084c96 Compare April 15, 2026 03:53
Set --xla_force_host_platform_device_count=$gpu_count so the CPU
backend creates enough logical devices for colocated_python tests
that need one CPU device per GPU.
@mminutoli mminutoli force-pushed the amd-main branch 4 times, most recently from 40c94c1 to b5d7662 Compare May 26, 2026 19:06
@mminutoli mminutoli force-pushed the amd-main branch 3 times, most recently from 28ad382 to e3a4195 Compare June 2, 2026 15:46
@psanal35 psanal35 force-pushed the amd-main branch 2 times, most recently from 729ed31 to 88e42dc Compare June 18, 2026 21:18
@mminutoli mminutoli force-pushed the amd-main branch 2 times, most recently from cb097f7 to d347a4f Compare June 22, 2026 18:14
@mminutoli mminutoli force-pushed the amd-main branch 2 times, most recently from 3f9e8b4 to f25f2b4 Compare June 27, 2026 01:32
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