Skip to content

AttributeError: 'int' object has no attribute 'codegen_reference' #131334

@desertfire

Description

@desertfire

Repro:

TORCHINDUCTOR_ABI_COMPATIBLE=1 TORCHINDUCTOR_CPP_WRAPPER=1 python test/inductor/test_torchinductor.py -k CpuTests.test_complex_fallback_cpu

Error:

  File "/data/users/binbao/pytorch/torch/_inductor/compile_fx.py", line 868, in fx_codegen_and_compile
    compiled_fn = graph.compile_to_fn()
  File "/data/users/binbao/pytorch/torch/_inductor/graph.py", line 1750, in compile_to_fn
    return self.compile_to_module().call
  File "/data/users/binbao/pytorch/torch/_dynamo/utils.py", line 246, in time_wrapper
    r = func(*args, **kwargs)
  File "/data/users/binbao/pytorch/torch/_inductor/graph.py", line 1678, in compile_to_module
    self.codegen_with_cpp_wrapper() if self.cpp_wrapper else self.codegen()
  File "/data/users/binbao/pytorch/torch/_inductor/graph.py", line 1622, in codegen_with_cpp_wrapper
    return self.codegen()
  File "/data/users/binbao/pytorch/torch/_inductor/graph.py", line 1633, in codegen
    self.scheduler.codegen()
  File "/data/users/binbao/pytorch/torch/_dynamo/utils.py", line 246, in time_wrapper
    r = func(*args, **kwargs)
  File "/data/users/binbao/pytorch/torch/_inductor/scheduler.py", line 2814, in codegen
    self.codegen_extern_call(node)
  File "/data/users/binbao/pytorch/torch/_inductor/scheduler.py", line 2719, in codegen_extern_call
    node.codegen(V.graph.wrapper_code)
  File "/data/users/binbao/pytorch/torch/_inductor/ir.py", line 5748, in codegen
    wrapper.generate_extern_kernel_alloc_and_find_schema_if_needed(
  File "/data/users/binbao/pytorch/torch/_inductor/codegen/cpp_wrapper_cpu.py", line 2068, in generate_extern_kernel_alloc_and_find_schema_if_needed
    return self.generate_extern_kernel_alloc_and_find_schema_if_needed_oss(
  File "/data/users/binbao/pytorch/torch/_inductor/codegen/cpp_wrapper_cpu.py", line 2202, in generate_extern_kernel_alloc_and_find_schema_if_needed_oss
    lines += self.generate_py_arg(
  File "/data/users/binbao/pytorch/torch/_inductor/codegen/cpp_wrapper_cpu.py", line 2149, in generate_py_arg
    lines += f"PyTuple_SetItem({py_args_var}, {idx}, {generate_py_arg_inner(raw_arg, arg_type)});\n"
  File "/data/users/binbao/pytorch/torch/_inductor/codegen/cpp_wrapper_cpu.py", line 2120, in generate_py_arg_inner
    return f"PyCapsule_New(reinterpret_cast<void*>({raw_arg.codegen_reference()}.get()), NULL, NULL)"
torch._dynamo.exc.BackendCompilerFailed: backend='compile_fx_wrapper' raised:
AttributeError: 'int' object has no attribute 'codegen_reference'

cc @chenyang78 @penguinwu

Metadata

Metadata

Assignees

Labels

module: aotinductoraot inductortriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions