Compare commits

...

4 Commits

Author SHA1 Message Date
2a87efebbe add test_noncontiguous_samples_skips for xpu 2025-11-13 08:07:16 +00:00
2aa9a642a6 Enable the rest of the test of TestCommom
Remove decorators for skips as the feature is ready now.
2025-11-12 03:42:05 +00:00
9e9ed67d8d Add an ops_skips dict to record the xpu unsupported ops in test_out. 2025-11-12 03:42:05 +00:00
dbe654f990 enable more tests in test_ops.TestCommon on Intel GPU 2025-11-12 03:42:04 +00:00
4 changed files with 123 additions and 29 deletions

View File

@ -101,6 +101,34 @@ _ref_test_ops = tuple(
)
)
test_out_skips = defaultdict(dict)
test_out_skips["xpu"] = {
"_native_batch_norm_legit": {torch.float32},
"addmv": {torch.float32},
"cholesky_inverse": {torch.float32},
"geqrf": {torch.float32},
"histc": {torch.float32},
"mean": {torch.float32},
"mv": {torch.float32},
"narrow_copy": {torch.float32},
"native_batch_norm": {torch.float32},
"nn.functional.avg_pool2d": {torch.float32},
"torch.ops.aten._flash_attention_forward": {torch.float16},
"var": {torch.float32},
}
test_noncontiguous_samples_skips = defaultdict(dict)
# Disable cases for https://github.com/intel/torch-xpu-ops/issues/2295
test_noncontiguous_samples_skips["xpu"] = {
"masked.amax": {torch.int64},
"masked.amin": {torch.int64},
"nn.functional.interpolate": {torch.float32},
"amax": {torch.int64},
"masked.prod": {torch.int64},
}
def reduction_dtype_filter(op):
if (
@ -460,8 +488,6 @@ class TestCommon(TestCase):
# NumPy does computation internally using double precision for many functions
# resulting in possible equality check failures.
# skip windows case on CPU due to https://github.com/pytorch/pytorch/issues/129947
# XPU test will be enabled step by step. Skip the tests temporarily.
@skipXPU
@onlyNativeDeviceTypesAnd(["hpu"])
@suppress_warnings
@ops(_ref_test_ops, allowed_dtypes=(torch.float64, torch.long, torch.complex128))
@ -516,7 +542,6 @@ class TestCommon(TestCase):
# Tests that experimental Python References can propagate shape, dtype,
# and device metadata properly.
# See https://github.com/pytorch/pytorch/issues/78050 for a discussion of stride propagation.
@skipXPU
@onlyNativeDeviceTypesAnd(["hpu"])
@ops(python_ref_db)
@skipIfTorchInductor("Takes too long for inductor")
@ -712,7 +737,6 @@ class TestCommon(TestCase):
# Tests that experimental Python References perform the same computation
# as the operators they reference, when operator calls in the torch
# namespace are remapped to the refs namespace (torch.foo becomes refs.foo).
@skipXPU
@onlyNativeDeviceTypesAnd(["hpu"])
@ops(python_ref_db)
@skipIfTorchInductor("Takes too long for inductor")
@ -731,7 +755,6 @@ class TestCommon(TestCase):
# Tests that experimental Python References perform the same computation
# as the operators they reference, when operator calls in the torch
# namespace are preserved (torch.foo remains torch.foo).
@skipXPU
@onlyNativeDeviceTypesAnd(["hpu"])
@ops(python_ref_db)
@skipIfTorchInductor("Takes too long for inductor")
@ -767,7 +790,6 @@ class TestCommon(TestCase):
op.op = partial(make_traced(op.op), executor=executor)
self._ref_test_helper(contextlib.nullcontext, device, dtype, op)
@skipXPU
@skipMeta
@onlyNativeDeviceTypesAnd(["hpu"])
@ops([op for op in op_db if op.error_inputs_func is not None], dtypes=OpDTypes.none)
@ -803,7 +825,6 @@ class TestCommon(TestCase):
out = op(si.input, *si.args, **si.kwargs)
self.assertFalse(isinstance(out, type(NotImplemented)))
@skipXPU
@skipMeta
@onlyNativeDeviceTypesAnd(["hpu"])
@ops(
@ -830,12 +851,17 @@ class TestCommon(TestCase):
# Tests that the function produces the same result when called with
# noncontiguous tensors.
@skipXPU
@with_tf32_off
@onlyNativeDeviceTypesAnd(["hpu"])
@suppress_warnings
@ops(op_db, allowed_dtypes=(torch.float32, torch.long, torch.complex64))
def test_noncontiguous_samples(self, device, dtype, op):
if dtype in test_noncontiguous_samples_skips[device.split(":")[0]].get(
op.name, set()
):
raise unittest.SkipTest(
f"Skipped! {op.name} does not support dtype {dtype} on {device} for this test."
)
test_grad = dtype in op.supported_backward_dtypes(torch.device(device).type)
sample_inputs = op.sample_inputs(device, dtype, requires_grad=test_grad)
for sample_input in sample_inputs:
@ -923,7 +949,6 @@ class TestCommon(TestCase):
# incorrectly sized out parameter warning properly yet
# Cases test here:
# - out= with the correct dtype and device, but the wrong shape
@skipXPU
@ops(ops_and_refs, dtypes=OpDTypes.none)
def test_out_warning(self, device, op):
if TEST_WITH_TORCHDYNAMO and op.name == "_refs.clamp":
@ -1062,9 +1087,13 @@ class TestCommon(TestCase):
# Case 3 and 4 are slightly different when the op is a factory function:
# - if device, dtype are NOT passed, any combination of dtype/device should be OK for out
# - if device, dtype are passed, device and dtype should match
@skipXPU
@ops(ops_and_refs, dtypes=OpDTypes.any_one)
def test_out(self, device, dtype, op):
if dtype in test_out_skips[device.split(":")[0]].get(op.name, set()):
raise unittest.SkipTest(
f"Skipped! {op.name} does not support dtype {dtype} on {device} for this test."
)
# Prefers running in float32 but has a fallback for the first listed supported dtype
samples = op.sample_inputs(device, dtype)
@ -1266,7 +1295,6 @@ class TestCommon(TestCase):
with self.assertRaises(exc_type, msg=msg_fail):
op_out(out=out)
@skipXPU
@ops(
[
op
@ -1305,7 +1333,6 @@ class TestCommon(TestCase):
with self.assertRaises(RuntimeError, msg=msg), maybe_skip_size_asserts(op):
op(sample.input, *sample.args, **sample.kwargs, out=out)
@skipXPU
@ops(filter(reduction_dtype_filter, ops_and_refs), dtypes=(torch.int16,))
def test_out_integral_dtype(self, device, dtype, op):
def helper(with_out, expectFail, op_to_test, inputs, *args, **kwargs):
@ -1349,7 +1376,6 @@ class TestCommon(TestCase):
# Tests that the forward and backward passes of operations produce the
# same values for the cross-product of op variants (method, inplace)
# against eager's gold standard op function variant
@skipXPU
@_variant_ops(op_db)
def test_variant_consistency_eager(self, device, dtype, op):
# Acquires variants (method variant, inplace variant, operator variant, inplace_operator variant, aliases)
@ -1530,7 +1556,6 @@ class TestCommon(TestCase):
# Reference testing for operations in complex32 against complex64.
# NOTE: We test against complex64 as NumPy doesn't have a complex32 equivalent dtype.
@skipXPU
@ops(op_db, allowed_dtypes=(torch.complex32,))
def test_complex_half_reference_testing(self, device, dtype, op):
if not op.supports_dtype(torch.complex32, device):
@ -1566,7 +1591,6 @@ class TestCommon(TestCase):
# `cfloat` input -> `float` output
self.assertEqual(actual, expected, exact_dtype=False)
@skipXPU
@ops(op_db, allowed_dtypes=(torch.bool,))
def test_non_standard_bool_values(self, device, dtype, op):
# Test boolean values other than 0x00 and 0x01 (gh-54789)
@ -1802,7 +1826,6 @@ class TestCommon(TestCase):
self.fail(msg)
# Validates that each OpInfo that sets promotes_int_to_float=True does as it says
@skipXPU
@skipMeta
@onlyNativeDeviceTypesAnd(["hpu"])
@ops(

View File

@ -28,7 +28,7 @@ from torch.testing._internal.common_device_type import \
(onlyCPU, onlyCUDA, onlyNativeDeviceTypes, disablecuDNN, skipCUDAIfNoMagma, skipCUDAIfNoMagmaAndNoCusolver,
skipCUDAIfNoCusolver, skipCPUIfNoLapack, skipCPUIfNoFFT, skipCUDAIf, precisionOverride,
skipCPUIfNoMklSparse,
toleranceOverride, tol, skipXPU)
toleranceOverride, tol)
from torch.testing._internal.common_cuda import (
PLATFORM_SUPPORTS_FLASH_ATTENTION, PLATFORM_SUPPORTS_MEM_EFF_ATTENTION,
SM53OrLater, SM80OrLater, SM89OrLater, with_tf32_off, TEST_CUDNN, _get_torch_cuda_version,
@ -39,7 +39,7 @@ from torch.testing._internal.common_utils import (
TEST_WITH_ROCM, IS_FBCODE, IS_WINDOWS, IS_MACOS, IS_S390X, TEST_SCIPY,
torch_to_numpy_dtype_dict, numpy_to_torch_dtype, TEST_WITH_ASAN,
GRADCHECK_NONDET_TOL, slowTest, TEST_WITH_SLOW,
TEST_WITH_TORCHINDUCTOR, MACOS_VERSION,
TEST_WITH_TORCHINDUCTOR, MACOS_VERSION, skipIfXpu, TEST_XPU
)
from torch.testing._utils import wrapper_set_seed
@ -6106,7 +6106,6 @@ def sample_inputs_lu_unpack(op_info, device, dtype, requires_grad=False, **kwarg
lu_data.requires_grad_(requires_grad)
yield SampleInput(lu_data, pivots).with_metadata(output_process_fn_grad=out_fn)
def sample_inputs_roll(op_info, device, dtype, requires_grad=False, **kwargs):
make_arg = partial(make_tensor, device=device, dtype=dtype, requires_grad=requires_grad)
@ -12267,6 +12266,7 @@ op_db: list[OpInfo] = [
variant_test_name='decomposed',
dtypes=all_types_and_complex_and(torch.float16, torch.bfloat16),
dtypesIfCUDA=floating_and_complex_types_and(torch.float16, torch.bfloat16),
dtypesIfXPU=floating_and_complex_types_and(torch.float16, torch.bfloat16, torch.uint8, torch.int8),
dtypesIfHpu=custom_types(torch.float32, torch.bfloat16),
assert_autodiffed=True,
supports_forward_ad=True,
@ -12289,6 +12289,8 @@ op_db: list[OpInfo] = [
dtypes=all_types_and_complex_and(torch.bfloat16, torch.float16),
dtypesIfCUDA=floating_types_and(torch.float16, torch.complex64, torch.complex128,
torch.bfloat16),
dtypesIfXPU=floating_types_and(torch.bfloat16, torch.float16, torch.complex64,
torch.complex128, torch.uint8, torch.int8),
supports_forward_ad=True,
supports_fwgrad_bwgrad=True,
decorators=[
@ -12309,6 +12311,7 @@ op_db: list[OpInfo] = [
dtypesIfCUDA=floating_and_complex_types_and(torch.float16,
*[torch.bfloat16]
if SM53OrLater or TEST_WITH_ROCM else []),
dtypesIfXPU=floating_and_complex_types_and(torch.bfloat16, torch.float16, torch.int8, torch.uint8),
dtypesIfHpu=custom_types(torch.float32, torch.bfloat16),
# Runs very slowly on slow gradcheck - alternatively reduce input sizes
gradcheck_fast_mode=True,
@ -12324,6 +12327,9 @@ op_db: list[OpInfo] = [
toleranceOverride({torch.float32: tol(atol=1.3e-04, rtol=1.3e-04),
torch.complex64: tol(atol=1e-05, rtol=1.2e-03)}),
'TestCommon', 'test_numpy_ref_mps'),
DecorateInfo(
toleranceOverride({torch.float64: tol(atol=8e-06, rtol=8e-07), }),
'TestCommon', 'test_numpy_ref', device_type='xpu'),
DecorateInfo(
toleranceOverride({torch.float32: tol(atol=1e-5, rtol=1e-5),
torch.bfloat16: tol(atol=2e-1, rtol=6e-1)}),
@ -12353,6 +12359,8 @@ op_db: list[OpInfo] = [
backward_dtypesIfCUDA=floating_types_and(torch.float16,
*[torch.bfloat16] if SM53OrLater or TEST_WITH_ROCM else [],
torch.complex64, torch.complex128),
dtypesIfXPU=floating_types_and(torch.bfloat16, torch.float16, torch.complex64,
torch.complex128, torch.int8, torch.uint8),
# Runs very slowly on slow gradcheck - alternatively reduce input sizes
dtypesIfHpu=custom_types(torch.float32, torch.bfloat16),
gradcheck_fast_mode=True,
@ -12388,6 +12396,7 @@ op_db: list[OpInfo] = [
error_inputs_func=error_inputs_dot_vdot,
supports_forward_ad=True,
supports_fwgrad_bwgrad=True,
decorators=[skipIfXpu,],
skips=(
# Issue with conj and torch dispatch, see https://github.com/pytorch/pytorch/issues/82479
DecorateInfo(
@ -12404,6 +12413,7 @@ op_db: list[OpInfo] = [
error_inputs_func=error_inputs_dot_vdot,
supports_forward_ad=True,
supports_fwgrad_bwgrad=True,
decorators=[skipIfXpu,],
skips=(
# Issue with conj and torch dispatch, see https://github.com/pytorch/pytorch/issues/82479
DecorateInfo(
@ -12811,7 +12821,8 @@ op_db: list[OpInfo] = [
dtypes=floating_and_complex_types(),
sample_inputs_func=sample_inputs_linalg_cholesky,
gradcheck_wrapper=gradcheck_wrapper_hermitian_input,
decorators=[skipCUDAIfNoMagma, skipCPUIfNoLapack],),
decorators=[skipCUDAIfNoMagma, skipCPUIfNoLapack,
skipIfXpu(msg="https://github.com/intel/torch-xpu-ops/issues/1936")]),
OpInfo('cholesky_inverse',
dtypes=floating_and_complex_types(),
backward_dtypes=floating_and_complex_types(),
@ -12840,7 +12851,9 @@ op_db: list[OpInfo] = [
],
skips=(
# Strides are not the same! Original strides were ((4, 2, 1),) and strides are now ((4, 1, 2),)
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_out'),),
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_out'),
DecorateInfo(unittest.skip("https://github.com/intel/torch-xpu-ops/issues/2254"),
'TestCommon', 'test_out_warning', device_type='xpu')),
),
OpInfo('cholesky_solve',
op=torch.cholesky_solve,
@ -13645,7 +13658,7 @@ op_db: list[OpInfo] = [
or (_get_torch_rocm_version() >= (5, 2))),
"cusparseSDDMM was added in 11.2.1"),
skipCPUIfNoMklSparse,
skipXPU],
skipIfXpu(msg="https://github.com/intel/torch-xpu-ops/issues/2283")],
skips=(
# NotImplementedError: Tensors of type SparseCsrTensorImpl do not have is_contiguous
DecorateInfo(unittest.skip("Skipped!"), 'TestCommon', 'test_noncontiguous_samples'),
@ -13834,6 +13847,8 @@ op_db: list[OpInfo] = [
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_dtypes'),
# Strides are not the same!
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_out'),
DecorateInfo(unittest.skip("https://github.com/intel/torch-xpu-ops/issues/2254"),
'TestCommon', 'test_out_warning', device_type='xpu'),
)),
BinaryUfuncInfo('gt',
ref=np.greater,
@ -15258,6 +15273,7 @@ op_db: list[OpInfo] = [
assert_jit_shape_analysis=True,
gradcheck_nondet_tol=GRADCHECK_NONDET_TOL,
decorators=[
skipIfXpu(msg='https://github.com/intel/torch-xpu-ops/issues/1898'),
DecorateInfo(
toleranceOverride({torch.float32: tol(atol=1e-04, rtol=1.3e-06), }),
'TestCommon', 'test_variant_consistency_eager', device_type='cuda'),
@ -15332,7 +15348,8 @@ op_db: list[OpInfo] = [
'TestCommon', 'test_complex_half_reference_testing'),
DecorateInfo(
toleranceOverride({torch.half: tol(atol=9e-3, rtol=2e-1), }),
'TestInductorOpInfo', 'test_comprehensive', device_type='cpu')],
'TestInductorOpInfo', 'test_comprehensive', device_type='cpu'),
skipIfXpu(msg='https://github.com/intel/torch-xpu-ops/issues/1898')],
skips=(
# RuntimeError: !lhs.isAliasOf(rhs)INTERNAL ASSERT FAILED at
# "../torch/csrc/jit/passes/utils/check_alias_annotation.cpp":104, please report a bug to PyTorch.
@ -15358,6 +15375,8 @@ op_db: list[OpInfo] = [
dtypesIfCUDA=floating_and_complex_types_and(torch.float16, torch.chalf,
torch.bfloat16),
dtypesIfHpu=custom_types(torch.float32, torch.bfloat16),
dtypesIfXPU=floating_and_complex_types_and(torch.float16, torch.chalf,
torch.bfloat16, torch.uint8, torch.int8),
sample_inputs_func=sample_inputs_conv1d,
error_inputs_func=error_inputs_conv1d,
supports_forward_ad=True,
@ -16373,7 +16392,8 @@ op_db: list[OpInfo] = [
supports_out=True,
supports_forward_ad=False,
supports_autograd=False,
decorators=[skipXPU, skipCUDAIf(not SM89OrLater or TEST_WITH_ROCM, 'Requires CUDA SM >= 8.9')],
decorators=[skipCUDAIf(not SM89OrLater or TEST_WITH_ROCM, 'Requires CUDA SM >= 8.9'),
skipIfXpu(msg="https://github.com/intel/torch-xpu-ops/issues/2207")],
skips=(
# Sample inputs isn't really parametrized on dtype
DecorateInfo(unittest.skip("Skipped!"), 'TestCommon', 'test_dtypes'),
@ -16473,7 +16493,9 @@ op_db: list[OpInfo] = [
supports_fwgrad_bwgrad=False,
supports_forward_ad=False,
check_batched_forward_grad=False,
decorators=[skipCUDAIf(not PLATFORM_SUPPORTS_FLASH_ATTENTION, "This platform doesn't support Flash Attention")],
decorators=[
skipCUDAIf(not PLATFORM_SUPPORTS_FLASH_ATTENTION, "This platform doesn't support Flash Attention"),
skipIfXpu(msg='This op does not supported in the backend')],
skips=(
# Checking the scalar value of the philox seed and offset
DecorateInfo(unittest.expectedFailure, 'TestCompositeCompliance', 'test_operator', device_type='cuda'),
@ -16501,7 +16523,7 @@ op_db: list[OpInfo] = [
decorators=[
skipCUDAIf(not PLATFORM_SUPPORTS_MEM_EFF_ATTENTION, "This platform doesn't support efficient attention"),
skipCUDAIf(TEST_WITH_ROCM, "Efficient attention on ROCM doesn't support custom_mask_type==2"),
skipXPU],
skipIfXpu(msg='This op does not supported in the backend')],
skips=(
# Checking the scaler value of the philox seed and offset
DecorateInfo(unittest.expectedFailure, 'TestCompositeCompliance', 'test_operator', device_type='cuda'),
@ -17187,6 +17209,8 @@ op_db: list[OpInfo] = [
skips=(
# Strides are not the same!
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_out'),
DecorateInfo(unittest.skip("https://github.com/intel/torch-xpu-ops/issues/2254"),
'TestCommon', 'test_out_warning', device_type='xpu'),
)),
OpInfo('permute',
ref=np.transpose,
@ -17949,7 +17973,7 @@ op_db: list[OpInfo] = [
],
skips=(
# AssertionError: Scalars are not equal!
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_out'),
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_out', active_if=(not TEST_XPU)),
# Gradcheck fails
DecorateInfo(unittest.expectedFailure, 'TestFwdGradients', 'test_fn_fwgrad_bwgrad',
dtypes=floating_and_complex_types()),
@ -19587,6 +19611,7 @@ op_db: list[OpInfo] = [
sample_inputs_func=sample_inputs_histogramdd,
error_inputs_func=error_inputs_histogramdd,
supports_autograd=False,
decorators=(skipIfXpu(msg="https://github.com/intel/torch-xpu-ops/issues/2254"),),
skips=(
# Not implemented on CUDA
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_errors', device_type='cuda'),
@ -20184,11 +20209,13 @@ op_db: list[OpInfo] = [
dtypes=all_types_and_complex_and(torch.float16, torch.bfloat16),
dtypesIfCUDA=floating_and_complex_types_and(torch.float16, torch.bfloat16),
dtypesIfROCM=floating_and_complex_types_and(torch.half, torch.bfloat16),
dtypesIfXPU=floating_and_complex_types_and(torch.float16, torch.bfloat16, torch.int8, torch.uint8),
supports_forward_ad=True,
supports_fwgrad_bwgrad=True,
# See https://github.com/pytorch/pytorch/pull/78358
check_batched_forward_grad=False,
sample_inputs_func=sample_inputs_tensordot,
decorators=[skipIfXpu(msg="https://github.com/intel/torch-xpu-ops/issues/2289"),],
skips=(
# Skip operator schema test because this is a functional and not an operator.
# Reference: https://github.com/pytorch/pytorch/issues/54574
@ -20233,6 +20260,9 @@ op_db: list[OpInfo] = [
skips=(
# AssertionError: UserWarning not triggered : Resized a non-empty tensor but did not warn about it.
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_out_warning', device_type='cuda'),
# AssertionError: UserWarning not triggered : Resized a non-empty tensor but did not warn about it.
# https://github.com/intel/torch-xpu-ops/issues/2236
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_out_warning', device_type='xpu'),
# RuntimeError: "max_values_cpu" not implemented for 'ComplexDouble'
# Falling back to non-numerically stabilized exp, causing nan in the results.
DecorateInfo(unittest.expectedFailure, 'TestFwdGradients', 'test_forward_mode_AD', dtypes=[torch.complex128]),
@ -21148,6 +21178,9 @@ op_db: list[OpInfo] = [
# FIXME: reduces all dimensions when dim=[]
DecorateInfo(unittest.expectedFailure, 'TestReductions', 'test_dim_empty'),
DecorateInfo(unittest.expectedFailure, 'TestReductions', 'test_dim_empty_keepdim'),
# https://github.com/intel/torch-xpu-ops/issues/2295
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_noncontiguous_samples',
dtypes=[torch.int64], device_type='xpu'),
),
error_inputs_func=error_inputs_aminmax_amax_amin,
),
@ -22205,6 +22238,7 @@ python_ref_db = [
PythonRefInfo(
"_refs.linspace",
torch_opinfo_name="linspace",
decorators=[skipIfXpu(msg="https://github.com/intel/torch-xpu-ops/issues/2287"),],
skips=(
# Tests that assume input is a tensor or sequence of tensors
DecorateInfo(unittest.expectedFailure, 'TestMathBits', 'test_neg_view'),
@ -22235,6 +22269,7 @@ python_ref_db = [
"_refs.linspace",
torch_opinfo_name="linspace",
torch_opinfo_variant_name="tensor_overload",
decorators=[skipIfXpu(msg="https://github.com/intel/torch-xpu-ops/issues/2287"),],
skips=(
# TypeError: 'int' object is not subscriptable
DecorateInfo(unittest.expectedFailure, 'TestMathBits', 'test_neg_view'),
@ -22259,6 +22294,16 @@ python_ref_db = [
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_python_ref',
dtypes=(torch.float32, torch.float64, torch.float16, torch.complex64, torch.complex128, torch.bfloat16),
device_type="cuda"),
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_python_ref_torch_fallback',
dtypes=(torch.uint8, torch.int8, torch.int16, torch.int32, torch.int64),
device_type="xpu"),
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_python_ref',
dtypes=(torch.uint8, torch.int8, torch.int16, torch.int32, torch.int64),
device_type="xpu"),
# TODO torch.ops.aten.copy is not in _refs
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_python_ref',
dtypes=(torch.float32, torch.float64, torch.float16, torch.complex64, torch.complex128, torch.bfloat16),
device_type="xpu"),
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_python_ref',
dtypes=(torch.float32, torch.float64, torch.float16, torch.complex64, torch.complex128, torch.bfloat16),
device_type="cpu"),
@ -22270,6 +22315,7 @@ python_ref_db = [
PythonRefInfo(
"_refs.logspace",
torch_opinfo_name="logspace",
decorators=[skipIfXpu(msg="https://github.com/intel/torch-xpu-ops/issues/2287"),],
skips=(
# Tests that assume input is a tensor or sequence of tensors
DecorateInfo(unittest.expectedFailure, 'TestMathBits', 'test_neg_view'),
@ -22292,6 +22338,7 @@ python_ref_db = [
"_refs.logspace",
torch_opinfo_name="logspace",
torch_opinfo_variant_name="tensor_overload",
decorators=[skipIfXpu(msg="https://github.com/intel/torch-xpu-ops/issues/2287"),],
skips=(
# TypeError: 'int' object is not subscriptable
DecorateInfo(unittest.expectedFailure, 'TestMathBits', 'test_neg_view'),
@ -23142,6 +23189,7 @@ python_ref_db = [
"_refs.nn.functional.pdist",
torch_opinfo_name="nn.functional.pdist",
supports_out=True,
decorators=[skipIfXpu(msg="https://github.com/intel/torch-xpu-ops/issues/1519"),],
skips=(
# RunTimeError: no _refs support for torch.Tensor.index_select
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_python_ref'),
@ -23406,6 +23454,11 @@ python_ref_db = [
decorators=(
# See https://github.com/pytorch/pytorch/issues/111126
DecorateInfo(unittest.expectedFailure, 'TestBinaryUfuncs', 'test_type_promotion'),
# https://github.com/intel/torch-xpu-ops/issues/1895
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_python_ref',
dtypes=[torch.float64,], device_type='xpu'),
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_python_ref_torch_fallback',
dtypes=[torch.float64,], device_type='xpu'),
),
),
ElementwiseBinaryPythonRefInfo(
@ -24331,6 +24384,7 @@ python_ref_db = [
error_inputs_func=partial(error_inputs_dot_vdot, is_ref=True),
# .conj() does not set ._is_view() correctly in ATen
validate_view_consistency=False,
decorators=[skipIfXpu(msg="https://github.com/intel/torch-xpu-ops/issues/2287"),],
skips=(
# RuntimeError: no _refs support for torch.Tensor.is_conj
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_python_ref', dtypes=[torch.complex64, torch.complex128]),
@ -24342,6 +24396,7 @@ python_ref_db = [
error_inputs_func=partial(error_inputs_dot_vdot, is_ref=True),
# .conj() does not set ._is_view() correctly in ATen
validate_view_consistency=False,
decorators=[skipIfXpu(msg="https://github.com/intel/torch-xpu-ops/issues/2287"),],
skips=(
# RuntimeError: no _refs support for torch.Tensor.is_conj
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_python_ref', dtypes=[torch.complex64, torch.complex128]),
@ -24528,6 +24583,7 @@ python_ref_db = [
PythonRefInfo(
"_refs.std_mean",
torch_opinfo_name="std_mean",
decorators=(skipIfXpu(msg="https://github.com/intel/torch-xpu-ops/issues/1859"),),
),
ReductionPythonRefInfo(
"_refs.sum",
@ -24614,6 +24670,7 @@ python_ref_db = [
"_refs.var_mean",
torch_opinfo_name="var_mean",
validate_view_consistency=False,
decorators=(skipIfXpu(msg="https://github.com/intel/torch-xpu-ops/issues/1859"),),
),
#
# Linear Algebra Operators
@ -24836,6 +24893,7 @@ python_ref_db = [
supports_out=False,
skips=(
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_python_ref_errors', device_type='cuda'),
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_python_ref_errors', device_type='xpu'),
),
),
PythonRefInfo(

View File

@ -158,7 +158,9 @@ op_db: list[OpInfo] = [
supports_fwgrad_bwgrad=True,
# See https://github.com/pytorch/pytorch/pull/78358
check_batched_forward_grad=False,
decorators=[precisionOverride({torch.float: 1e-4, torch.cfloat: 1e-4})],
decorators=[
precisionOverride({torch.float: 1e-4, torch.cfloat: 1e-4}),
],
skips=(
DecorateInfo(
unittest.skip("Skipped!"),
@ -190,7 +192,9 @@ op_db: list[OpInfo] = [
supports_fwgrad_bwgrad=True,
# See https://github.com/pytorch/pytorch/pull/78358
check_batched_forward_grad=False,
decorators=[precisionOverride({torch.float: 1e-4, torch.cfloat: 1e-4})],
decorators=[
precisionOverride({torch.float: 1e-4, torch.cfloat: 1e-4}),
],
),
SpectralFuncInfo(
"fft.hfft",

View File

@ -1572,6 +1572,9 @@ op_db: list[OpInfo] = [
aten_name="linalg_multi_dot",
dtypes=all_types_and_complex_and(torch.half, torch.bfloat16),
dtypesIfCUDA=floating_and_complex_types_and(torch.half, torch.bfloat16),
dtypesIfXPU=floating_and_complex_types_and(
torch.half, torch.bfloat16, torch.int8, torch.uint8
),
supports_inplace_autograd=False,
# Batched grad checks fail for empty input tensors (see https://github.com/pytorch/pytorch/issues/53407)
check_batched_grad=False,
@ -2290,6 +2293,12 @@ op_db: list[OpInfo] = [
decorators=[
skipCUDAIfNoMagmaAndNoCusolver,
skipCPUIfNoLapack,
DecorateInfo(
toleranceOverride({torch.float32: tol(atol=1e-03, rtol=1e-03)}),
"TestCommon",
"test_noncontiguous_samples",
device_type="xpu",
),
DecorateInfo(
toleranceOverride({torch.float32: tol(atol=1e-03, rtol=1e-03)}),
"TestCommon",