Using mode="reduce-overhead" with unpadded variable sequence lengths
Every new token length triggers a fresh CUDA graph pool capture until GPU VRAM hits OOM.
Operator task guide
torch.compile stacks three layers: Dynamo (Python graph capture), Inductor (graph lowering and CUDA graph wrapping), and Triton (GPU kernel compilation). Pinpoint which layer failed by testing backend="eager" first, then TORCH_LOGS="recompiles,graph_breaks" or TORCH_COMPILE_DEBUG=1.
Triton CUDA errors such as invalid argument, misaligned address, or out of resources usually reflect dynamic tensor shapes exceeding shared memory, non-contiguous tensor strides, or CUDA stream-capture restrictions when mode="reduce-overhead" enables CUDAGraphTrees.
Reviewed . Reference guidance is not a diagnosis of your workload.
Reproduce the failure with backend="eager" (tests Dynamo alone) vs mode="default" without CUDA graphs (disables reduce-overhead CUDAGraphTrees) so you know which compiler stage broke.
TORCH_LOGS="+dynamo,recompiles,graph_breaks" python3 train.py
# Or capture full Inductor/Triton artifacts for a minimal reproducer:
TORCH_COMPILE_DEBUG=1 python3 repro.pymode="reduce-overhead" wraps compiled regions in CUDA graphs, which forbid CPU-GPU syncs (.item(), .cpu()) and allocate persistent memory pools per distinct input shape.
# Test disabling cudagraphs inside Inductor to isolate graph capture OOM/errors
TORCHINDUCTOR_CUDAGRAPHS=0 python3 train.pyIf a Triton kernel throws CUDA invalid argument or illegal instruction, run with CUDA_LAUNCH_BLOCKING=1 and verify tensor .is_contiguous() and GPU compute capability alignment.
CUDA_LAUNCH_BLOCKING=1 python3 repro.py
compute-sanitizer --tool memcheck python3 repro.pyVariable sequence lengths without dynamic=True or padding cause repeated Inductor compilations that spike host RAM and stall distributed ranks past NCCL watchdog timeouts.
# Pad/bucket variable sequence lengths or test dynamic=True on stable shapes| Signal | What it means | Next action |
|---|---|---|
| Passes with backend="eager", fails with default Inductor | Bug in Inductor lowering or generated Triton kernel. | Capture TORCH_COMPILE_DEBUG=1 output and test TORCHINDUCTOR_CUDAGRAPHS=0. |
| Fails with mode="reduce-overhead" OOM or stream-capture error | CUDAGraphTrees retained too many shape pools or hit a forbidden CPU sync. | Pad sequence shapes to fixed buckets or switch to mode="default". |
| Triton Error: CUDA invalid argument or misaligned address | Kernel grid exceeded limits or received non-contiguous/zero-size tensor. | Check tensor shapes/contiguity and inspect generated Triton code with TORCH_COMPILE_DEBUG=1. |
| Distributed job hits NCCL timeout on step 1 or shape change | One rank spent minutes recompiling Inductor kernels while peers timed out. | Pre-warm cache, pad shapes uniformly, and share Inductor cache or adjust init timeout. |
Every new token length triggers a fresh CUDA graph pool capture until GPU VRAM hits OOM.
Asynchronous kernel errors surface lines later at unrelated PyTorch ops.
Large compile worker pools inside containers can trigger cgroup OOMKill during cold start.
Inspect grid, stride, and shared-memory limits in Triton.
Isolate Dynamo, Inductor, and Triton compiler crashes.
Catch illegal accesses inside custom or compiled CUDA kernels.
Handle CUDA graph memory pressure in serving.
reduce-overhead enables CUDA graphs, which allocate persistent private memory pools for each captured input shape. Variable sequence lengths or batch sizes multiply these pools until VRAM is exhausted.
Common causes are empty tensors, non-contiguous strides, launch grid/block dimensions exceeding CUDA hardware limits, or exceeding per-block shared memory.
Pass options={"triton.cudagraphs": False} to torch.compile or set mode="default" instead of "reduce-overhead".
If one rank triggers an unexpected Dynamo recompile while peer ranks do not, that rank blocks in Python/C++ compilation long enough for other ranks to hit the NCCL watchdog timeout.
Get the likely cause, supporting evidence, and next safe steps with the same cloud reasoning used by paid plans. A crash the engine recognizes is answered in seconds, then checked by an independent AI review that updates this page when it finishes. A crash it does not recognize waits for the AI's own answer, which can take a few minutes. No account, card, or installation. Logs are masked at Denpex API ingress and are not saved to account history.
Before uploading, review cloud data handling and local options.
Upload your log file. Large files are processed in your browser. Only selected evidence is submitted when you run diagnosis.
No credit card. No automatic subscription. See whether Denpex helps with an incident you already understand.
Up to 50 diagnoses a day for 30 days. Verify your work email to activate an eligible company evaluation, then replay a resolved incident and compare the evidence and next steps with your team's confirmed cause.
Use the three free diagnoses to review your error and relevant evidence. Keep reference guidance separate from the cause and recovery status of your own workload.
Diagnose your incident