Skip to content

[CI] Disable TF32 for the L0 PyTorch numerics tests - #3797

Open
bvolpato wants to merge 1 commit into
NVIDIA:mainfrom
bvolpato:bvolpato/disable-tf32-in-l0-numerics
Open

bvolpato wants to merge 1 commit into
NVIDIA:mainfrom
bvolpato:bvolpato/disable-tf32-in-l0-numerics

Conversation

@bvolpato

@bvolpato bvolpato commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Description

Make the L0 PyTorch numerics tests give the same result outside the CI image.

Transformer Engine selects TF32 for pure FP32 GEMM, and the PyTorch references in these tests do not use it. Where cuBLAS takes the TF32 path, FP32 cases in test_numerics.py and tests/pytorch/debug/test_numerics.py fail on correct code, because the differences exceed the FP32 tolerances. The launchers already set NVIDIA_TF32_OVERRIDE=0 for test_mhc.py for the same reason.

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refactoring

Changes

  • Set NVIDIA_TF32_OVERRIDE=0 for the numerics tests in qa/L0_pytorch_unittest/test.sh and qa/L0_pytorch_debug_unittest/test.sh.

Validation

Both launcher versions ran on NVIDIA B200 with CUDA 13.2, PyTorch 2.15.0+cu132, and no override in the environment. Without this change, FP32 cases fail in the test_numerics.py command, and the debug launcher exits with an error. With this change, the test_numerics.py command finds no failures, and the debug launcher exits successfully. test_numerics.py shows the same failures on the same cases with PyTorch 2.11 and 2.13, and the override removes them.

NGC PyTorch images set TORCH_ALLOW_TF32_CUBLAS_OVERRIDE=1, so the PyTorch FP32 reference also uses TF32 there and matches Transformer Engine's default TF32 compute mode. Standard PyTorch installs default allow_tf32=False and compare Transformer Engine TF32 against PyTorch FP32. Setting NVIDIA_TF32_OVERRIDE=0 disables TF32 in cuBLAS for both Transformer Engine and PyTorch. A100 and H100 were not tested.

Checklist:

  • I have read and followed the contributing guidelines
  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Transformer Engine selects TF32 for pure FP32 GEMM, and the PyTorch
references in the numerics tests do not. Where cuBLAS uses TF32, the FP32
cases fail on correct code. These launchers already set
NVIDIA_TF32_OVERRIDE=0 for test_mhc.py for the same reason.

Set it for the numerics tests too, so that the L0 launchers give the same
result outside the CI image.

Signed-off-by: Bruno Volpato <brunocvcunha@gmail.com>
@github-actions github-actions Bot added the community-contribution PRs from external contributor outside the core maintainers, representing community-driven work. label Nov 3, 2026
@bvolpato
bvolpato marked this pull request as ready for review November 3, 2026 02:53
@greptile-apps

greptile-apps Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Summary

Disables TF32 for three numerics test commands across the two L0 PyTorch launchers.

  • L0 numerics tests now run with TF32 disabled.

Reviews (1) · Last reviewed commit: "[CI] Disable TF32 for the L0 PyTorch num..." · Reviewed by Greptile

@bvolpato

bvolpato commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

@timmoon10, would you mind taking a look at this? It sets NVIDIA_TF32_OVERRIDE=0 for the L0 numerics commands, including the debug launcher. The description includes B200 before/after results. Would that reproduction address your concerns in #3014 about the FP32 reference comparison?

@bvolpato

Copy link
Copy Markdown
Contributor Author

quick follow-up with some extra context from #3014 on why NGC CI passes without this override: NGC PyTorch images set TORCH_ALLOW_TF32_CUBLAS_OVERRIDE=1, so PyTorch's torch.nn FP32 reference also runs in TF32 and matches TE's default TF32 GEMM mode. outside NGC, PyTorch defaults allow_tf32=False and compares TE TF32 against PyTorch FP32 (updated the PR description to reflect that).

IIUC NVIDIA_TF32_OVERRIDE=0 disables TF32 at the cuBLAS level for both TE and PyTorch, which is why the B200 runs pass with it. @timmoon10 if you prefer keeping TF32 enabled in TE and adjusting the reference side in test_numerics.py instead, happy to switch to that.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution PRs from external contributor outside the core maintainers, representing community-driven work.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant