Skip to content

adding NVIDIA_TF32_OVERRIDE=0 to test_numerics.py - #3014

Open
francesco-bertolotti wants to merge 1 commit into
NVIDIA:mainfrom
francesco-bertolotti:f14-tf32override
Open

francesco-bertolotti wants to merge 1 commit into
NVIDIA:mainfrom
francesco-bertolotti:f14-tf32override

Conversation

@francesco-bertolotti

Copy link
Copy Markdown
Contributor

PR splitted from #3013

I have added NVIDIA_TF32_OVERRIDE=0 to test_numerics.py otherwise I would get test failing for small numerical mismatch with layer norms. This has also been done for test_mhc.py.

@greptile-apps

greptile-apps Bot commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds NVIDIA_TF32_OVERRIDE=0 to the test_numerics.py invocation in the PyTorch unit-test script to prevent spurious failures caused by TF32 reduced precision in layer norm comparisons. The fix mirrors the same flag already applied to test_mhc.py on line 63.

  • Single-line env-var addition to qa/L0_pytorch_unittest/test.sh: NVIDIA_TF32_OVERRIDE=0 is prepended to the existing test_numerics.py test command, aligning its precision control with test_mhc.py.
  • No logic changes: no tests are added, removed, or reordered; the flag only disables TF32 approximation for this specific test invocation.

Confidence Score: 5/5

Safe to merge — single targeted env-var addition with no logic changes.

The change is a one-line addition of a well-understood NVIDIA environment variable (NVIDIA_TF32_OVERRIDE=0) that disables TF32 for a specific test invocation. This pattern is already used identically for test_mhc.py in the same file. No test ordering, test selection, or control flow is affected.

No files require special attention.

Important Files Changed

Filename Overview
qa/L0_pytorch_unittest/test.sh Adds NVIDIA_TF32_OVERRIDE=0 to the test_numerics.py invocation to prevent small numerical mismatches from TF32 precision reduction, consistent with the existing pattern for test_mhc.py.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[test.sh] --> B[test_sanity.py]
    B --> C[test_recipe.py / test_custom_recipe.py / test_deferred_init.py]
    C --> D["test_numerics.py\nNVIDIA_TF32_OVERRIDE=0 added"]
    D --> E[test_cuda_graphs.py]
    E --> F[Other tests ...]
    F --> G["test_mhc.py\nNVIDIA_TF32_OVERRIDE=0 pre-existing"]
    G --> H{All passed?}
    H -- yes --> I[exit 0]
    H -- no --> J[exit 1]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[test.sh] --> B[test_sanity.py]
    B --> C[test_recipe.py / test_custom_recipe.py / test_deferred_init.py]
    C --> D["test_numerics.py\nNVIDIA_TF32_OVERRIDE=0 added"]
    D --> E[test_cuda_graphs.py]
    E --> F[Other tests ...]
    F --> G["test_mhc.py\nNVIDIA_TF32_OVERRIDE=0 pre-existing"]
    G --> H{All passed?}
    H -- yes --> I[exit 0]
    H -- no --> J[exit 1]
Loading

Reviews (2): Last reviewed commit: "adding NVIDIA_TF32_OVERRIDE=0 to test_nu..." | Re-trigger Greptile

Comment thread qa/L0_pytorch_unittest/test.sh Resolved
@francesco-bertolotti

Copy link
Copy Markdown
Contributor Author

I do not know if it helps, these are the tests failing without the tf32 env flag:

FAILED tests/pytorch/test_numerics.py::test_linear_accuracy[True-True-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=0. Maximum difference at location [50] with -3.5490684509277344 vs -3.555588245391...
FAILED tests/pytorch/test_numerics.py::test_linear_accuracy[True-True-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=0. Maximum difference at location [61] with 2.6603221893310547 vs 2.65149784088134...
FAILED tests/pytorch/test_numerics.py::test_linear_accuracy[True-False-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=0. Maximum difference at location [50] with -3.5490684509277344 vs -3.555588245391...
FAILED tests/pytorch/test_numerics.py::test_linear_accuracy[True-False-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=0. Maximum difference at location [61] with 2.6603221893310547 vs 2.65149784088134...
FAILED tests/pytorch/test_numerics.py::test_linear_accuracy[False-True-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=0. Maximum difference at location [50] with -3.5490684509277344 vs -3.555588245391...
FAILED tests/pytorch/test_numerics.py::test_linear_accuracy[False-True-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=0. Maximum difference at location [61] with 2.6603221893310547 vs 2.65149784088134...
FAILED tests/pytorch/test_numerics.py::test_linear_accuracy[False-False-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=0. Maximum difference at location [50] with -3.5490684509277344 vs -3.555588245391...
FAILED tests/pytorch/test_numerics.py::test_linear_accuracy[False-False-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=0. Maximum difference at location [61] with 2.6603221893310547 vs 2.65149784088134...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[True-True-True-LayerNorm-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=113. Maximum difference at location [0, 165] with 0.04553138092160225 vs 0.0458293...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[True-True-True-LayerNorm-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=11. Maximum difference at location [0, 21] with 0.029382700100541115 vs 0.02909549...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[True-True-True-RMSNorm-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=56. Maximum difference at location [0, 209] with 0.0030347853899002075 vs 0.003319...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[True-True-True-RMSNorm-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=28. Maximum difference at location [1, 421] with -0.017969021573662758 vs -0.01827...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[True-True-False-LayerNorm-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=22. Maximum difference at location [0, 21] with 0.029382700100541115 vs 0.02909549...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[True-True-False-LayerNorm-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=11. Maximum difference at location [0, 21] with 0.029382700100541115 vs 0.02909549...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[True-True-False-RMSNorm-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=56. Maximum difference at location [0, 209] with 0.0030347853899002075 vs 0.003319...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[True-True-False-RMSNorm-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=28. Maximum difference at location [1, 421] with -0.017969021573662758 vs -0.01827...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[True-False-True-LayerNorm-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=22. Maximum difference at location [0, 21] with 0.029382700100541115 vs 0.02909549...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[True-False-True-LayerNorm-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=11. Maximum difference at location [0, 21] with 0.029382700100541115 vs 0.02909549...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[True-False-True-RMSNorm-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=56. Maximum difference at location [0, 209] with 0.0030347853899002075 vs 0.003319...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[True-False-True-RMSNorm-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=28. Maximum difference at location [1, 421] with -0.017969021573662758 vs -0.01827...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[True-False-False-LayerNorm-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=22. Maximum difference at location [0, 21] with 0.029382700100541115 vs 0.02909549...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[True-False-False-LayerNorm-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=11. Maximum difference at location [0, 21] with 0.029382700100541115 vs 0.02909549...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[True-False-False-RMSNorm-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=56. Maximum difference at location [0, 209] with 0.0030347853899002075 vs 0.003319...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[True-False-False-RMSNorm-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=28. Maximum difference at location [1, 421] with -0.017969021573662758 vs -0.01827...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[False-True-True-LayerNorm-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=22. Maximum difference at location [0, 21] with 0.029382700100541115 vs 0.02909549...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[False-True-True-LayerNorm-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=11. Maximum difference at location [0, 21] with 0.029382700100541115 vs 0.02909549...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[False-True-True-RMSNorm-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=56. Maximum difference at location [0, 209] with 0.0030347853899002075 vs 0.003319...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[False-True-True-RMSNorm-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=28. Maximum difference at location [1, 421] with -0.017969021573662758 vs -0.01827...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[False-True-False-LayerNorm-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=22. Maximum difference at location [0, 21] with 0.029382700100541115 vs 0.02909549...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[False-True-False-LayerNorm-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=11. Maximum difference at location [0, 21] with 0.029382700100541115 vs 0.02909549...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[False-True-False-RMSNorm-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=56. Maximum difference at location [0, 209] with 0.0030347853899002075 vs 0.003319...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[False-True-False-RMSNorm-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=28. Maximum difference at location [1, 421] with -0.017969021573662758 vs -0.01827...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[False-False-True-LayerNorm-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=22. Maximum difference at location [0, 21] with 0.029382700100541115 vs 0.02909549...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[False-False-True-LayerNorm-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=11. Maximum difference at location [0, 21] with 0.029382700100541115 vs 0.02909549...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[False-False-True-RMSNorm-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=56. Maximum difference at location [0, 209] with 0.0030347853899002075 vs 0.003319...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[False-False-True-RMSNorm-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=28. Maximum difference at location [1, 421] with -0.017969021573662758 vs -0.01827...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[False-False-False-LayerNorm-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=22. Maximum difference at location [0, 21] with 0.029382700100541115 vs 0.02909549...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[False-False-False-LayerNorm-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=11. Maximum difference at location [0, 21] with 0.029382700100541115 vs 0.02909549...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[False-False-False-RMSNorm-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=56. Maximum difference at location [0, 209] with 0.0030347853899002075 vs 0.003319...
FAILED tests/pytorch/test_numerics.py::test_layernorm_linear_accuracy[False-False-False-RMSNorm-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=28. Maximum difference at location [1, 421] with -0.017969021573662758 vs -0.01827...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[True-True-LayerNorm-relu-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=14. Maximum difference at location [0, 99] with -0.07819076627492905 vs -0.1000889...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[True-True-LayerNorm-relu-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=7. Maximum difference at location [0, 99] with -0.07819075882434845 vs -0.10008895...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[True-True-LayerNorm-reglu-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=105. Maximum difference at location [75] with -0.04723335802555084 vs -0.014243453...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[True-True-LayerNorm-reglu-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=22. Maximum difference at location [0] with -1.3210333585739136 vs -1.299375057220...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[True-True-RMSNorm-relu-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=50. Maximum difference at location [100] with 0.18327626585960388 vs 0.38112670183...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[True-True-RMSNorm-relu-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=121. Maximum difference at location [1, 15] with -0.0071725500747561455 vs 0.01547...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[True-True-RMSNorm-reglu-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=351. Maximum difference at location [77] with -0.04859239235520363 vs -0.076162673...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[True-True-RMSNorm-reglu-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=263. Maximum difference at location [56] with 0.03622261434793472 vs 0.12370993196...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[True-False-LayerNorm-relu-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=14. Maximum difference at location [0, 99] with -0.07819076627492905 vs -0.1000889...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[True-False-LayerNorm-relu-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=7. Maximum difference at location [0, 99] with -0.07819075882434845 vs -0.10008895...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[True-False-LayerNorm-reglu-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=105. Maximum difference at location [75] with -0.04723335802555084 vs -0.014243453...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[True-False-LayerNorm-reglu-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=22. Maximum difference at location [0] with -1.3210333585739136 vs -1.299375057220...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[True-False-RMSNorm-relu-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=50. Maximum difference at location [100] with 0.18327626585960388 vs 0.38112670183...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[True-False-RMSNorm-relu-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=121. Maximum difference at location [1, 15] with -0.0071725500747561455 vs 0.01547...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[True-False-RMSNorm-reglu-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=351. Maximum difference at location [77] with -0.04859239235520363 vs -0.076162673...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[True-False-RMSNorm-reglu-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=263. Maximum difference at location [56] with 0.03622261434793472 vs 0.12370993196...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[False-True-LayerNorm-relu-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=14. Maximum difference at location [0, 99] with -0.07819076627492905 vs -0.1000889...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[False-True-LayerNorm-relu-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=7. Maximum difference at location [0, 99] with -0.07819075882434845 vs -0.10008895...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[False-True-LayerNorm-reglu-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=105. Maximum difference at location [75] with -0.04723335802555084 vs -0.014243453...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[False-True-LayerNorm-reglu-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=22. Maximum difference at location [0] with -1.3210333585739136 vs -1.299375057220...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[False-True-RMSNorm-relu-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=50. Maximum difference at location [100] with 0.18327626585960388 vs 0.38112670183...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[False-True-RMSNorm-relu-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=121. Maximum difference at location [1, 15] with -0.0071725500747561455 vs 0.01547...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[False-True-RMSNorm-reglu-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=351. Maximum difference at location [77] with -0.04859239235520363 vs -0.076162673...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[False-True-RMSNorm-reglu-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=263. Maximum difference at location [56] with 0.03622261434793472 vs 0.12370993196...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[False-False-LayerNorm-relu-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=14. Maximum difference at location [0, 99] with -0.07819076627492905 vs -0.1000889...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[False-False-LayerNorm-relu-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=7. Maximum difference at location [0, 99] with -0.07819075882434845 vs -0.10008895...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[False-False-LayerNorm-reglu-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=105. Maximum difference at location [75] with -0.04723335802555084 vs -0.014243453...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[False-False-LayerNorm-reglu-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=22. Maximum difference at location [0] with -1.3210333585739136 vs -1.299375057220...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[False-False-RMSNorm-relu-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=50. Maximum difference at location [100] with 0.18327626585960388 vs 0.38112670183...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[False-False-RMSNorm-relu-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=121. Maximum difference at location [1, 15] with -0.0071725500747561455 vs 0.01547...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[False-False-RMSNorm-reglu-small-1-dtype0] - AssertionError: Outputs not close enough in tensor at idx=351. Maximum difference at location [77] with -0.04859239235520363 vs -0.076162673...
FAILED tests/pytorch/test_numerics.py::test_layernorm_mlp_accuracy[False-False-RMSNorm-reglu-small-2-dtype0] - AssertionError: Outputs not close enough in tensor at idx=263. Maximum difference at location [56] with 0.03622261434793472 vs 0.12370993196...

@timmoon10 timmoon10 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm suspicious of this change:

  • Our nightly tests pass without this change.
  • PyTorch enables TF32 by default, so disabling moves us away from typical workloads.
  • This flag won't affect TE since we manually enable TF32 in our high-precision GEMMs.

I think we need to dig more into why you are seeing failures. Also, I think there are better approaches from a test design perspective. If we treat the FP32 implementation as a mathematical ground-truth, then we should consider changing to FP64 CPU compute so we get a better approximation and disentangle from GPU bugs. If we treat the FP32 implementation as an implementation ground-truth, then TF32 is loadbearing and we shouldn't disable it.

@francesco-bertolotti

Copy link
Copy Markdown
Contributor Author

No problem, I will look into it more closely. Thank you for letting me know!

​I ran into a few issues while building and running TE on our setup, so it's entirely possible I might have messed something up on my end.

@francesco-bertolotti

Copy link
Copy Markdown
Contributor Author

I had a closer look at the issue.

Our nightly tests pass without this change

I believe the tests pass in your environment because of the TORCH_ALLOW_TF32_CUBLAS_OVERRIDE=1
environment variable, which is baked into the NGC container (nvcr.io/nvidia/pytorch:26.04-py3).
With TORCH_ALLOW_TF32_CUBLAS_OVERRIDE=0 the tests fail on the same container. Something about this is mentioned here https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes/rel_22-06.html

"PyTorch enables TF32 by default"

On a fresh PyTorch installation (≥ 1.12) allow_tf32 is False for matmul. From the docs:

"This flag defaults to True in PyTorch 1.7 to PyTorch 1.11, and False in PyTorch 1.12 and later."
— https://docs.pytorch.org/docs/2.12/notes/cuda.html

The NGC container overrides this default explicitly via TORCH_ALLOW_TF32_CUBLAS_OVERRIDE=1

@vthumbe1503

Copy link
Copy Markdown
Collaborator

@francesco-bertolotti that seems concerning. So using TORCH_ALLOW_TF32_CUBLAS_OVERRIDE=1 should actually enable TF32 usage and 0 should enable fp32 usage. Hence, I would have expected tests to pass when TORCH_ALLOW_TF32_CUBLAS_OVERRIDE=0, but it seems like it is the other way around

@francesco-bertolotti

Copy link
Copy Markdown
Contributor Author

You're right. the tests pass once TF32 is disabled. I used NVIDIA_TF32_OVERRIDE=0 instead of TORCH_ALLOW_TF32_CUBLAS_OVERRIDE=0. I'm not entirely sure what the difference is between the two, but they appear to have the same effect in this case. Regardless, once full_precision is enabled, the tests pass on our nodes.

Signed-off-by: Francesco Bertolotti <francesco.bertolotti@igenius.ai>
@github-actions github-actions Bot added the community-contribution PRs from external contributor outside the core maintainers, representing community-driven work. label Jul 8, 2026

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.

3 participants