Skip to content

Gate MX/NVFP4 safetensors test configs on sm100 - #4821

Open
alanhuangyoo wants to merge 1 commit into
pytorch:mainfrom
alanhuangyoo:fix/gate-mx-nvfp4-safetensors-configs-on-sm100
Open

Gate MX/NVFP4 safetensors test configs on sm100#4821
alanhuangyoo wants to merge 1 commit into
pytorch:mainfrom
alanhuangyoo:fix/gate-mx-nvfp4-safetensors-configs-on-sm100

Conversation

@alanhuangyoo

Copy link
Copy Markdown

test/prototype/safetensors/test_safetensors_support.py builds _ALL_TEST_CONFIGS and adds the MX / NVFP4 entries based on the torch version only:

    # MX and NVFP4 configs require torch >= 2.11
    if torch_version_at_least("2.11.0.dev"):
        _ALL_TEST_CONFIGS += [
            (MXDynamicActivationMXWeightConfig(), False),
            (NVFP4DynamicActivationNVFP4WeightConfig(), False),
        ]

Both kernels need sm100+, but the class only gates on sm89:

@unittest.skipIf(
    torch.cuda.is_available() and not is_sm_at_least_89(), "Need sm89+ for CUDA"
)

So on sm89/sm90 those parametrized cases run and fail instead of being skipped:

E  AssertionError: NVFP4 DYNAMIC mode is only supported on sm100+ machines
   torchao/prototype/mx_formats/inference_workflow.py:301

E  RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling
   `cublasLtMatmulAlgoGetHeuristic(...)`
   torchao/prototype/mx_formats/mx_tensor.py:803

The Int4WeightOnlyConfig block right above already gates on is_sm_at_least_100() for the same reason, and the helper is imported in this file, so this just applies the same guard to the MX/NVFP4 block.

The CPU path is unaffected — test_safetensors and test_safetensors_sharded both start with if device == "cpu": self.skipTest("Need GPU available"), so these configs never executed on CPU.

Before, on sm90:

7 failed, 13 passed, 20 skipped

After:

4 failed, 12 passed, 16 skipped

The 3 fixed cases are the MX/NVFP4 ones. The 4 that remain are ImportError: Requires mslk >= 1.0.0 from Int4WeightOnlyConfig and are unrelated to this change (missing optional dependency in my environment).

ruff check and ruff format --check are clean on the file.

This is not covered by CI: regression_test.yml runs its CUDA job on linux.g5.12xlarge.nvidia.gpu (A10G, sm86), where the class-level is_sm_at_least_89 skip hides the whole file.

Env: torch 2.13.0+cu130, H20 (sm90), single node.

The MX and NVFP4 entries in _ALL_TEST_CONFIGS are added based on the torch
version alone, but both kernels require sm100+. On sm89/sm90 the parametrized
cases run and fail instead of being skipped.
@pytorch-bot

pytorch-bot Bot commented Aug 24, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 1 New Failure

As of commit 09d120d with merge base 88d8e73 (image):

NEW FAILURE - The following job has failed:

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 Aug 24, 2026
@andrewor14 andrewor14 added the module: not user facing Use this tag if you don't want this PR to show up in release notes label Aug 24, 2026
@alanhuangyoo

Copy link
Copy Markdown
Author

Label check ran before the module label was added, so it should go green on a re-run.

test-rocm died at setup (29s, no tests ran) and #4820 has the same failure, so it doesn't look related to this change.

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. module: not user facing Use this tag if you don't want this PR to show up in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants