[TEST][XPU][CI] Fix ci uva kernel test instability 2 (#60404)

Signed-off-by: microslaw <milosz.grunwald@intel.com>
Co-authored-by: Kunshang Ji <kunshang.ji@intel.com>
This commit is contained in:
Miłosz Grunwald
2026-10-10 12:09:13 +08:00
committed by GitHub
co-authored by Kunshang Ji
parent f1a3c60558
commit be0823357f
+6
View File
@@ -21,6 +21,9 @@ DEVICES = [
@pytest.mark.parametrize("device", DEVICES)
def test_cpu_write(device):
torch.set_default_device(device)
# Initializes the device; otherwise torch.accelerator.synchronize() is a no-op,
# as the UVA view's ops never trigger lazy init.
torch.accelerator.set_device_index(device)
cpu_tensor = torch.zeros(10, 10, device="cpu", pin_memory=True, dtype=torch.int32)
gpu_view = get_accelerator_view_from_cpu_tensor(cpu_tensor)
assert gpu_view.device.type == DEVICE_TYPE
@@ -44,6 +47,9 @@ def test_cpu_write(device):
@pytest.mark.parametrize("device", DEVICES)
def test_gpu_write(device):
torch.set_default_device(device)
# Initializes the device; otherwise torch.accelerator.synchronize() is a no-op,
# as the UVA view's ops never trigger lazy init.
torch.accelerator.set_device_index(device)
cpu_tensor = torch.zeros(10, 10, device="cpu", pin_memory=True, dtype=torch.int32)
gpu_view = get_accelerator_view_from_cpu_tensor(cpu_tensor)
assert gpu_view.device.type == DEVICE_TYPE