pytorch - 💡(How to fix) Fix [inductor] torch.compile(dynamic=True) crashes in TorchInductor CPU codegen with AttributeError: 'StrictLessThan' object has no attribute 'diff' [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#181115Fetched 2026-04-23 07:22:32
View on GitHub
Comments
0
Participants
1
Timeline
168
Reactions
0
Participants
Timeline (top)
mentioned ×80subscribed ×80labeled ×8

Error Message

torch._inductor.exc.InductorError: AttributeError: 'StrictLessThan' object has no attribute 'diff'

Fix Action

Fix / Workaround

Traceback (most recent call last): File "/home/bugs/crash_6992079b_reporting.py", line 55, in <module> _fgrad_dynamic = torch.compile(_torch_func.grad(_fn_grad_551427), dynamic=True)(t25553925) File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/eval_frame.py", line 1038, in compile_wrapper raise e.remove_dynamo_frames() from None # see TORCHDYNAMO_VERBOSE=1 File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/eval_frame.py", line 1024, in compile_wrapper return fn(*args, **kwargs) File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 2316, in call result = self._torchdynamo_orig_backend( File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 2052, in call result = self._inner_convert( File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 729, in call result = _compile( File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 1827, in _compile guarded_code, tracer_output = compile_inner(code, one_graph, hooks) File "/home/.venv/lib/python3.10/site-packages/torch/_utils_internal.py", line 96, in wrapper_function return function(args, **kwargs) File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 1500, in compile_inner return _compile_inner(code, one_graph, hooks) File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 1534, in _compile_inner dynamo_output = compile_frame( File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 1408, in compile_frame bytecode, tracer_output = transform_code_object(code, transform) File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/bytecode_transformation.py", line 1608, in transform_code_object tracer_output = transformations(instructions, code_options) File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 1380, in transform tracer_output = trace_frame( File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 341, in _fn return fn(args, **kwargs) File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 863, in trace_frame run_tracer() File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 844, in run_tracer tracer.run() File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 1794, in run while self.step(): File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 1459, in step self.dispatch_table[inst.opcode](self, inst) File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 5570, in RETURN_VALUE self._return(inst) File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 5552, in _return all_stack_locals_metadata = self.output.compile_subgraph( File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 1889, in compile_subgraph self.compile_and_call_fx_graph(tx, pass2.graph_output_vars(), root) File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 2460, in compile_and_call_fx_graph compiled_fn = self.call_user_compiler(gm, self.example_inputs()) File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 2613, in call_user_compiler return self._call_user_compiler(gm, example_inputs) File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 2664, in call_user_compiler compiled_fn = compiler_fn(gm, example_inputs) File "/home/.venv/lib/python3.10/site-packages/torch/dynamo/repro/after_dynamo.py", line 156, in call compiled_gm = compiler_fn(gm, example_inputs) File "/home/.venv/lib/python3.10/site-packages/torch/init.py", line 2461, in call return compile_fx(model, inputs, config_patches=self.config) File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 2578, in compile_fx return _maybe_wrap_and_compile_fx_main( File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 2655, in _maybe_wrap_and_compile_fx_main return _compile_fx_main( File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 2864, in _compile_fx_main raise e.remove_dynamo_frames() from None # see TORCHDYNAMO_VERBOSE=1 File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 2850, in _compile_fx_main return aot_autograd( File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/backends/common.py", line 124, in call cg = aot_module_simplified(gm, example_inputs, **self.kwargs) File "/home/.venv/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 1161, in aot_module_simplified compiled_fn, _ = aot_stage2_compile( File "/home/.venv/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/graph_compile.py", line 366, in aot_stage2_compile return aot_stage2_autograd(aot_state, aot_graph_capture) File "/home/.venv/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/graph_compile.py", line 2197, in aot_stage2_autograd fwd_output_strides, compiled_fw_func = _aot_stage2b_fw_compile( File "/home/.venv/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/graph_compile.py", line 1986, in _aot_stage2b_fw_compile return _aot_stage2b_compile_forward_or_inference( File "/home/.venv/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/graph_compile.py", line 2513, in _aot_stage2b_compile_forward_or_inference compiled_fw_func = compiler(fw_module, adjusted_flat_args) File "/home/.venv/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/schemas.py", line 1394, in call output_code = self.compiler_fn(gm, example_inputs) File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 2719, in fw_compiler_base return compile_fx_forward( File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 2390, in compile_fx_forward return inner_compile( File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 826, in compile_fx_inner return wrap_compiler_debug(_compile_fx_inner, compiler_name="inductor")( File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/repro/after_aot.py", line 273, in debug_wrapper inner_compiled_fn = compiler_fn(gm, example_inputs) File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 1053, in _compile_fx_inner raise InductorError(e, currentframe()).with_traceback( File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 1037, in _compile_fx_inner mb_compiled_graph = fx_codegen_and_compile( File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 1798, in fx_codegen_and_compile return scheme.codegen_and_compile(gm, example_inputs, inputs_to_check, graph_kwargs) File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 1570, in codegen_and_compile compiled_module = graph.compile_to_module() File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/graph.py", line 2499, in compile_to_module return self._compile_to_module() File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/graph.py", line 2505, in _compile_to_module self.codegen_with_cpp_wrapper() if self.cpp_wrapper else self.codegen() File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/graph.py", line 2441, in codegen self.scheduler.codegen() File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/scheduler.py", line 6592, in codegen self._codegen_partitions() File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/scheduler.py", line 6732, in _codegen_partitions self._codegen(partition) File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/scheduler.py", line 6838, in _codegen self.get_backend(device).codegen_node(node) File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/codegen/cpp.py", line 5320, in codegen_node cpp_kernel_proxy.codegen_nodes(nodes) File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/codegen/cpp.py", line 4517, in codegen_nodes self.codegen_functions(fn_list, var_sizes_list) File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/codegen/cpp.py", line 4354, in codegen_functions tiling_factors, tiling_indices = tiling_select.select_tiling( File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/codegen/cpp.py", line 3806, in select_tiling tiling_indices = self._select_tiling_indices( File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/codegen/cpp.py", line 3975, in _select_tiling_indices stride = stride_at_vec_range(index, var, tiling_factor) File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/codegen/cpp.py", line 469, in stride_at_vec_range index = simplify_index_in_vec_range(index, var, vec_length) File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/codegen/cpp.py", line 457, in simplify_index_in_vec_range index = sympy.simplify(index) File "/home/.venv/lib/python3.10/site-packages/sympy/simplify/simplify.py", line 630, in simplify expr = expr.replace( File "/home/.venv/lib/python3.10/site-packages/sympy/core/basic.py", line 1797, in replace rv = walk(self, rec_replace) File "/home/.venv/lib/python3.10/site-packages/sympy/core/basic.py", line 1772, in walk newargs = tuple([walk(a, F) for a in args]) File "/home/.venv/lib/python3.10/site-packages/sympy/core/basic.py", line 1772, in <listcomp> newargs = tuple([walk(a, F) for a in args]) File "/home/.venv/lib/python3.10/site-packages/sympy/core/basic.py", line 1772, in walk newargs = tuple([walk(a, F) for a in args]) File "/home/.venv/lib/python3.10/site-packages/sympy/core/basic.py", line 1772, in <listcomp> newargs = tuple([walk(a, F) for a in args]) File "/home/.venv/lib/python3.10/site-packages/sympy/core/basic.py", line 1782, in walk rv = F(rv) File "/home/.venv/lib/python3.10/site-packages/sympy/core/basic.py", line 1790, in rec_replace v = _value(expr, result) File "/home/.venv/lib/python3.10/site-packages/sympy/core/basic.py", line 1756, in <lambda> _value = lambda expr, result: value(expr) File "/home/.venv/lib/python3.10/site-packages/sympy/simplify/simplify.py", line 638, in <lambda> lambda x: x.func([simplify(i, **kwargs) for i in x.args]), File "/home/.venv/lib/python3.10/site-packages/sympy/simplify/simplify.py", line 638, in <listcomp> lambda x: x.func([simplify(i, **kwargs) for i in x.args]), File "/home/.venv/lib/python3.10/site-packages/sympy/simplify/simplify.py", line 616, in simplify return _eval_simplify(**kwargs) File "/home/.venv/lib/python3.10/site-packages/sympy/core/relational.py", line 437, in _eval_simplify elif dif.equals(0): # XXX this is expensive File "/home/.venv/lib/python3.10/site-packages/sympy/core/expr.py", line 801, in equals constant = diff.is_constant(simplify=False, failing_number=True) File "/home/.venv/lib/python3.10/site-packages/sympy/core/expr.py", line 739, in is_constant deriv = expr.diff(w) File "/home/.venv/lib/python3.10/site-packages/sympy/core/expr.py", line 3606, in diff return _derivative_dispatch(self, *symbols, **assumptions) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 1938, in _derivative_dispatch return Derivative(expr, *variables, **kwargs) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 1466, in new obj = cls._dispatch_eval_derivative_n_times(expr, v, count) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 1927, in _dispatch_eval_derivative_n_times return expr._eval_derivative_n_times(v, count) File "/home/.venv/lib/python3.10/site-packages/sympy/core/basic.py", line 1975, in _eval_derivative_n_times obj = obj._eval_derivative(s) File "/home/.venv/lib/python3.10/site-packages/sympy/functions/elementary/miscellaneous.py", line 633, in _eval_derivative da = a.diff(s) File "/home/.venv/lib/python3.10/site-packages/sympy/core/expr.py", line 3606, in diff return _derivative_dispatch(self, *symbols, **assumptions) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 1938, in _derivative_dispatch return Derivative(expr, *variables, **kwargs) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 1466, in new obj = cls._dispatch_eval_derivative_n_times(expr, v, count) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 1927, in _dispatch_eval_derivative_n_times return expr._eval_derivative_n_times(v, count) File "/home/.venv/lib/python3.10/site-packages/sympy/core/basic.py", line 1975, in _eval_derivative_n_times obj = obj._eval_derivative(s) File "/home/.venv/lib/python3.10/site-packages/sympy/functions/elementary/miscellaneous.py", line 633, in _eval_derivative da = a.diff(s) File "/home/.venv/lib/python3.10/site-packages/sympy/core/expr.py", line 3606, in diff return _derivative_dispatch(self, *symbols, **assumptions) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 1938, in _derivative_dispatch return Derivative(expr, *variables, **kwargs) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 1466, in new obj = cls._dispatch_eval_derivative_n_times(expr, v, count) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 1927, in _dispatch_eval_derivative_n_times return expr._eval_derivative_n_times(v, count) File "/home/.venv/lib/python3.10/site-packages/sympy/core/basic.py", line 1975, in _eval_derivative_n_times obj = obj._eval_derivative(s) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 606, in _eval_derivative da = a.diff(s) File "/home/.venv/lib/python3.10/site-packages/sympy/core/expr.py", line 3606, in diff return _derivative_dispatch(self, *symbols, **assumptions) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 1938, in _derivative_dispatch return Derivative(expr, *variables, **kwargs) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 1466, in new obj = cls._dispatch_eval_derivative_n_times(expr, v, count) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 1927, in _dispatch_eval_derivative_n_times return expr._eval_derivative_n_times(v, count) File "/home/.venv/lib/python3.10/site-packages/sympy/core/basic.py", line 1975, in _eval_derivative_n_times obj = obj._eval_derivative(s) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 606, in _eval_derivative da = a.diff(s) torch._inductor.exc.InductorError: AttributeError: 'StrictLessThan' object has no attribute 'diff'

CPU: Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 52 bits physical, 57 bits virtual Byte Order: Little Endian CPU(s): 384 On-line CPU(s) list: 0-383 Vendor ID: AuthenticAMD Model name: AMD EPYC 9684X 96-Core Processor CPU family: 25 Model: 17 Thread(s) per core: 2 Core(s) per socket: 96 Socket(s): 2 Stepping: 2 BogoMIPS: 5099.98 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good amd_lbr_v2 nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba perfmon_v2 ibrs ibpb stibp ibrs_enhanced vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local user_shstk avx512_bf16 clzero irperf xsaveerptr rdpru wbnoinvd amd_ppin cppc amd_ibpb_ret arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif x2avic v_spec_ctrl vnmi avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq la57 rdpid overflow_recov succor smca fsrm flush_l1d debug_swap ibpb_exit_to_user Virtualization: AMD-V L1d cache: 6 MiB (192 instances) L1i cache: 6 MiB (192 instances) L2 cache: 192 MiB (192 instances) L3 cache: 2.3 GiB (24 instances) NUMA node(s): 2 NUMA node0 CPU(s): 0-95,192-287 NUMA node1 CPU(s): 96-191,288-383 Vulnerability Gather data sampling: Not affected Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Not affected Vulnerability Mds: Not affected Vulnerability Meltdown: Not affected Vulnerability Mmio stale data: Not affected Vulnerability Reg file data sampling: Not affected Vulnerability Retbleed: Not affected Vulnerability Spec rstack overflow: Mitigation; Safe RET Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; STIBP always-on; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Not affected Vulnerability Vmscape: Mitigation; IBPB before exit to userspace

Code Example

torch._inductor.exc.InductorError: AttributeError: 'StrictLessThan' object has no attribute 'diff'

---

torch/_inductor/codegen/cpp.py", line 457, in simplify_index_in_vec_range
    index = sympy.simplify(index)

---

import torch
import torch.nn as nn
import torch.nn.functional as F

_m_t25553926 = nn.Linear(3, 11)
_m_t25553927 = nn.AvgPool2d(2)
_m_t25553934 = nn.AvgPool2d(2)

torch.manual_seed(0)
t25553925 = torch.randn([16, 16, 9, 3])

def model_551427():
    t25553926 = _m_t25553926(t25553925)
    t25553927 = _m_t25553927(t25553926)
    t25553934 = _m_t25553934(t25553927)
    t25553936 = F.gelu(t25553934, approximate='tanh')
    return t25553936

# Eager forward — works fine
_eager_out = model_551427()
assert torch.isfinite(_eager_out).all(), 'eager output not finite'

# Compiled forward — works fine
_compiled = torch.compile(model_551427, backend='inductor')
_compiled_out = _compiled()
assert torch.isfinite(_compiled_out).all(), 'compiled output not finite'

# eager/compiled output comparison
assert torch.allclose(_eager_out, _compiled_out, atol=1e-4, rtol=1e-4), (
    f'eager/compiled mismatch: max_diff={(_eager_out - _compiled_out).abs().max().item():.6f}'
)

# Backward pass — works fine
_bwd_out = model_551427()
if _bwd_out.grad_fn is not None:
    _bwd_out.mean().backward()
    _all_params = [p for _m in [_m_t25553926, _m_t25553927, _m_t25553934] for p in _m.parameters() if p.grad is not None]
    assert all(torch.isfinite(p.grad).all() for p in _all_params), 'non-finite gradients after backward'

# torch.func.grad composed with torch.compile — works fine
import torch.func as _torch_func
def _fn_grad_551427(t25553925):
    t25553926 = _m_t25553926(t25553925)
    t25553927 = _m_t25553927(t25553926)
    t25553934 = _m_t25553934(t25553927)
    t25553936 = F.gelu(t25553934, approximate='tanh')
    return t25553936.mean()
_fgrad_eager = _torch_func.grad(_fn_grad_551427)(t25553925)
_fgrad_compiled = torch.compile(_torch_func.grad(_fn_grad_551427))(t25553925)
assert torch.allclose(_fgrad_eager, _fgrad_compiled, atol=1e-4, rtol=1e-4), (
    f'func.grad eager/compiled mismatch: max_diff={(_fgrad_eager - _fgrad_compiled).abs().max().item():.6f}'
)

# torch.func.grad composed with torch.compile and dynamic=True — crashes
_fgrad_dynamic = torch.compile(_torch_func.grad(_fn_grad_551427), dynamic=True)(t25553925)
assert torch.allclose(_fgrad_eager, _fgrad_dynamic, atol=1e-4, rtol=1e-4), (
    f'func.grad dynamic mismatch: max_diff={(_fgrad_eager - _fgrad_dynamic).abs().max().item():.6f}'
)
RAW_BUFFERClick to expand / collapse

🐛 Describe the bug

When compiling a function that uses torch.func.grad with torch.compile(..., dynamic=True), TorchInductor's CPU backend crashes during vectorization tiling selection with:

torch._inductor.exc.InductorError: AttributeError: 'StrictLessThan' object has no attribute 'diff'

crash starts from this part of the code:

torch/_inductor/codegen/cpp.py", line 457, in simplify_index_in_vec_range
    index = sympy.simplify(index)

Reproducible code:

import torch
import torch.nn as nn
import torch.nn.functional as F

_m_t25553926 = nn.Linear(3, 11)
_m_t25553927 = nn.AvgPool2d(2)
_m_t25553934 = nn.AvgPool2d(2)

torch.manual_seed(0)
t25553925 = torch.randn([16, 16, 9, 3])

def model_551427():
    t25553926 = _m_t25553926(t25553925)
    t25553927 = _m_t25553927(t25553926)
    t25553934 = _m_t25553934(t25553927)
    t25553936 = F.gelu(t25553934, approximate='tanh')
    return t25553936

# Eager forward — works fine
_eager_out = model_551427()
assert torch.isfinite(_eager_out).all(), 'eager output not finite'

# Compiled forward — works fine
_compiled = torch.compile(model_551427, backend='inductor')
_compiled_out = _compiled()
assert torch.isfinite(_compiled_out).all(), 'compiled output not finite'

# eager/compiled output comparison
assert torch.allclose(_eager_out, _compiled_out, atol=1e-4, rtol=1e-4), (
    f'eager/compiled mismatch: max_diff={(_eager_out - _compiled_out).abs().max().item():.6f}'
)

# Backward pass — works fine
_bwd_out = model_551427()
if _bwd_out.grad_fn is not None:
    _bwd_out.mean().backward()
    _all_params = [p for _m in [_m_t25553926, _m_t25553927, _m_t25553934] for p in _m.parameters() if p.grad is not None]
    assert all(torch.isfinite(p.grad).all() for p in _all_params), 'non-finite gradients after backward'

# torch.func.grad composed with torch.compile — works fine
import torch.func as _torch_func
def _fn_grad_551427(t25553925):
    t25553926 = _m_t25553926(t25553925)
    t25553927 = _m_t25553927(t25553926)
    t25553934 = _m_t25553934(t25553927)
    t25553936 = F.gelu(t25553934, approximate='tanh')
    return t25553936.mean()
_fgrad_eager = _torch_func.grad(_fn_grad_551427)(t25553925)
_fgrad_compiled = torch.compile(_torch_func.grad(_fn_grad_551427))(t25553925)
assert torch.allclose(_fgrad_eager, _fgrad_compiled, atol=1e-4, rtol=1e-4), (
    f'func.grad eager/compiled mismatch: max_diff={(_fgrad_eager - _fgrad_compiled).abs().max().item():.6f}'
)

# torch.func.grad composed with torch.compile and dynamic=True — crashes
_fgrad_dynamic = torch.compile(_torch_func.grad(_fn_grad_551427), dynamic=True)(t25553925)
assert torch.allclose(_fgrad_eager, _fgrad_dynamic, atol=1e-4, rtol=1e-4), (
    f'func.grad dynamic mismatch: max_diff={(_fgrad_eager - _fgrad_dynamic).abs().max().item():.6f}'
)

Error logs

Traceback (most recent call last): File "/home/bugs/crash_6992079b_reporting.py", line 55, in <module> _fgrad_dynamic = torch.compile(_torch_func.grad(_fn_grad_551427), dynamic=True)(t25553925) File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/eval_frame.py", line 1038, in compile_wrapper raise e.remove_dynamo_frames() from None # see TORCHDYNAMO_VERBOSE=1 File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/eval_frame.py", line 1024, in compile_wrapper return fn(*args, **kwargs) File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 2316, in call result = self._torchdynamo_orig_backend( File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 2052, in call result = self._inner_convert( File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 729, in call result = _compile( File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 1827, in _compile guarded_code, tracer_output = compile_inner(code, one_graph, hooks) File "/home/.venv/lib/python3.10/site-packages/torch/_utils_internal.py", line 96, in wrapper_function return function(args, **kwargs) File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 1500, in compile_inner return _compile_inner(code, one_graph, hooks) File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 1534, in _compile_inner dynamo_output = compile_frame( File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 1408, in compile_frame bytecode, tracer_output = transform_code_object(code, transform) File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/bytecode_transformation.py", line 1608, in transform_code_object tracer_output = transformations(instructions, code_options) File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 1380, in transform tracer_output = trace_frame( File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 341, in _fn return fn(args, **kwargs) File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 863, in trace_frame run_tracer() File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 844, in run_tracer tracer.run() File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 1794, in run while self.step(): File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 1459, in step self.dispatch_table[inst.opcode](self, inst) File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 5570, in RETURN_VALUE self._return(inst) File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 5552, in _return all_stack_locals_metadata = self.output.compile_subgraph( File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 1889, in compile_subgraph self.compile_and_call_fx_graph(tx, pass2.graph_output_vars(), root) File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 2460, in compile_and_call_fx_graph compiled_fn = self.call_user_compiler(gm, self.example_inputs()) File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 2613, in call_user_compiler return self._call_user_compiler(gm, example_inputs) File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 2664, in call_user_compiler compiled_fn = compiler_fn(gm, example_inputs) File "/home/.venv/lib/python3.10/site-packages/torch/dynamo/repro/after_dynamo.py", line 156, in call compiled_gm = compiler_fn(gm, example_inputs) File "/home/.venv/lib/python3.10/site-packages/torch/init.py", line 2461, in call return compile_fx(model, inputs, config_patches=self.config) File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 2578, in compile_fx return _maybe_wrap_and_compile_fx_main( File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 2655, in _maybe_wrap_and_compile_fx_main return _compile_fx_main( File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 2864, in _compile_fx_main raise e.remove_dynamo_frames() from None # see TORCHDYNAMO_VERBOSE=1 File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 2850, in _compile_fx_main return aot_autograd( File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/backends/common.py", line 124, in call cg = aot_module_simplified(gm, example_inputs, **self.kwargs) File "/home/.venv/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 1161, in aot_module_simplified compiled_fn, _ = aot_stage2_compile( File "/home/.venv/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/graph_compile.py", line 366, in aot_stage2_compile return aot_stage2_autograd(aot_state, aot_graph_capture) File "/home/.venv/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/graph_compile.py", line 2197, in aot_stage2_autograd fwd_output_strides, compiled_fw_func = _aot_stage2b_fw_compile( File "/home/.venv/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/graph_compile.py", line 1986, in _aot_stage2b_fw_compile return _aot_stage2b_compile_forward_or_inference( File "/home/.venv/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/graph_compile.py", line 2513, in _aot_stage2b_compile_forward_or_inference compiled_fw_func = compiler(fw_module, adjusted_flat_args) File "/home/.venv/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/schemas.py", line 1394, in call output_code = self.compiler_fn(gm, example_inputs) File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 2719, in fw_compiler_base return compile_fx_forward( File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 2390, in compile_fx_forward return inner_compile( File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 826, in compile_fx_inner return wrap_compiler_debug(_compile_fx_inner, compiler_name="inductor")( File "/home/.venv/lib/python3.10/site-packages/torch/_dynamo/repro/after_aot.py", line 273, in debug_wrapper inner_compiled_fn = compiler_fn(gm, example_inputs) File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 1053, in _compile_fx_inner raise InductorError(e, currentframe()).with_traceback( File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 1037, in _compile_fx_inner mb_compiled_graph = fx_codegen_and_compile( File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 1798, in fx_codegen_and_compile return scheme.codegen_and_compile(gm, example_inputs, inputs_to_check, graph_kwargs) File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 1570, in codegen_and_compile compiled_module = graph.compile_to_module() File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/graph.py", line 2499, in compile_to_module return self._compile_to_module() File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/graph.py", line 2505, in _compile_to_module self.codegen_with_cpp_wrapper() if self.cpp_wrapper else self.codegen() File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/graph.py", line 2441, in codegen self.scheduler.codegen() File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/scheduler.py", line 6592, in codegen self._codegen_partitions() File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/scheduler.py", line 6732, in _codegen_partitions self._codegen(partition) File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/scheduler.py", line 6838, in _codegen self.get_backend(device).codegen_node(node) File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/codegen/cpp.py", line 5320, in codegen_node cpp_kernel_proxy.codegen_nodes(nodes) File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/codegen/cpp.py", line 4517, in codegen_nodes self.codegen_functions(fn_list, var_sizes_list) File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/codegen/cpp.py", line 4354, in codegen_functions tiling_factors, tiling_indices = tiling_select.select_tiling( File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/codegen/cpp.py", line 3806, in select_tiling tiling_indices = self._select_tiling_indices( File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/codegen/cpp.py", line 3975, in _select_tiling_indices stride = stride_at_vec_range(index, var, tiling_factor) File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/codegen/cpp.py", line 469, in stride_at_vec_range index = simplify_index_in_vec_range(index, var, vec_length) File "/home/.venv/lib/python3.10/site-packages/torch/_inductor/codegen/cpp.py", line 457, in simplify_index_in_vec_range index = sympy.simplify(index) File "/home/.venv/lib/python3.10/site-packages/sympy/simplify/simplify.py", line 630, in simplify expr = expr.replace( File "/home/.venv/lib/python3.10/site-packages/sympy/core/basic.py", line 1797, in replace rv = walk(self, rec_replace) File "/home/.venv/lib/python3.10/site-packages/sympy/core/basic.py", line 1772, in walk newargs = tuple([walk(a, F) for a in args]) File "/home/.venv/lib/python3.10/site-packages/sympy/core/basic.py", line 1772, in <listcomp> newargs = tuple([walk(a, F) for a in args]) File "/home/.venv/lib/python3.10/site-packages/sympy/core/basic.py", line 1772, in walk newargs = tuple([walk(a, F) for a in args]) File "/home/.venv/lib/python3.10/site-packages/sympy/core/basic.py", line 1772, in <listcomp> newargs = tuple([walk(a, F) for a in args]) File "/home/.venv/lib/python3.10/site-packages/sympy/core/basic.py", line 1782, in walk rv = F(rv) File "/home/.venv/lib/python3.10/site-packages/sympy/core/basic.py", line 1790, in rec_replace v = _value(expr, result) File "/home/.venv/lib/python3.10/site-packages/sympy/core/basic.py", line 1756, in <lambda> _value = lambda expr, result: value(expr) File "/home/.venv/lib/python3.10/site-packages/sympy/simplify/simplify.py", line 638, in <lambda> lambda x: x.func([simplify(i, **kwargs) for i in x.args]), File "/home/.venv/lib/python3.10/site-packages/sympy/simplify/simplify.py", line 638, in <listcomp> lambda x: x.func([simplify(i, **kwargs) for i in x.args]), File "/home/.venv/lib/python3.10/site-packages/sympy/simplify/simplify.py", line 616, in simplify return _eval_simplify(**kwargs) File "/home/.venv/lib/python3.10/site-packages/sympy/core/relational.py", line 437, in _eval_simplify elif dif.equals(0): # XXX this is expensive File "/home/.venv/lib/python3.10/site-packages/sympy/core/expr.py", line 801, in equals constant = diff.is_constant(simplify=False, failing_number=True) File "/home/.venv/lib/python3.10/site-packages/sympy/core/expr.py", line 739, in is_constant deriv = expr.diff(w) File "/home/.venv/lib/python3.10/site-packages/sympy/core/expr.py", line 3606, in diff return _derivative_dispatch(self, *symbols, **assumptions) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 1938, in _derivative_dispatch return Derivative(expr, *variables, **kwargs) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 1466, in new obj = cls._dispatch_eval_derivative_n_times(expr, v, count) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 1927, in _dispatch_eval_derivative_n_times return expr._eval_derivative_n_times(v, count) File "/home/.venv/lib/python3.10/site-packages/sympy/core/basic.py", line 1975, in _eval_derivative_n_times obj = obj._eval_derivative(s) File "/home/.venv/lib/python3.10/site-packages/sympy/functions/elementary/miscellaneous.py", line 633, in _eval_derivative da = a.diff(s) File "/home/.venv/lib/python3.10/site-packages/sympy/core/expr.py", line 3606, in diff return _derivative_dispatch(self, *symbols, **assumptions) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 1938, in _derivative_dispatch return Derivative(expr, *variables, **kwargs) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 1466, in new obj = cls._dispatch_eval_derivative_n_times(expr, v, count) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 1927, in _dispatch_eval_derivative_n_times return expr._eval_derivative_n_times(v, count) File "/home/.venv/lib/python3.10/site-packages/sympy/core/basic.py", line 1975, in _eval_derivative_n_times obj = obj._eval_derivative(s) File "/home/.venv/lib/python3.10/site-packages/sympy/functions/elementary/miscellaneous.py", line 633, in _eval_derivative da = a.diff(s) File "/home/.venv/lib/python3.10/site-packages/sympy/core/expr.py", line 3606, in diff return _derivative_dispatch(self, *symbols, **assumptions) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 1938, in _derivative_dispatch return Derivative(expr, *variables, **kwargs) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 1466, in new obj = cls._dispatch_eval_derivative_n_times(expr, v, count) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 1927, in _dispatch_eval_derivative_n_times return expr._eval_derivative_n_times(v, count) File "/home/.venv/lib/python3.10/site-packages/sympy/core/basic.py", line 1975, in _eval_derivative_n_times obj = obj._eval_derivative(s) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 606, in _eval_derivative da = a.diff(s) File "/home/.venv/lib/python3.10/site-packages/sympy/core/expr.py", line 3606, in diff return _derivative_dispatch(self, *symbols, **assumptions) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 1938, in _derivative_dispatch return Derivative(expr, *variables, **kwargs) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 1466, in new obj = cls._dispatch_eval_derivative_n_times(expr, v, count) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 1927, in _dispatch_eval_derivative_n_times return expr._eval_derivative_n_times(v, count) File "/home/.venv/lib/python3.10/site-packages/sympy/core/basic.py", line 1975, in _eval_derivative_n_times obj = obj._eval_derivative(s) File "/home/.venv/lib/python3.10/site-packages/sympy/core/function.py", line 606, in _eval_derivative da = a.diff(s) torch._inductor.exc.InductorError: AttributeError: 'StrictLessThan' object has no attribute 'diff'

Versions

Collecting environment information... PyTorch version: 2.11.0+cu130 Is debug build: False CUDA used to build PyTorch: 13.0 ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.5 LTS (x86_64) GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0 Clang version: 15.0.0 ([email protected]:llvm/llvm-project.git 4ba6a9c9f65bbc8bd06e3652cb20fd4dfc846137) CMake version: version 3.22.1 Libc version: glibc-2.35

Python version: 3.10.12 (main, Mar 3 2026, 11:56:32) [GCC 11.4.0] (64-bit runtime) Python platform: Linux-6.8.0-94-generic-x86_64-with-glibc2.35 Is CUDA available: False CUDA runtime version: No CUDA CUDA_MODULE_LOADING set to: N/A GPU models and configuration: No CUDA Nvidia driver version: No CUDA cuDNN version: No CUDA 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 CPU op-mode(s): 32-bit, 64-bit Address sizes: 52 bits physical, 57 bits virtual Byte Order: Little Endian CPU(s): 384 On-line CPU(s) list: 0-383 Vendor ID: AuthenticAMD Model name: AMD EPYC 9684X 96-Core Processor CPU family: 25 Model: 17 Thread(s) per core: 2 Core(s) per socket: 96 Socket(s): 2 Stepping: 2 BogoMIPS: 5099.98 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good amd_lbr_v2 nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba perfmon_v2 ibrs ibpb stibp ibrs_enhanced vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local user_shstk avx512_bf16 clzero irperf xsaveerptr rdpru wbnoinvd amd_ppin cppc amd_ibpb_ret arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif x2avic v_spec_ctrl vnmi avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq la57 rdpid overflow_recov succor smca fsrm flush_l1d debug_swap ibpb_exit_to_user Virtualization: AMD-V L1d cache: 6 MiB (192 instances) L1i cache: 6 MiB (192 instances) L2 cache: 192 MiB (192 instances) L3 cache: 2.3 GiB (24 instances) NUMA node(s): 2 NUMA node0 CPU(s): 0-95,192-287 NUMA node1 CPU(s): 96-191,288-383 Vulnerability Gather data sampling: Not affected Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Not affected Vulnerability Mds: Not affected Vulnerability Meltdown: Not affected Vulnerability Mmio stale data: Not affected Vulnerability Reg file data sampling: Not affected Vulnerability Retbleed: Not affected Vulnerability Spec rstack overflow: Mitigation; Safe RET Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; STIBP always-on; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Not affected Vulnerability Vmscape: Mitigation; IBPB before exit to userspace

Versions of relevant libraries: [pip3] numpy==2.2.6 [pip3] nvidia-cublas==13.1.0.3 [pip3] nvidia-cuda-cupti==13.0.85 [pip3] nvidia-cuda-nvrtc==13.0.88 [pip3] nvidia-cuda-runtime==13.0.96 [pip3] nvidia-cudnn-cu13==9.19.0.56 [pip3] nvidia-cufft==12.0.0.61 [pip3] nvidia-curand==10.4.0.35 [pip3] nvidia-cusolver==12.0.4.66 [pip3] nvidia-cusparse==12.6.3.3 [pip3] nvidia-cusparselt-cu13==0.8.0 [pip3] nvidia-nccl-cu13==2.28.9 [pip3] nvidia-nvjitlink==13.0.88 [pip3] nvidia-nvtx==13.0.85 [pip3] torch==2.11.0 [pip3] triton==3.6.0 [conda] Could not collect

cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @jerryzh168 @aditew01 @chauhang @penguinwu @ezyang @bobrenjc93 @aditvenk @laithsakka @voznesenskym @EikanWang @Guobing-Chen @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @aakhundov @coconutruben @jataylo

extent analysis

TL;DR

The issue is likely caused by a bug in TorchInductor's CPU backend when using torch.compile with dynamic=True and torch.func.grad, and can be temporarily worked around by avoiding the use of dynamic=True or by updating to a version of PyTorch where this bug is fixed.

Guidance

  • The error occurs when using torch.compile with dynamic=True and torch.func.grad, which suggests a bug in TorchInductor's CPU backend.
  • The stacktrace points to an issue with the simplify_index_in_vec_range function in torch/_inductor/codegen/cpp.py, which is related to the vectorization tiling selection.
  • To mitigate this issue, try removing the dynamic=True argument from the torch.compile call or update to a version of PyTorch where this bug is fixed.
  • If the issue persists, try to simplify the model or the input data to see if it affects the error.

Example

No code example is provided as the issue is likely related to a bug in the PyTorch library.

Notes

  • The issue is specific to the CPU backend of TorchInductor and does not occur when using the CUDA backend.
  • The error message suggests that the StrictLessThan object does not have a diff attribute, which is required for the simplify_index_in_vec_range function.

Recommendation

Apply workaround: Avoid using dynamic=True with torch.compile and torch.func.grad until the bug is fixed in a future version of PyTorch.

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

pytorch - 💡(How to fix) Fix [inductor] torch.compile(dynamic=True) crashes in TorchInductor CPU codegen with AttributeError: 'StrictLessThan' object has no attribute 'diff' [1 participants]