pytorch - 💡(How to fix) Fix [Inductor] `control_deps_op_lowering` aborts on `auto_functionalized_v2(...)` using overlap scheduling

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…

Error Message

torch._inductor.exc.InductorError: LoweringException: AssertionError: auto_functionalized_v2 is not an OpOverload target: control_deps args[0]: (TensorBox(StorageBox( _CollectiveKernel( python_kernel_name='torch.ops._c10d_functional.all_gather_into_tensor.default', ... args[1]: Subgraph(name='subgraph_auto_functionalized_v2', graph_module=GraphModule(), graph=None)

Fix Action

Fix / Workaround

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): 224 On-line CPU(s) list: 0-223 Vendor ID: GenuineIntel Model name: INTEL(R) XEON(R) PLATINUM 8570 CPU family: 6 Model: 207 Thread(s) per core: 2 Core(s) per socket: 56 Socket(s): 2 Stepping: 2 CPU(s) scaling MHz: 24% CPU max MHz: 4000.0000 CPU min MHz: 800.0000 BogoMIPS: 4200.00 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cat_l2 cdp_l3 intel_ppin cdp_l2 ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect user_shstk avx_vnni avx512_bf16 wbnoinvd dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req vnmi avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid bus_lock_detect cldemote movdiri movdir64b enqcmd fsrm md_clear serialize tsxldtrk pconfig arch_lbr ibt amx_bf16 avx512_fp16 amx_tile amx_int8 flush_l1d arch_capabilities ibpb_exit_to_user Virtualization: VT-x L1d cache: 5.3 MiB (112 instances) L1i cache: 3.5 MiB (112 instances) L2 cache: 224 MiB (112 instances) L3 cache: 600 MiB (2 instances) NUMA node(s): 2 NUMA node0 CPU(s): 0-55,112-167 NUMA node1 CPU(s): 56-111,168-223 Vulnerability Gather data sampling: Not affected Vulnerability Indirect target selection: 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: Not affected 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; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S Vulnerability Srbds: Not affected Vulnerability Tsa: Not affected Vulnerability Tsx async abort: Not affected Vulnerability Vmscape: Mitigation; IBPB before exit to userspace

Code Example

from __future__ import annotations

import os

import torch
import torch.distributed as dist
import torch.distributed._functional_collectives as funcol
from torch._inductor import config as ind_config


@torch.library.custom_op("repro_ctrl_deps::add_one_inplace", mutates_args={"x"})
def add_one_inplace(x: torch.Tensor) -> torch.Tensor:
    x.add_(1.0)
    return x.clone()


@add_one_inplace.register_fake
def _add_one_inplace_fake(x: torch.Tensor) -> torch.Tensor:
    return x.clone()


def _custom_runtime_estimation(node, override_size):
    """Force the overlap scheduler to see a hide-able collective/compute pair."""
    name = str(node.target)
    if "all_gather_into_tensor" in name:
        return 1.0
    if "auto_functionalized_v2" in name:
        return 10.0
    return None


def main() -> None:
    if not torch.cuda.is_available():
        raise SystemExit("CUDA/ROCm device required to reproduce.")

    os.environ.setdefault("MASTER_ADDR", "localhost")
    os.environ.setdefault("MASTER_PORT", "29555")
    os.environ.setdefault("RANK", "0")
    os.environ.setdefault("WORLD_SIZE", "1")
    if not dist.is_initialized():
        dist.init_process_group(backend="nccl", rank=0, world_size=1)
    group = dist.group.WORLD
    assert group is not None

    # Production knobs the upstream overlap scheduler uses.
    # `enable_overlap_scheduling` gates the scheduler entirely;
    # `insert_overlap_deps` is what makes the bucketer wrap nodes in
    # `control_deps` (otherwise it just inserts plain FX edges and the bug
    # doesn't surface).
    aten_opts = ind_config.aten_distributed_optimizations
    aten_opts.enable_overlap_scheduling = True
    aten_opts.insert_overlap_deps = True
    aten_opts.custom_runtime_estimation = _custom_runtime_estimation

    @torch.compile(backend="inductor", fullgraph=True, dynamic=False)
    def f(x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
        # Functional all_gather + wait pair so the
        # `schedule_overlap_bucketing_from_inductor_configs` early-exit
        # (`if not any(is_wait_tensor(n) for n in gm.graph.nodes): return`)
        # doesn't fire.
        gathered = funcol.all_gather_tensor(y, gather_dim=0, group=group)
        # `add_one_inplace` operates on `x`, NOT on the gathered output, so
        # it has no data dependency on `wait_tensor`. That's what makes it a
        # candidate hiding compute the scheduler can place between `start`
        # and `wait`. After AOTAutograd functionalization this becomes an
        # `auto_functionalized_v2` HOP node, which is the exact target the
        # bucketer wraps in `control_deps`.
        z = torch.ops.repro_ctrl_deps.add_one_inplace(x)
        return z + gathered

    x = torch.zeros(8, device="cuda")
    y = torch.ones(8, device="cuda")
    out = f(x, y)
    print("ok:", out)


if __name__ == "__main__":
    main()

---

python repro_aten_overlap.py

---

torch._inductor.exc.InductorError: LoweringException:
AssertionError: auto_functionalized_v2 is not an OpOverload
  target: control_deps
  args[0]: (TensorBox(StorageBox(
    _CollectiveKernel(
      python_kernel_name='torch.ops._c10d_functional.all_gather_into_tensor.default',
      ...
  args[1]: Subgraph(name='subgraph_auto_functionalized_v2', graph_module=GraphModule(), graph=None)

---

File ".../torch/_inductor/lowering.py", line 7760, in control_deps_op_lowering
    output = process_subgraph_nodes(subgraph_fn.graph_module, list(args))
File ".../torch/_inductor/lowering.py", line 7719, in process_subgraph_nodes
    V.graph.env[node] = V.graph.run_node(node)
File ".../torch/_inductor/graph.py", line 1306, in call_function
    assert isinstance(target, torch._ops.OpOverload), (
torch._inductor.exc.InductorError: LoweringException: AssertionError:
auto_functionalized_v2 is not an OpOverload
  target: control_deps
RAW_BUFFERClick to expand / collapse

🐛 Describe the bug

When the Inductor control_deps HOP wraps a subgraph that still contains an auto_functionalized_v2 node, control_deps_op_lowering recurses into the subgraph and GraphLowering.call_function aborts compilation with AssertionError: auto_functionalized_v2 is not an OpOverload.

Python code repro_aten_overlap.py:

from __future__ import annotations

import os

import torch
import torch.distributed as dist
import torch.distributed._functional_collectives as funcol
from torch._inductor import config as ind_config


@torch.library.custom_op("repro_ctrl_deps::add_one_inplace", mutates_args={"x"})
def add_one_inplace(x: torch.Tensor) -> torch.Tensor:
    x.add_(1.0)
    return x.clone()


@add_one_inplace.register_fake
def _add_one_inplace_fake(x: torch.Tensor) -> torch.Tensor:
    return x.clone()


def _custom_runtime_estimation(node, override_size):
    """Force the overlap scheduler to see a hide-able collective/compute pair."""
    name = str(node.target)
    if "all_gather_into_tensor" in name:
        return 1.0
    if "auto_functionalized_v2" in name:
        return 10.0
    return None


def main() -> None:
    if not torch.cuda.is_available():
        raise SystemExit("CUDA/ROCm device required to reproduce.")

    os.environ.setdefault("MASTER_ADDR", "localhost")
    os.environ.setdefault("MASTER_PORT", "29555")
    os.environ.setdefault("RANK", "0")
    os.environ.setdefault("WORLD_SIZE", "1")
    if not dist.is_initialized():
        dist.init_process_group(backend="nccl", rank=0, world_size=1)
    group = dist.group.WORLD
    assert group is not None

    # Production knobs the upstream overlap scheduler uses.
    # `enable_overlap_scheduling` gates the scheduler entirely;
    # `insert_overlap_deps` is what makes the bucketer wrap nodes in
    # `control_deps` (otherwise it just inserts plain FX edges and the bug
    # doesn't surface).
    aten_opts = ind_config.aten_distributed_optimizations
    aten_opts.enable_overlap_scheduling = True
    aten_opts.insert_overlap_deps = True
    aten_opts.custom_runtime_estimation = _custom_runtime_estimation

    @torch.compile(backend="inductor", fullgraph=True, dynamic=False)
    def f(x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
        # Functional all_gather + wait pair so the
        # `schedule_overlap_bucketing_from_inductor_configs` early-exit
        # (`if not any(is_wait_tensor(n) for n in gm.graph.nodes): return`)
        # doesn't fire.
        gathered = funcol.all_gather_tensor(y, gather_dim=0, group=group)
        # `add_one_inplace` operates on `x`, NOT on the gathered output, so
        # it has no data dependency on `wait_tensor`. That's what makes it a
        # candidate hiding compute the scheduler can place between `start`
        # and `wait`. After AOTAutograd functionalization this becomes an
        # `auto_functionalized_v2` HOP node, which is the exact target the
        # bucketer wraps in `control_deps`.
        z = torch.ops.repro_ctrl_deps.add_one_inplace(x)
        return z + gathered

    x = torch.zeros(8, device="cuda")
    y = torch.ones(8, device="cuda")
    out = f(x, y)
    print("ok:", out)


if __name__ == "__main__":
    main()

Run with:

python repro_aten_overlap.py

Expected: tensor([2., 2., ...], device='cuda:0').

Actual:

torch._inductor.exc.InductorError: LoweringException:
AssertionError: auto_functionalized_v2 is not an OpOverload
  target: control_deps
  args[0]: (TensorBox(StorageBox(
    _CollectiveKernel(
      python_kernel_name='torch.ops._c10d_functional.all_gather_into_tensor.default',
      ...
  args[1]: Subgraph(name='subgraph_auto_functionalized_v2', graph_module=GraphModule(), graph=None)

Stack:

File ".../torch/_inductor/lowering.py", line 7760, in control_deps_op_lowering
    output = process_subgraph_nodes(subgraph_fn.graph_module, list(args))
File ".../torch/_inductor/lowering.py", line 7719, in process_subgraph_nodes
    V.graph.env[node] = V.graph.run_node(node)
File ".../torch/_inductor/graph.py", line 1306, in call_function
    assert isinstance(target, torch._ops.OpOverload), (
torch._inductor.exc.InductorError: LoweringException: AssertionError:
auto_functionalized_v2 is not an OpOverload
  target: control_deps

How it appears in production

Inductor's aten_distributed_optimizations overlap scheduler (gated on enable_overlap_scheduling + insert_overlap_deps) wraps mutating compute ops in control_deps to enforce ordering with respect to neighboring collectives. Any mutating op (custom op, fused attention, etc.) is represented as auto_functionalized_v2(...) in the post-AOT graph, so as soon as the bucketer decides such an op fully hides a collective, that HOP ends up inside the control_deps subgraph and trips the assert during lowering.

Versions

PyTorch version: 2.12.0a0+0291f960b6.nv26.04.48445190 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-6.8.0-106-generic-x86_64-with-glibc2.39 Is CUDA available: True CUDA runtime version: 13.2.78 CUDA_MODULE_LOADING set to: LAZY GPU models and configuration: GPU 0: NVIDIA B200 GPU 1: NVIDIA B200 GPU 2: NVIDIA B200 GPU 3: NVIDIA B200 GPU 4: NVIDIA B200 GPU 5: NVIDIA B200 GPU 6: NVIDIA B200 GPU 7: NVIDIA B200

Nvidia driver version: 580.126.09 cuDNN version: Probably one of the following: /usr/lib/x86_64-linux-gnu/libcudnn.so.9.21.0 /usr/lib/x86_64-linux-gnu/libcudnn_adv.so.9.21.0 /usr/lib/x86_64-linux-gnu/libcudnn_cnn.so.9.21.0 /usr/lib/x86_64-linux-gnu/libcudnn_engines_precompiled.so.9.21.0 /usr/lib/x86_64-linux-gnu/libcudnn_engines_runtime_compiled.so.9.21.0 /usr/lib/x86_64-linux-gnu/libcudnn_engines_tensor_ir.so.9.21.0 /usr/lib/x86_64-linux-gnu/libcudnn_graph.so.9.21.0 /usr/lib/x86_64-linux-gnu/libcudnn_heuristic.so.9.21.0 /usr/lib/x86_64-linux-gnu/libcudnn_ops.so.9.21.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 CPU op-mode(s): 32-bit, 64-bit Address sizes: 52 bits physical, 57 bits virtual Byte Order: Little Endian CPU(s): 224 On-line CPU(s) list: 0-223 Vendor ID: GenuineIntel Model name: INTEL(R) XEON(R) PLATINUM 8570 CPU family: 6 Model: 207 Thread(s) per core: 2 Core(s) per socket: 56 Socket(s): 2 Stepping: 2 CPU(s) scaling MHz: 24% CPU max MHz: 4000.0000 CPU min MHz: 800.0000 BogoMIPS: 4200.00 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cat_l2 cdp_l3 intel_ppin cdp_l2 ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect user_shstk avx_vnni avx512_bf16 wbnoinvd dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req vnmi avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid bus_lock_detect cldemote movdiri movdir64b enqcmd fsrm md_clear serialize tsxldtrk pconfig arch_lbr ibt amx_bf16 avx512_fp16 amx_tile amx_int8 flush_l1d arch_capabilities ibpb_exit_to_user Virtualization: VT-x L1d cache: 5.3 MiB (112 instances) L1i cache: 3.5 MiB (112 instances) L2 cache: 224 MiB (112 instances) L3 cache: 600 MiB (2 instances) NUMA node(s): 2 NUMA node0 CPU(s): 0-55,112-167 NUMA node1 CPU(s): 56-111,168-223 Vulnerability Gather data sampling: Not affected Vulnerability Indirect target selection: 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: Not affected 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; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S Vulnerability Srbds: Not affected Vulnerability Tsa: Not affected Vulnerability Tsx async abort: Not affected Vulnerability Vmscape: Mitigation; IBPB before exit to userspace

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-cudnn-frontend==1.22.1 [pip3] nvtx==0.2.15 [pip3] onnx==1.21.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.12.0a0+0291f960b6.nv26.4.48445190 [pip3] torch_c_dlpack_ext==0.1.5 [pip3] torch_tensorrt==2.12.0a0 [pip3] torchao==0.17.0+git42bcdc49 [pip3] torchdata==0.11.0 [pip3] torchtitan==0.2.2+git6d1ff9e6 [pip3] torchvision==0.26.0a0+48956e05.nv26.4.48445190 [pip3] triton==3.6.0+git5d72932fc5.nv26.4 [pip3] triton_kernels==1.0.0+git5d72932fc5.nv26.4 [conda] Could not collect

cc @chauhang @penguinwu @voznesenskym @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @aakhundov @coconutruben @jataylo @ydwu4 @bdhirsh @bobrenjc93 @aorenste

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] `control_deps_op_lowering` aborts on `auto_functionalized_v2(...)` using overlap scheduling