Skip to content

Commit fd383c8

Browse files
committed
Add more cases in intel gpu ci
1 parent 5647df9 commit fd383c8

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

.github/scripts/ci_test_xpu.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,7 @@ pytest -v -s --ignore=torchao/test/quantization/pt2e/test_x86inductor_fusion.py
2323
torchao/test/float8/ \
2424
torchao/test/integration/test_integration.py \
2525
torchao/test/prototype/ \
26-
torchao/test/quantization/quantize_/workflows/
26+
torchao/test/quantization/quantize_/workflows/ \
27+
torchao/test/core/test_config.py \
28+
torchao/test/test_model_architecture.py \
29+
torchao/test/test_utils.py

test/test_utils.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import torch
1010
import torch.nn.functional as F
1111

12-
from torchao.testing.utils import skip_if_no_cuda
1312
from torchao.utils import TorchAOBaseTensor, torch_version_at_least
1413

1514

@@ -128,14 +127,15 @@ def _test_default_impls_helper(self, lp_tensor, lp_tensor_for_copy):
128127
self.assertTrue(torch.equal(lp_tensor.qdata, reconstructed.qdata))
129128
self.assertEqual(lp_tensor.attr, reconstructed.attr)
130129

130+
device = torch.accelerator.current_accelerator()
131131
# test _get_to_kwargs
132-
_ = lp_tensor._get_to_kwargs(torch.strided, device="cuda")
133-
_ = lp_tensor._get_to_kwargs(layout=torch.strided, device="cuda")
132+
_ = lp_tensor._get_to_kwargs(torch.strided, device=device)
133+
_ = lp_tensor._get_to_kwargs(layout=torch.strided, device=device)
134134

135135
# `to` / `_to_copy`
136136
original_device = lp_tensor.device
137-
lp_tensor = lp_tensor.to("cuda")
138-
self.assertEqual(lp_tensor.device.type, "cuda")
137+
lp_tensor = lp_tensor.to(device)
138+
self.assertEqual(lp_tensor.device.type, device.type)
139139
lp_tensor = lp_tensor.to(original_device)
140140
self.assertEqual(lp_tensor.device, original_device)
141141

@@ -218,7 +218,7 @@ def _test_default_impls_helper(self, lp_tensor, lp_tensor_for_copy):
218218
getattr(lp_tensor, tensor_attribute_name),
219219
)
220220

221-
@skip_if_no_cuda()
221+
@unittest.skipIf(not torch.accelerator.is_available(), "Need CUDA available")
222222
def test_default_impls(self):
223223
"""Making sure some common functions has default implementations, such as
224224
__tensor_unflatten__, __tensor_flatten__, _apply_fn_to_data, __repr__, to
@@ -248,7 +248,7 @@ def __init__(self, qdata, attr, device):
248248
lp_tensor_for_copy = MyTensor(another_tensor, "attr", None)
249249
self._test_default_impls_helper(lp_tensor, lp_tensor_for_copy)
250250

251-
@skip_if_no_cuda()
251+
@unittest.skipIf(not torch.accelerator.is_available(), "Need GPU available")
252252
def test_default_impls_with_optional_data(self):
253253
class MyTensorWithOptionalData(TorchAOBaseTensor):
254254
tensor_data_names = ["qdata"]
@@ -285,7 +285,7 @@ def __init__(self, qdata, attr, device, zero_point=None):
285285
)
286286
self._test_default_impls_helper(lp_tensor, lp_tensor_for_copy)
287287

288-
@skip_if_no_cuda()
288+
@unittest.skipIf(not torch.accelerator.is_available(), "Need GPU available")
289289
def test_default_impls_with_optional_attr(self):
290290
class MyTensorWithOptionalData(TorchAOBaseTensor):
291291
tensor_data_names = ["qdata"]

0 commit comments

Comments
 (0)