From c118c74cdcbf5cbaa304a4a1018c0071f85fb8dc Mon Sep 17 00:00:00 2001 From: yuchengliu1 Date: Tue, 23 Jul 2024 15:37:21 +0800 Subject: [PATCH 1/3] fix bool pow bug --- src/ATen/native/xpu/Pow.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ATen/native/xpu/Pow.cpp b/src/ATen/native/xpu/Pow.cpp index df335bfa1..97dc5a0c2 100644 --- a/src/ATen/native/xpu/Pow.cpp +++ b/src/ATen/native/xpu/Pow.cpp @@ -58,7 +58,13 @@ Tensor& XPUNativeFunctions::pow_out( Tensor XPUNativeFunctions::pow(const Tensor& self, const Scalar& exponent) { Tensor out; auto iter = pow_tensor_scalar_meta(self, exponent, out); - native::xpu::pow_tensor_scalar_kernel(iter, exponent); + if (exponent.equal(0.0) || exponent.equal(false)) { + iter.output().fill_(1); + } else if (exponent.equal(1.0) || exponent.equal(true)) { + iter.output().copy_(self); + } else { + native::xpu::pow_tensor_scalar_kernel(iter, exponent); + } return iter.output(); } From 88a6e9190ea1e244b81083a3b3bb98b3417fc413 Mon Sep 17 00:00:00 2001 From: yuchengliu1 Date: Wed, 24 Jul 2024 02:37:18 +0800 Subject: [PATCH 2/3] update skip --- test/xpu/run_test_with_skip.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/xpu/run_test_with_skip.py b/test/xpu/run_test_with_skip.py index 0e00da513..833a1256f 100644 --- a/test/xpu/run_test_with_skip.py +++ b/test/xpu/run_test_with_skip.py @@ -797,12 +797,12 @@ def launch_test(test_case, skip_list=None, exe_list=None): skip_list = ( "test_fmod_remainder_by_zero_integral_xpu_int64", # zero division is an undefined behavior: different handles on different backends "test_div_rounding_numpy_xpu_float16", # Calculation error. XPU implementation uses opmath type. - # RuntimeError: false INTERNAL ASSERT FAILED at "torch-xpu-ops/src/ATen/native/xpu/sycl/PowKernels.cpp":233, please report a bug to PyTorch. invalid combination of type in Pow function, common dtype: Short, exp is integral? 0 + # Mismatched elements: 33 / 100 (33.0%) + # Greatest absolute difference: 0.00038337233127094805 at index (4,) (up to 1e-05 allowed) + # Greatest relative difference: 1.9085073290625587e-06 at index (6,) (up to 1.3e-06 allowed) "test_pow_xpu_int16", "test_pow_xpu_int32", "test_pow_xpu_int64", - "test_pow_xpu_int8", - "test_pow_xpu_uint8", # AssertionError: Jiterator is only supported on CUDA and ROCm GPUs, none are available. "_jiterator_", # Unexpected success From 97595147d3314b5b6c458e2d0356b2e8e52526da Mon Sep 17 00:00:00 2001 From: yuchengliu1 Date: Wed, 24 Jul 2024 02:45:21 +0800 Subject: [PATCH 3/3] update --- test/xpu/run_test_with_skip.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/xpu/run_test_with_skip.py b/test/xpu/run_test_with_skip.py index 833a1256f..3ffc3feb6 100644 --- a/test/xpu/run_test_with_skip.py +++ b/test/xpu/run_test_with_skip.py @@ -797,6 +797,7 @@ def launch_test(test_case, skip_list=None, exe_list=None): skip_list = ( "test_fmod_remainder_by_zero_integral_xpu_int64", # zero division is an undefined behavior: different handles on different backends "test_div_rounding_numpy_xpu_float16", # Calculation error. XPU implementation uses opmath type. + # fail in complex_exponents=[-1.0 - 1.5j, 3.3j] # Mismatched elements: 33 / 100 (33.0%) # Greatest absolute difference: 0.00038337233127094805 at index (4,) (up to 1e-05 allowed) # Greatest relative difference: 1.9085073290625587e-06 at index (6,) (up to 1.3e-06 allowed)