Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/ATen/native/xpu/XPUFallback.template
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@ namespace at {
static bool DEBUG_XPU_FALLBACK = false;

/*
* Verifies that all input tensors reside on the same device type.
* Verifies that all input tensors reside on the same device
* (including device index, e.g., xpu:0 vs xpu:1).
* The first defined tensor establishes the reference device;
* all subsequent tensors must match it.
* Raises an error if a mismatch (e.g., CPU vs. XPU) is detected.
* Raises an error if a mismatch (e.g., CPU vs. XPU, or xpu:0 vs. xpu:1) is detected.
*/
static void check_device_consistency(
const torch::jit::Stack* stack,
const c10::OperatorHandle& op) {
std::optional<c10::DeviceType> reference_device;
std::optional<c10::Device> reference_device;

auto check_tensor = [&](const at::Tensor& t) {
if (!t.defined()) return;

auto cur_device = t.device().type();
auto cur_device = t.device();
if (!reference_device) {
reference_device = cur_device;
return;
Expand Down
2 changes: 0 additions & 2 deletions test/xpu/test_sparse_csr_xpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
OpDTypes,
ops,
precisionOverride,
skipCPUIf,
skipCPUIfNoMklSparse,
skipCUDAIf,
skipCUDAIfNoSparseGeneric,
Expand Down Expand Up @@ -1301,7 +1300,6 @@ def values(lst, device=device):
subtest("sparse_compressed_tensor_no_size"),
],
)
@skipCPUIf(True, "https://github.com/intel/torch-xpu-ops/issues/2229")
def test_invalid_input(self, layout, device, target):
for (
label,
Expand Down
Loading