Skip to content

[ROCm] Enable MoE FP8 kernel and grouped MM tests on ROCm#3994

Merged
danielvegamyhre merged 3 commits into
pytorch:mainfrom
brucechanglongxu:rocm-moe-kernel-tests
Mar 10, 2026
Merged

[ROCm] Enable MoE FP8 kernel and grouped MM tests on ROCm#3994
danielvegamyhre merged 3 commits into
pytorch:mainfrom
brucechanglongxu:rocm-moe-kernel-tests

Conversation

@brucechanglongxu

Copy link
Copy Markdown
Contributor

Fix module-level capability gates in test_kernels.py and test_fp8_grouped_mm.py that used raw get_device_capability() >= (9, 0). This incorrectly passes on MI250X (gfx90a reports capability 9.0 despite lacking FP8 support) and incorrectly skips on MI300/MI350. Replace with is_sm_at_least_90() || is_MI300() || is_MI350().

test_kernels.py:

  • Enable 5 FP8 kernel tests on MI300/MI350: jagged rowwise scales, jagged rowwise scales via transpose, jagged colwise scales, 3D rowwise transpose-rhs (atomic), and 3D rowwise transpose-rhs (reduction). These kernels already have AMD-specific autotune configs on main.
  • Use e4m3_dtype from config instead of hardcoded torch.float8_e4m3fn since MI300 uses float8_e4m3fnuz.
  • MXFP8 tests remain skipped on ROCm since MXFP8 format is not yet supported.

test_fp8_grouped_mm.py:

  • Fix module-level gate so the file loads on FP8-capable ROCm hardware. The main test (test_fp8_rowwise_scaled_grouped_mm) already has proper per-test MI300/MI350 gating and ROCm-specific tolerances.
  • Enable test_K_or_N_dim_not_multiple_of_16 on ROCm since it validates dimension assertions and uses Float8TrainingOpConfig which already resolves to the correct platform FP8 dtype.

Fix module-level capability gates in test_kernels.py and
test_fp8_grouped_mm.py that used raw get_device_capability() >= (9, 0),
which incorrectly passes on MI250X (gfx90a reports 9.0 but lacks FP8).
Replace with is_sm_at_least_90() || is_MI300() || is_MI350().

test_kernels.py:
- Enable 5 FP8 kernel tests on MI300/MI350: jagged rowwise scales,
  jagged rowwise scales via transpose, jagged colwise scales,
  3D rowwise transpose-rhs (atomic), and 3D rowwise transpose-rhs
  (reduction). These kernels already have AMD-specific autotune configs
  on main.
- Use e4m3_dtype from config instead of hardcoded torch.float8_e4m3fn
  (MI300 uses float8_e4m3fnuz).
- MXFP8 tests remain skipped on ROCm (MXFP8 format not yet supported).

test_fp8_grouped_mm.py:
- Fix module-level gate so the file loads on FP8-capable ROCm hardware.
  The main test (test_fp8_rowwise_scaled_grouped_mm) already has proper
  per-test MI300/MI350 gating and ROCm-specific tolerances.
- Enable test_K_or_N_dim_not_multiple_of_16 on ROCm (validates dimension
  assertions, uses Float8TrainingOpConfig which already resolves to the
  correct platform FP8 dtype).
@pytorch-bot

pytorch-bot Bot commented Mar 4, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/3994

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 0195356 with merge base f04500f (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 4, 2026
@danielvegamyhre

Copy link
Copy Markdown
Contributor

Ruff/lint is failing, please fix

test_fp8_grouped_mm.py:
- Merge duplicate `from torchao.utils import` statements (I001)
- Remove unused `skip_if_rocm` import (F401)

test_kernels.py:
- Sort imports alphabetically so torchao.float8 precedes
  torchao.prototype (I001)
@brucechanglongxu

Copy link
Copy Markdown
Contributor Author

Ruff/lint is failing, please fix

Linter fixed!

…ernels.py

Apply `ruff format` to wrap long pytest.skip() calls and multi-condition
if-statements that exceed the line length limit.
@brucechanglongxu

Copy link
Copy Markdown
Contributor Author

@danielvegamyhre This PR is approved and all CI checks are passing. Could you merge when you get a chance? Thanks!

@danielvegamyhre danielvegamyhre merged commit d864500 into pytorch:main Mar 10, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. topic: rocm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants