已关闭
[Bug]: ascendc用例依赖cann版本,门禁fail #4684
LucciC创建于  9 天前关闭于  7 天前
LucciC
LucciC成员
9 天前 创建

在提交新问题之前,请确保您已经在社区中搜索过相关问题,并使用了社区中提供的资源/工具后,仍未找到满意的解决方式。

⚠️ 安全信息提醒:请仔细检查提供的文本内容,确保其不包含敏感数据信息,包括但不限于:

  • API 令牌或密钥
  • 密码或身份验证凭证
  • 私有网址或接口地址
  • 个人或机密数据
  • ...

在分享配置信息或代码示例时,请将敏感信息脱敏处理,或使用 <TOKEN> 等占位符替代原有内容。

环境信息

例如:
- 操作系统 arm64
- 昇腾硬件信息 910B
- CANN软件版本 cann9.2.0
- 安装的对应软件版本 torh_npu 2.9.0

🐛 问题描述

报错现象

ascendc用例门禁报错:

Selected tests: _inductor/ascendc/test_ascendc_basic
Running _inductor/ascendc/test_ascendc_basic ... [2026-09-07 14:43:54.856043+00:00]
Executing ['/opt/_internal/cpython-3.10.19/bin/python3.10', '_inductor/ascendc/test_ascendc_basic.py', '-v'] ... [2026-09-07 14:43:54.856433+00:00]
test_mul_sub_float16 (__main__.TestAscendcBasic)
Pointwise pattern: compiled output matches eager. ... [W907 22:44:02.641166294 NPUCachingAllocator.cpp:204] Warning: The current CANN and Soc versions require processing for 32 padding size, with memory allocation. (function operator())
ERROR
test_mul_sub_float32 (__main__.TestAscendcBasic)
Pointwise pattern: compiled output matches eager. ... ERROR

======================================================================
ERROR: test_mul_sub_float16 (__main__.TestAscendcBasic)
Pointwise pattern: compiled output matches eager.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/testing/_internal/common_utils.py", line 3224, in wrapper
method(*args, **kwargs)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/testing/_internal/common_utils.py", line 553, in instantiated_test
test(self, **param_kwargs)
File "/workspace/CODE/test/_inductor/ascendc/test_ascendc_basic.py", line 30, in test_mul_sub
compiled_out = compiled_fn(x, y)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_dynamo/eval_frame.py", line 845, in compile_wrapper
raise e.remove_dynamo_frames() from None  # see TORCHDYNAMO_VERBOSE=1
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 2196, in _call_user_compiler
raise BackendCompilerFailed(
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 2171, in _call_user_compiler
compiled_fn = compiler_fn(gm, example_inputs)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_dynamo/repro/after_dynamo.py", line 156, in __call__
compiled_gm = compiler_fn(gm, example_inputs)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch_npu/utils/_dynamo.py", line 579, in new_call
return src_call(self, model_, inputs_)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/__init__.py", line 2392, in __call__
return compile_fx(model_, inputs_, config_patches=self.config)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 2413, in compile_fx
return compile_fx(
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 2681, in compile_fx
return aot_autograd(
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_dynamo/backends/common.py", line 117, in __call__
cg = aot_module_simplified(gm, example_inputs, **self.kwargs)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 1106, in aot_module_simplified
compiled_fn, _ = aot_stage2_compile(aot_state, aot_graph_capture)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/graph_compile.py", line 242, in aot_stage2_compile
return aot_stage2_inference(aot_state, aot_graph_capture)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/graph_compile.py", line 315, in aot_stage2_inference
compiled_fw = compiler(fw_module, updated_flat_args)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/schemas.py", line 1251, in __call__
return self.compiler_fn(gm, example_inputs)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 2558, in fw_compiler_base
return compile_fx_forward(
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 2275, in compile_fx_forward
return inner_compile(
File "/opt/_internal/cpython-3.10.19/lib/python3.10/contextlib.py", line 79, in inner
return func(*args, **kwds)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 782, in compile_fx_inner
return wrap_compiler_debug(_compile_fx_inner, compiler_name="inductor")(
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_dynamo/repro/after_aot.py", line 144, in debug_wrapper
inner_compiled_fn = compiler_fn(gm, example_inputs)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 963, in _compile_fx_inner
mb_compiled_graph = fx_codegen_and_compile(
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 1695, in fx_codegen_and_compile
return scheme.codegen_and_compile(gm, example_inputs, inputs_to_check, graph_kwargs)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 1505, in codegen_and_compile
compiled_module = graph.compile_to_module()
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/graph.py", line 2319, in compile_to_module
return self._compile_to_module()
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/graph.py", line 2325, in _compile_to_module
self.codegen_with_cpp_wrapper() if self.cpp_wrapper else self.codegen()
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/graph.py", line 2264, in codegen
self.scheduler.codegen()
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/scheduler.py", line 5205, in codegen
self._codegen_partitions()
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/scheduler.py", line 5345, in _codegen_partitions
self._codegen(partition)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/scheduler.py", line 5443, in _codegen
self.get_backend(device).codegen_node(node)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch_npu/_inductor/ascendc/npu.py", line 3763, in codegen_node
self.codegen_nodes(node.get_nodes())
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch_npu/_inductor/ascendc/npu.py", line 3808, in codegen_nodes
kernel_code = kernel.codegen()
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch_npu/_inductor/ascendc/npu.py", line 982, in codegen
artifacts = npu_codegen.codegen_kernel_def(self.fused_graph)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch_npu/_inductor/ascendc/codegen/__init__.py", line 8, in codegen_kernel_def
return _codegen_kernel_def(graph)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch_npu/_inductor/ascendc/codegen/_asc_codegen.py", line 297, in codegen_kernel_def
raise RuntimeError(f"Failed to execute graph code:{graph_py_code.getvalue()} {e}") from e
torch._dynamo.exc.BackendCompilerFailed: backend='inductor' raised:
RuntimeError: Failed to execute graph code:from autofuse.pyautofuse import ascir
from autofuse.pyautofuse import Autofuser, AutofuserOptions

def Mod(x, y):
return x % y
def PythonMod(x, y):
return x % y
# --------------------graph--------------------
'''
<Node %buf0% body>:
# Topologically Sorted Source Nodes: [mul, sub], Original ATen: [aten.mul, aten.sub]
# Source node to ATen node mapping:
#   mul => mul
#   sub => sub
# Graph fragment:
#   %arg0_1 : Tensor "f16[64, 64][64, 1]npu:0" = PlaceHolder[target=arg0_1]
#   %arg1_1 : Tensor "f16[64, 64][64, 1]npu:0" = PlaceHolder[target=arg1_1]
#   %mul : Tensor "f16[64, 64][64, 1]npu:0"[num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%arg0_1, %arg1_1), kwargs = {})
#   %sub : Tensor "f16[64, 64][64, 1]npu:0"[num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul, %arg0_1), kwargs = {})
#   return %sub
op0: SchedulerNode(ComputedBuffer)
op0.writes = [MemoryDep('buf0', c0, {c0: 4096})]
op0.unmet_dependencies = []
op0.met_dependencies = [MemoryDep('arg0_1', c0, {c0: 4096}), MemoryDep('arg1_1', c0, {c0: 4096})]
op0.outputs = [
buf0: ComputedBuffer
buf0.layout = FixedLayout('npu:0', torch.float16, size=[64, 64], stride=[64, 1])
buf0.users = [NodeUser(node=OUTPUT, can_inplace=False, is_weak=False)]
]
op0.group.device = npu:0
op0.group.iteration = (4096, 1)
op0.sizes = ([4096], [])
arg0_1_layout = FixedLayout('npu:0', torch.float16, size=[64, 64], stride=[64, 1])
arg1_1_layout = FixedLayout('npu:0', torch.float16, size=[64, 64], stride=[64, 1])
buf0_layout = FixedLayout('npu:0', torch.float16, size=[64, 64], stride=[64, 1])
class op0_loop_body:
var_ranges = {p0: 4096}
index0 = p0
def body(self, ops):
get_index = self.get_index('index0')
load = ops.load('arg0_1', get_index)
get_index_1 = self.get_index('index0')
load_1 = ops.load('arg1_1', get_index_1)
mul = ops.mul(load, load_1)
get_index_2 = self.get_index('index0')
load_2 = ops.load('arg0_1', get_index_2)
sub = ops.sub(mul, load_2)
get_index_3 = self.get_index('index0')
store = ops.store('buf0', get_index_3, sub, None)
return store
'''
graph_hint = ascir.HintGraph('graph_hint')
a0 = graph_hint.create_axis("a0", 4096)
graph_hint.sched.axis = [a0]
data = ascir.ops.Data('graph_hint/data', graph_hint)
data.attr.ir_attr.index = 0
data.y.dtype = ascir.dtypes.float16
load = ascir.ops.Load('graph_hint/load', graph_hint)
load.attr.ir_attr.offset = 0
load.x = data.y
load.y.axis = [a0]
load.y.size = [4096]
load.y.strides = [1]
cast = ascir.ops.Cast('graph_hint/cast', graph_hint)
cast.x = load.y
cast.y.dtype = ascir.dtypes.float32
cast.y.axis = [a0]
cast.y.size = [4096]
cast.y.strides = [1]
data1 = ascir.ops.Data('graph_hint/data1', graph_hint)
data1.attr.ir_attr.index = 1
data1.y.dtype = ascir.dtypes.float16
load1 = ascir.ops.Load('graph_hint/load1', graph_hint)
load1.attr.ir_attr.offset = 0
load1.x = data1.y
load1.y.axis = [a0]
load1.y.size = [4096]
load1.y.strides = [1]
cast1 = ascir.ops.Cast('graph_hint/cast1', graph_hint)
cast1.x = load1.y
cast1.y.dtype = ascir.dtypes.float32
cast1.y.axis = [a0]
cast1.y.size = [4096]
cast1.y.strides = [1]
mul = ascir.ops.Mul('graph_hint/mul', graph_hint)
mul.x1 = cast.y
mul.x2 = cast1.y
mul.y.axis = [a0]
mul.y.size = [4096]
mul.y.strides = [1]
sub = ascir.ops.Sub('graph_hint/sub', graph_hint)
sub.x1 = mul.y
sub.x2 = cast.y
sub.y.axis = [a0]
sub.y.size = [4096]
sub.y.strides = [1]
cast2 = ascir.ops.Cast('graph_hint/cast2', graph_hint)
cast2.x = sub.y
cast2.y.dtype = ascir.dtypes.float32
cast2.y.axis = [a0]
cast2.y.size = [4096]
cast2.y.strides = [1]
cast3 = ascir.ops.Cast('graph_hint/cast3', graph_hint)
cast3.x = cast2.y
cast3.y.dtype = ascir.dtypes.float16
cast3.y.axis = [a0]
cast3.y.size = [4096]
cast3.y.strides = [1]
store = ascir.ops.Store('graph_hint/store', graph_hint)
store.x = cast3.y
store.attr.ir_attr.offset = 0
store.y.axis = [a0]
store.y.size = [4096]
store.y.strides = [1]
output = ascir.ops.Output('graph_hint/output', graph_hint)
output.attr.ir_attr.index = 0
output.x = store.y
output.y.dtype = ascir.dtypes.float16
graph_hint.infer_dtypes()
# --------------------autofused_mul_sub_6a04f1a39991809a0c199263411def4e--------------------
autofused_mul_sub_6a04f1a39991809a0c199263411def4e = ascir.FusedGraph('autofused_mul_sub_6a04f1a39991809a0c199263411def4e')
graph = ascir.ops.AscBackend('graph', graph_hint, autofused_mul_sub_6a04f1a39991809a0c199263411def4e)
input0 = ascir.ops.Data('input0', autofused_mul_sub_6a04f1a39991809a0c199263411def4e)
input0.attr.ir_attr.index = 0
input1 = ascir.ops.Data('input1', autofused_mul_sub_6a04f1a39991809a0c199263411def4e)
input1.attr.ir_attr.index = 1
output0 = graph.y[0]
graph.x = [input0, input1]
graph_output0 = ascir.ops.Output('output0', autofused_mul_sub_6a04f1a39991809a0c199263411def4e)
graph_output0.attr.ir_attr.index = 0
graph_output0.x = [output0]

fuser = Autofuser(AutofuserOptions(graph_type=1))
scheduled_autofused_mul_sub_6a04f1a39991809a0c199263411def4e = fuser.schedule(autofused_mul_sub_6a04f1a39991809a0c199263411def4e)
tiling_def, host_impl, device_impl = fuser.codegen(scheduled_autofused_mul_sub_6a04f1a39991809a0c199263411def4e)
'HintGraph' object has no attribute 'sched'

Set TORCHDYNAMO_VERBOSE=1 for the internal stack trace (please do this especially if you're reporting a bug to PyTorch). For even more developer context, set TORCH_LOGS="+dynamo"


To execute this test, run the following from the base repo dir:
python test/_inductor/ascendc/test_ascendc_basic.py TestAscendcBasic.test_mul_sub_float16

This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0

======================================================================
ERROR: test_mul_sub_float32 (__main__.TestAscendcBasic)
Pointwise pattern: compiled output matches eager.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/testing/_internal/common_utils.py", line 3224, in wrapper
method(*args, **kwargs)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/testing/_internal/common_utils.py", line 553, in instantiated_test
test(self, **param_kwargs)
File "/workspace/CODE/test/_inductor/ascendc/test_ascendc_basic.py", line 30, in test_mul_sub
compiled_out = compiled_fn(x, y)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_dynamo/eval_frame.py", line 845, in compile_wrapper
raise e.remove_dynamo_frames() from None  # see TORCHDYNAMO_VERBOSE=1
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 2196, in _call_user_compiler
raise BackendCompilerFailed(
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 2171, in _call_user_compiler
compiled_fn = compiler_fn(gm, example_inputs)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_dynamo/repro/after_dynamo.py", line 156, in __call__
compiled_gm = compiler_fn(gm, example_inputs)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch_npu/utils/_dynamo.py", line 579, in new_call
return src_call(self, model_, inputs_)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/__init__.py", line 2392, in __call__
return compile_fx(model_, inputs_, config_patches=self.config)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 2413, in compile_fx
return compile_fx(
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 2681, in compile_fx
return aot_autograd(
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_dynamo/backends/common.py", line 117, in __call__
cg = aot_module_simplified(gm, example_inputs, **self.kwargs)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 1106, in aot_module_simplified
compiled_fn, _ = aot_stage2_compile(aot_state, aot_graph_capture)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/graph_compile.py", line 242, in aot_stage2_compile
return aot_stage2_inference(aot_state, aot_graph_capture)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/graph_compile.py", line 315, in aot_stage2_inference
compiled_fw = compiler(fw_module, updated_flat_args)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/schemas.py", line 1251, in __call__
return self.compiler_fn(gm, example_inputs)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 2558, in fw_compiler_base
return compile_fx_forward(
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 2275, in compile_fx_forward
return inner_compile(
File "/opt/_internal/cpython-3.10.19/lib/python3.10/contextlib.py", line 79, in inner
return func(*args, **kwds)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 782, in compile_fx_inner
return wrap_compiler_debug(_compile_fx_inner, compiler_name="inductor")(
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_dynamo/repro/after_aot.py", line 144, in debug_wrapper
inner_compiled_fn = compiler_fn(gm, example_inputs)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 963, in _compile_fx_inner
mb_compiled_graph = fx_codegen_and_compile(
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 1695, in fx_codegen_and_compile
return scheme.codegen_and_compile(gm, example_inputs, inputs_to_check, graph_kwargs)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 1505, in codegen_and_compile
compiled_module = graph.compile_to_module()
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/graph.py", line 2319, in compile_to_module
return self._compile_to_module()
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/graph.py", line 2325, in _compile_to_module
self.codegen_with_cpp_wrapper() if self.cpp_wrapper else self.codegen()
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/graph.py", line 2264, in codegen
self.scheduler.codegen()
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/scheduler.py", line 5205, in codegen
self._codegen_partitions()
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/scheduler.py", line 5345, in _codegen_partitions
self._codegen(partition)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch/_inductor/scheduler.py", line 5443, in _codegen
self.get_backend(device).codegen_node(node)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch_npu/_inductor/ascendc/npu.py", line 3763, in codegen_node
self.codegen_nodes(node.get_nodes())
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch_npu/_inductor/ascendc/npu.py", line 3808, in codegen_nodes
kernel_code = kernel.codegen()
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch_npu/_inductor/ascendc/npu.py", line 982, in codegen
artifacts = npu_codegen.codegen_kernel_def(self.fused_graph)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch_npu/_inductor/ascendc/codegen/__init__.py", line 8, in codegen_kernel_def
return _codegen_kernel_def(graph)
File "/opt/_internal/cpython-3.10.19/lib/python3.10/site-packages/torch_npu/_inductor/ascendc/codegen/_asc_codegen.py", line 297, in codegen_kernel_def
raise RuntimeError(f"Failed to execute graph code:{graph_py_code.getvalue()} {e}") from e
torch._dynamo.exc.BackendCompilerFailed: backend='inductor' raised:
RuntimeError: Failed to execute graph code:from autofuse.pyautofuse import ascir
from autofuse.pyautofuse import Autofuser, AutofuserOptions

def Mod(x, y):
return x % y
def PythonMod(x, y):
return x % y
# --------------------graph--------------------
'''
<Node %buf0% body>:
# Topologically Sorted Source Nodes: [mul, sub], Original ATen: [aten.mul, aten.sub]
# Source node to ATen node mapping:
#   mul => mul
#   sub => sub
# Graph fragment:
#   %arg0_1 : Tensor "f32[64, 64][64, 1]npu:0" = PlaceHolder[target=arg0_1]
#   %arg1_1 : Tensor "f32[64, 64][64, 1]npu:0" = PlaceHolder[target=arg1_1]
#   %mul : Tensor "f32[64, 64][64, 1]npu:0"[num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%arg0_1, %arg1_1), kwargs = {})
#   %sub : Tensor "f32[64, 64][64, 1]npu:0"[num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul, %arg0_1), kwargs = {})
#   return %sub
op0: SchedulerNode(ComputedBuffer)
op0.writes = [MemoryDep('buf0', c0, {c0: 4096})]
op0.unmet_dependencies = []
op0.met_dependencies = [MemoryDep('arg0_1', c0, {c0: 4096}), MemoryDep('arg1_1', c0, {c0: 4096})]
op0.outputs = [
buf0: ComputedBuffer
buf0.layout = FixedLayout('npu:0', torch.float32, size=[64, 64], stride=[64, 1])
buf0.users = [NodeUser(node=OUTPUT, can_inplace=False, is_weak=False)]
]
op0.group.device = npu:0
op0.group.iteration = (4096, 1)
op0.sizes = ([4096], [])
arg0_1_layout = FixedLayout('npu:0', torch.float32, size=[64, 64], stride=[64, 1])
arg1_1_layout = FixedLayout('npu:0', torch.float32, size=[64, 64], stride=[64, 1])
buf0_layout = FixedLayout('npu:0', torch.float32, size=[64, 64], stride=[64, 1])
class op0_loop_body:
var_ranges = {p0: 4096}
index0 = p0
def body(self, ops):
get_index = self.get_index('index0')
load = ops.load('arg0_1', get_index)
get_index_1 = self.get_index('index0')
load_1 = ops.load('arg1_1', get_index_1)
mul = ops.mul(load, load_1)
get_index_2 = self.get_index('index0')
load_2 = ops.load('arg0_1', get_index_2)
sub = ops.sub(mul, load_2)
get_index_3 = self.get_index('index0')
store = ops.store('buf0', get_index_3, sub, None)
return store
'''
graph_hint = ascir.HintGraph('graph_hint')
a0 = graph_hint.create_axis("a0", 4096)
graph_hint.sched.axis = [a0]
data = ascir.ops.Data('graph_hint/data', graph_hint)
data.attr.ir_attr.index = 0
data.y.dtype = ascir.dtypes.float32
load = ascir.ops.Load('graph_hint/load', graph_hint)
load.attr.ir_attr.offset = 0
load.x = data.y
load.y.axis = [a0]
load.y.size = [4096]
load.y.strides = [1]
data1 = ascir.ops.Data('graph_hint/data1', graph_hint)
data1.attr.ir_attr.index = 1
data1.y.dtype = ascir.dtypes.float32
load1 = ascir.ops.Load('graph_hint/load1', graph_hint)
load1.attr.ir_attr.offset = 0
load1.x = data1.y
load1.y.axis = [a0]
load1.y.size = [4096]
load1.y.strides = [1]
mul = ascir.ops.Mul('graph_hint/mul', graph_hint)
mul.x1 = load.y
mul.x2 = load1.y
mul.y.axis = [a0]
mul.y.size = [4096]
mul.y.strides = [1]
sub = ascir.ops.Sub('graph_hint/sub', graph_hint)
sub.x1 = mul.y
sub.x2 = load.y
sub.y.axis = [a0]
sub.y.size = [4096]
sub.y.strides = [1]
store = ascir.ops.Store('graph_hint/store', graph_hint)
store.x = sub.y
store.attr.ir_attr.offset = 0
store.y.axis = [a0]
store.y.size = [4096]
store.y.strides = [1]
output = ascir.ops.Output('graph_hint/output', graph_hint)
output.attr.ir_attr.index = 0
output.x = store.y
output.y.dtype = ascir.dtypes.float32
graph_hint.infer_dtypes()
# --------------------autofused_mul_sub_c2f158ab64194569d4354581b31da095--------------------
autofused_mul_sub_c2f158ab64194569d4354581b31da095 = ascir.FusedGraph('autofused_mul_sub_c2f158ab64194569d4354581b31da095')
graph = ascir.ops.AscBackend('graph', graph_hint, autofused_mul_sub_c2f158ab64194569d4354581b31da095)
input0 = ascir.ops.Data('input0', autofused_mul_sub_c2f158ab64194569d4354581b31da095)
input0.attr.ir_attr.index = 0
input1 = ascir.ops.Data('input1', autofused_mul_sub_c2f158ab64194569d4354581b31da095)
input1.attr.ir_attr.index = 1
output0 = graph.y[0]
graph.x = [input0, input1]
graph_output0 = ascir.ops.Output('output0', autofused_mul_sub_c2f158ab64194569d4354581b31da095)
graph_output0.attr.ir_attr.index = 0
graph_output0.x = [output0]

fuser = Autofuser(AutofuserOptions(graph_type=1))
scheduled_autofused_mul_sub_c2f158ab64194569d4354581b31da095 = fuser.schedule(autofused_mul_sub_c2f158ab64194569d4354581b31da095)
tiling_def, host_impl, device_impl = fuser.codegen(scheduled_autofused_mul_sub_c2f158ab64194569d4354581b31da095)
'HintGraph' object has no attribute 'sched'

Set TORCHDYNAMO_VERBOSE=1 for the internal stack trace (please do this especially if you're reporting a bug to PyTorch). For even more developer context, set TORCH_LOGS="+dynamo"


To execute this test, run the following from the base repo dir:
python test/_inductor/ascendc/test_ascendc_basic.py TestAscendcBasic.test_mul_sub_float32

This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0

----------------------------------------------------------------------
Ran 2 tests in 6.243s

FAILED (errors=2)
exec ut _inductor/ascendc/test_ascendc_basic failed!
exec ut _inductor/ascendc/test_ascendc_basic failed!
***** Total result:
exec ut _inductor/ascendc/test_ascendc_basic failed. [52.2s]

原因分析:

ascendir标准化导致的,需要cann升级解决。

欢迎加入社区,感谢您对社区的贡献 🎉!

likedislike
LucciCLucciC成员
9 天前 添加了label:bug
TorchNPU-BotTorchNPU-Bot成员
9 天前 添加了label:triage-review
TorchNPU-Bot
TorchNPU-Bot成员
9 天前 评论:

issue待分派,添加triage-review标签

likedislike
LucciCLucciC成员
9 天前 将 LucciC 设为负责人
LucciCLucciC成员
9 天前 将 rich9527 设为负责人
LucciCLucciC成员
9 天前 关联了pull request:[test] skip ascendc inductor tests for issue 4684
TorchNPU-BotTorchNPU-Bot成员
9 天前 添加了label:bot-triaged;删除了label:triage-review
TorchNPU-Bot
TorchNPU-Bot成员
9 天前 评论:

检测到当前 issue 已关联 PR,自动添加标签:bot-triaged

likedislike
LucciCLucciC成员
9 天前 关联了pull request:[test] skip ascendc inductor tests for issue 4684
LucciCLucciC成员
9 天前 关联了pull request:[test] skip ascendc inductor tests for issue 4684
LucciCLucciC成员
7 天前 issue状态由 TODO 改变为 DONE
LucciCLucciC成员
7 天前 关闭了 issue
ascend-robotascend-robot成员
7 天前 添加了label:resolved