pytorch - 💡(How to fix) Fix `test/inductor/test_fp8.py` hangs flakily on sm89 [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
pytorch/pytorch#177651Fetched 2026-04-08 00:52:47
View on GitHub
Comments
0
Participants
1
Timeline
117
Reactions
0
Author
Participants
Assignees
Timeline (top)
mentioned ×50subscribed ×50labeled ×10referenced ×3

Code Example

test_rowwise_scaling_acceptable_input_dims_M_1024_K_1024_N_16_persistent_matmul_False_cuda
test_rowwise_scaling_acceptable_input_dims_M_257_K_1024_N_16_persistent_matmul_False_cuda
test_rowwise_scaling_shape_1024,1024,512_has_bias_False_use_fast_accum_False_persistent_matmul_False_cuda

---

Collecting environment information...                                                                                                  
PyTorch version: 2.11.0a0+a6c236b                                                                                                      
Is debug build: False                                                                                                                  
CUDA used to build PyTorch: 13.2                                                                                                       
ROCM used to build PyTorch: N/A                                                                                                        
                                                                                                                                       
OS: Ubuntu 24.04.4 LTS (x86_64)                                                                                                        
GCC version: (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0                                                                                   
Clang version: Could not collect                                                                                                       
CMake version: version 3.31.6                                                                                                          
Libc version: glibc-2.39                                                                                                               
                                                                                                                                       
Python version: 3.12.3 (main, Mar  3 2026, 12:15:18) [GCC 13.3.0] (64-bit runtime)                                                     
Python platform: Linux-5.15.0-72-generic-x86_64-with-glibc2.39                                                                         
Is CUDA available: True                                                                                                                
CUDA runtime version: 13.2.51                                                                                                          
CUDA_MODULE_LOADING set to: LAZY                                                                                                       
GPU models and configuration: GPU 0: NVIDIA RTX 6000 Ada Generation                                                                    
Nvidia driver version: 570.195.03                                                                                                      
cuDNN version: Probably one of the following:                                                                                          
/usr/lib/x86_64-linux-gnu/libcudnn.so.9.20.0                                                                                           
/usr/lib/x86_64-linux-gnu/libcudnn_adv.so.9.20.0                                                                                       
/usr/lib/x86_64-linux-gnu/libcudnn_cnn.so.9.20.0                                                                                       
/usr/lib/x86_64-linux-gnu/libcudnn_engines_precompiled.so.9.20.0                                                                       
/usr/lib/x86_64-linux-gnu/libcudnn_engines_runtime_compiled.so.9.20.0                                                                  
/usr/lib/x86_64-linux-gnu/libcudnn_graph.so.9.20.0                                                                                     
/usr/lib/x86_64-linux-gnu/libcudnn_heuristic.so.9.20.0                                                                                 
/usr/lib/x86_64-linux-gnu/libcudnn_ops.so.9.20.0                                                                                       
Is XPU available: False                                                                                                                
HIP runtime version: N/A                                                                                                               
MIOpen runtime version: N/A                                                                                                            
Is XNNPACK available: True                                                                                                             
Caching allocator config: N/A                                                                                                          
                                                                                                                                       
CPU:
Architecture:                    x86_64                                                                              14:35:00 [36/1927]
CPU op-mode(s):                  32-bit, 64-bit                                                                                        
Address sizes:                   43 bits physical, 48 bits virtual                                                                     
Byte Order:                      Little Endian                                                                                         
CPU(s):                          16                                                                                                    
On-line CPU(s) list:             0-15                                                                                                  
Vendor ID:                       AuthenticAMD                                                                                          
BIOS Vendor ID:                  Advanced Micro Devices, Inc.                                                                          
Model name:                      AMD Ryzen 7 3700X 8-Core Processor                                                                    
BIOS Model name:                 AMD Ryzen 7 3700X 8-Core Processor              Unknown CPU @ 3.6GHz                                  
BIOS CPU family:                 107                                                                                                   
CPU family:                      23                                                                                                    
Model:                           113                                                                                                   
Thread(s) per core:              2                                                                                                     
Core(s) per socket:              8                                                                                                     
Socket(s):                       1                                                                                                     
Stepping:                        0                                                                                                     
Frequency boost:                 enabled                                                                                               
CPU(s) scaling MHz:              104%                                                                                                  
CPU max MHz:                     3600.0000                                                                                             
CPU min MHz:                     2200.0000                                                                                             
BogoMIPS:                        7200.59                                                                                               
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht s
yscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq moni
tor ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misa
lignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd
 mba ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cq
m_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd arat npt lbrv svm_lock nrip_save tsc_scale vmcb
_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip rdpid overflow_recov succor smca sm
e sev sev_es                                                                                                                           
Virtualization:                  AMD-V                                                                                                 
L1d cache:                       256 KiB (8 instances)                                                                                 
L1i cache:                       256 KiB (8 instances)                                                                                 
L2 cache:                        4 MiB (8 instances)                                                                                   
L3 cache:                        32 MiB (2 instances)                                                                                  
NUMA node(s):                    1
NUMA node0 CPU(s):               0-15
Vulnerability Itlb multihit:     Not affected
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Mmio stale data:   Not affected
Vulnerability Retbleed:          Vulnerable
Vulnerability Spec store bypass: Vulnerable
Vulnerability Spectre v1:        Vulnerable: __user pointer sanitization and usercopy barriers only; no swapgs barriers
Vulnerability Spectre v2:        Vulnerable, IBPB: disabled, STIBP: disabled, PBRSB-eIBRS: Not affected
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected

Versions of relevant libraries:
[pip3] intel-openmp==2021.4.0
[pip3] mkl==2021.1.1
[pip3] mkl-devel==2021.1.1
[pip3] mkl-include==2021.1.1
[pip3] mypy_extensions==1.1.0
[pip3] numpy==2.1.0
[pip3] nvidia-cuda-runtime-cu13==0.0.0a0
[pip3] nvidia-cudnn-frontend==1.19.1
[pip3] nvtx==0.2.14
[pip3] onnx==1.18.0
[pip3] onnx-ir==0.2.0
[pip3] onnxscript==0.6.2
[pip3] optree==0.19.0
[pip3] tbb==2021.13.1
[pip3] torch==2.11.0a0+a6c236b
[pip3] torch_tensorrt==2.11.0a0
[pip3] torchao==0.17.0+gitd9881220
[pip3] torchdata==0.11.0
[pip3] torchtitan==0.2.1+git71517cf6
[pip3] torchvision==0.25.0a0+b7d91027.nvinternal.main.46031417
[pip3] triton==3.6.0+git5d72932fc5.nv26.3
[pip3] triton_kernels==1.0.0+git5d72932fc5.nv26.3
[conda] Could not collect
RAW_BUFFERClick to expand / collapse

🐛 Describe the bug

The test suite test/inductor/test_fp8.py is hanging flakily on sm89 (L40, RTX 6000 Ada). The hanging test is not always the same, but is always a rowwise scaling test with large K:

test_rowwise_scaling_acceptable_input_dims_M_1024_K_1024_N_16_persistent_matmul_False_cuda
test_rowwise_scaling_acceptable_input_dims_M_257_K_1024_N_16_persistent_matmul_False_cuda
test_rowwise_scaling_shape_1024,1024,512_has_bias_False_use_fast_accum_False_persistent_matmul_False_cuda

I was able to bisect this to #166056, which changes the test initialization from instantiate_parametrized_tests to instantiate_device_type_tests. This causes tests to be instantiated using the CudaNonDefaultStream class, leading to a potential race condition between the test stream and the default stream; running the tests with CUDA_LAUNCH_BLOCKING=1 causes them to always pass.

Versions

Collecting environment information...                                                                                                  
PyTorch version: 2.11.0a0+a6c236b                                                                                                      
Is debug build: False                                                                                                                  
CUDA used to build PyTorch: 13.2                                                                                                       
ROCM used to build PyTorch: N/A                                                                                                        
                                                                                                                                       
OS: Ubuntu 24.04.4 LTS (x86_64)                                                                                                        
GCC version: (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0                                                                                   
Clang version: Could not collect                                                                                                       
CMake version: version 3.31.6                                                                                                          
Libc version: glibc-2.39                                                                                                               
                                                                                                                                       
Python version: 3.12.3 (main, Mar  3 2026, 12:15:18) [GCC 13.3.0] (64-bit runtime)                                                     
Python platform: Linux-5.15.0-72-generic-x86_64-with-glibc2.39                                                                         
Is CUDA available: True                                                                                                                
CUDA runtime version: 13.2.51                                                                                                          
CUDA_MODULE_LOADING set to: LAZY                                                                                                       
GPU models and configuration: GPU 0: NVIDIA RTX 6000 Ada Generation                                                                    
Nvidia driver version: 570.195.03                                                                                                      
cuDNN version: Probably one of the following:                                                                                          
/usr/lib/x86_64-linux-gnu/libcudnn.so.9.20.0                                                                                           
/usr/lib/x86_64-linux-gnu/libcudnn_adv.so.9.20.0                                                                                       
/usr/lib/x86_64-linux-gnu/libcudnn_cnn.so.9.20.0                                                                                       
/usr/lib/x86_64-linux-gnu/libcudnn_engines_precompiled.so.9.20.0                                                                       
/usr/lib/x86_64-linux-gnu/libcudnn_engines_runtime_compiled.so.9.20.0                                                                  
/usr/lib/x86_64-linux-gnu/libcudnn_graph.so.9.20.0                                                                                     
/usr/lib/x86_64-linux-gnu/libcudnn_heuristic.so.9.20.0                                                                                 
/usr/lib/x86_64-linux-gnu/libcudnn_ops.so.9.20.0                                                                                       
Is XPU available: False                                                                                                                
HIP runtime version: N/A                                                                                                               
MIOpen runtime version: N/A                                                                                                            
Is XNNPACK available: True                                                                                                             
Caching allocator config: N/A                                                                                                          
                                                                                                                                       
CPU:
Architecture:                    x86_64                                                                              14:35:00 [36/1927]
CPU op-mode(s):                  32-bit, 64-bit                                                                                        
Address sizes:                   43 bits physical, 48 bits virtual                                                                     
Byte Order:                      Little Endian                                                                                         
CPU(s):                          16                                                                                                    
On-line CPU(s) list:             0-15                                                                                                  
Vendor ID:                       AuthenticAMD                                                                                          
BIOS Vendor ID:                  Advanced Micro Devices, Inc.                                                                          
Model name:                      AMD Ryzen 7 3700X 8-Core Processor                                                                    
BIOS Model name:                 AMD Ryzen 7 3700X 8-Core Processor              Unknown CPU @ 3.6GHz                                  
BIOS CPU family:                 107                                                                                                   
CPU family:                      23                                                                                                    
Model:                           113                                                                                                   
Thread(s) per core:              2                                                                                                     
Core(s) per socket:              8                                                                                                     
Socket(s):                       1                                                                                                     
Stepping:                        0                                                                                                     
Frequency boost:                 enabled                                                                                               
CPU(s) scaling MHz:              104%                                                                                                  
CPU max MHz:                     3600.0000                                                                                             
CPU min MHz:                     2200.0000                                                                                             
BogoMIPS:                        7200.59                                                                                               
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht s
yscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq moni
tor ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misa
lignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd
 mba ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cq
m_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd arat npt lbrv svm_lock nrip_save tsc_scale vmcb
_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip rdpid overflow_recov succor smca sm
e sev sev_es                                                                                                                           
Virtualization:                  AMD-V                                                                                                 
L1d cache:                       256 KiB (8 instances)                                                                                 
L1i cache:                       256 KiB (8 instances)                                                                                 
L2 cache:                        4 MiB (8 instances)                                                                                   
L3 cache:                        32 MiB (2 instances)                                                                                  
NUMA node(s):                    1
NUMA node0 CPU(s):               0-15
Vulnerability Itlb multihit:     Not affected
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Mmio stale data:   Not affected
Vulnerability Retbleed:          Vulnerable
Vulnerability Spec store bypass: Vulnerable
Vulnerability Spectre v1:        Vulnerable: __user pointer sanitization and usercopy barriers only; no swapgs barriers
Vulnerability Spectre v2:        Vulnerable, IBPB: disabled, STIBP: disabled, PBRSB-eIBRS: Not affected
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected

Versions of relevant libraries:
[pip3] intel-openmp==2021.4.0
[pip3] mkl==2021.1.1
[pip3] mkl-devel==2021.1.1
[pip3] mkl-include==2021.1.1
[pip3] mypy_extensions==1.1.0
[pip3] numpy==2.1.0
[pip3] nvidia-cuda-runtime-cu13==0.0.0a0
[pip3] nvidia-cudnn-frontend==1.19.1
[pip3] nvtx==0.2.14
[pip3] onnx==1.18.0
[pip3] onnx-ir==0.2.0
[pip3] onnxscript==0.6.2
[pip3] optree==0.19.0
[pip3] tbb==2021.13.1
[pip3] torch==2.11.0a0+a6c236b
[pip3] torch_tensorrt==2.11.0a0
[pip3] torchao==0.17.0+gitd9881220
[pip3] torchdata==0.11.0
[pip3] torchtitan==0.2.1+git71517cf6
[pip3] torchvision==0.25.0a0+b7d91027.nvinternal.main.46031417
[pip3] triton==3.6.0+git5d72932fc5.nv26.3
[pip3] triton_kernels==1.0.0+git5d72932fc5.nv26.3
[conda] Could not collect

cc @ptrblck @msaroufim @eqy @jerryzh168 @tinglvv @nWEIdia @mruberry @chauhang @penguinwu @voznesenskym @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @aakhundov @coconutruben @jataylo

extent analysis

Fix Plan

To address the issue of flaky hanging tests in test_fp8.py on sm89 (L40, RTX 6000 Ada), we need to resolve the potential race condition between the test stream and the default stream.

  1. Set CUDA_LAUNCH_BLOCKING: Run the tests with CUDA_LAUNCH_BLOCKING=1 to ensure that CUDA operations are synchronous, which can help avoid the race condition.
  2. Modify Test Initialization: Revert the change in #166056 to use instantiate_parametrized_tests instead of instantiate_device_type_tests to avoid instantiating tests with CudaNonDefaultStream class.
  3. Synchronize Streams: Ensure that the test stream and the default stream are properly synchronized. This can be achieved by adding torch.cuda.synchronize() after CUDA operations.

Example code snippet:

import torch

# ... (rest of the test code)

# Add synchronization after CUDA operations
torch.cuda.synchronize()

# ... (rest of the test code)

Verification

To verify that the fix worked, run the test suite test/inductor/test_fp8.py multiple times to ensure that the hanging tests are resolved.

Extra Tips

  • Always ensure proper synchronization between CUDA streams to avoid potential race conditions.
  • Use CUDA_LAUNCH_BLOCKING=1 when running tests to ensure synchronous CUDA operations.
  • Regularly review and update CUDA versions and drivers to ensure compatibility and resolve potential issues.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING