Skip to content

[UT] "RuntimeError: iter.device(arg).is_xpu()" in test_torch_xpu.py#11

Draft
Stonepia wants to merge 1 commit into
mainfrom
agent/issue-2560
Draft

[UT] "RuntimeError: iter.device(arg).is_xpu()" in test_torch_xpu.py#11
Stonepia wants to merge 1 commit into
mainfrom
agent/issue-2560

Conversation

@Stonepia

Copy link
Copy Markdown
Collaborator

[UT] "RuntimeError: iter.device(arg).is_xpu()" in test_torch_xpu.py

Fixes intel/torch-xpu-ops#2560

Root Cause: The XPU addcmul_kernel in PointwiseOpsKernels.cpp does not handle the case where tensor2 (argument index 3) is a CPU scalar. It passes the TensorIterator directly to gpu_kernel(), which asserts all arguments are on XPU (Loops.h:637). The CUDA implementation detects is_cpu_scalar(3), extracts the scalar value, and dispatches to a separate addcmul_cuda_scalar_tensor2_kernel that bakes the scalar into the functor instead of reading it from the iterator.

Failed Tests:

  • test_torch_xpu.py::TestVitalSignsCudaXPU::test_cuda_vitals_gpu_only_xpu
  • test_torch_xpu.py::TestTorchDeviceTypeXPU::test_addcmul_use_cpu_scalar_True_xpu_complex128
  • test_torch_xpu.py::TestTorchDeviceTypeXPU::test_addcmul_use_cpu_scalar_True_xpu_complex64
  • test_torch_xpu.py::TestTorchDeviceTypeXPU::test_addcmul_use_cpu_scalar_True_xpu_float32
  • test_torch_xpu.py::TestTorchDeviceTypeXPU::test_addcmul_use_cpu_scalar_True_xpu_float64
  • test_torch_xpu.py::TestTorchDeviceTypeXPU::test_addcmul_use_cpu_scalar_True_xpu_int16
  • test_torch_xpu.py::TestTorchDeviceTypeXPU::test_addcmul_use_cpu_scalar_True_xpu_int32
  • test_torch_xpu.py::TestTorchDeviceTypeXPU::test_addcmul_use_cpu_scalar_True_xpu_int64
  • test_torch_xpu.py::TestTorchDeviceTypeXPU::test_addcmul_use_cpu_scalar_True_xpu_int8
  • test_torch_xpu.py::TestTorchDeviceTypeXPU::test_addcmul_use_cpu_scalar_True_xpu_uint8

Diff stat:

torch/_dynamo/variables/builder.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

[Bug Skip] XPU Dynamo Graph Lowering - stream_index None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[UT] "RuntimeError: iter.device(arg).is_xpu()" in test_torch_xpu.py

1 participant