Skip to content

Commit

Permalink
Xfail fp64 atomic load, store, exchange tests on ocl cpu.
Browse files Browse the repository at this point in the history
  • Loading branch information
Diptorup Deb committed Jan 31, 2024
1 parent ae7d68e commit fb916a2
Showing 1 changed file with 31 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# SPDX-License-Identifier: Apache-2.0

import dpctl
import dpnp
import pytest
from numba.core.errors import TypingError
Expand All @@ -21,7 +22,8 @@ def store_exchange_fn(request):
return request.param


def test_load_store_fn():
@pytest.mark.parametrize("supported_dtype", list_of_supported_dtypes)
def test_load_store_fn(supported_dtype):
"""A test for load/store atomic functions."""

@dpex_exp.kernel
Expand All @@ -33,8 +35,19 @@ def _kernel(a, b):
a_ref.store(val)

N = 10
a = dpnp.zeros(2 * N, dtype=dpnp.float32)
b = dpnp.arange(N, dtype=dpnp.float32)
a = dpnp.zeros(2 * N, dtype=supported_dtype)
b = dpnp.arange(N, dtype=supported_dtype)

dev = a.sycl_device
if (
dev.backend == dpctl.backend_type.opencl
and dev.device_type == dpctl.device_type.cpu
and supported_dtype == dpnp.float64
):
pytest.xfail(
"Atomic load, store, and exchange operations not working "
" for fp64 on OpenCL CPU"
)

dpex_exp.call_kernel(_kernel, dpex.Range(b.size), a, b)
# Verify that `b[i]` loaded and stored into a[i] by kernel
Expand All @@ -48,7 +61,8 @@ def _kernel(a, b):
assert a[i] == a[i + b.size]


def test_exchange_fn():
@pytest.mark.parametrize("supported_dtype", list_of_supported_dtypes)
def test_exchange_fn(supported_dtype):
"""A test for exchange atomic function."""

@dpex_exp.kernel
Expand All @@ -58,8 +72,19 @@ def _kernel(a, b):
b[i] = v.exchange(b[i])

N = 10
a_orig = dpnp.zeros(2 * N, dtype=dpnp.float32)
b_orig = dpnp.arange(N, dtype=dpnp.float32)
a_orig = dpnp.zeros(2 * N, dtype=supported_dtype)
b_orig = dpnp.arange(N, dtype=supported_dtype)

dev = a_orig.sycl_device
if (
dev.backend == dpctl.backend_type.opencl
and dev.device_type == dpctl.device_type.cpu
and supported_dtype == dpnp.float64
):
pytest.xfail(
"Atomic load, store, and exchange operations not working "
" for fp64 on OpenCL CPU"
)

a_copy = dpnp.copy(a_orig)
b_copy = dpnp.copy(b_orig)
Expand Down

0 comments on commit fb916a2

Please sign in to comment.