Skip to content

Commit

Permalink
Merge pull request #836 from KhronosGroup/steffen/bump_dpcpp_version
Browse files Browse the repository at this point in the history
Change abs_diff return type
  • Loading branch information
bader authored Nov 28, 2023
2 parents 3ace7fc + 436c420 commit b0ab9bc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cts_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
matrix:
include:
- sycl-impl: dpcpp
version: 9dfaf274e2cbe42e992be0519fa7d2b0eb0face5
version: 6bce7f64f51a4370052bffa3fa257ca16d8aad9e
- sycl-impl: hipsycl
version: 3d8b1cd
steps:
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
matrix:
include:
- sycl-impl: dpcpp
version: 9dfaf274e2cbe42e992be0519fa7d2b0eb0face5
version: 6bce7f64f51a4370052bffa3fa257ca16d8aad9e
- sycl-impl: hipsycl
version: 3d8b1cd
env:
Expand Down
2 changes: 1 addition & 1 deletion tests/math_builtin_api/modules/sycl_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def create_integer_signatures():
f_abs = funsig("sycl", "geninteger", "abs", ["geninteger"])
sig_list.append(f_abs)

f_abs_diff = funsig("sycl", "ugeninteger", "abs_diff", ["geninteger", "geninteger"], "0", "", [], [["geninteger", "ugeninteger", "base_type_but_same_sizeof"]])
f_abs_diff = funsig("sycl", "geninteger", "abs_diff", ["geninteger", "geninteger"], "0")
sig_list.append(f_abs_diff)

f_add_sat = funsig("sycl", "geninteger", "add_sat", ["geninteger", "geninteger"])
Expand Down
20 changes: 9 additions & 11 deletions util/math_reference.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,23 +305,21 @@ sycl_cts::resultRef<sycl::marray<T, N>> abs(sycl::marray<T, N> a) {

/* absolute difference */
template <typename T>
auto abs_diff(T a, T b) {
using R = typename std::make_unsigned<T>::type;
R h = (a > b) ? a : b;
R l = (a <= b) ? a : b;
T abs_diff(T a, T b) {
T h = (a > b) ? a : b;
T l = (a <= b) ? a : b;
return h - l;
}
template <typename T, int N, typename R = typename std::make_unsigned<T>::type>
sycl::vec<R, N> abs_diff(sycl::vec<T, N> a, sycl::vec<T, N> b) {
return sycl_cts::math::run_func_on_vector<R, T, N>(
template <typename T, int N>
sycl::vec<T, N> abs_diff(sycl::vec<T, N> a, sycl::vec<T, N> b) {
return sycl_cts::math::run_func_on_vector<T, T, N>(
[](T x, T y) { return abs_diff(x, y); }, a, b);
}
// FIXME: hipSYCL does not support marray
#ifndef SYCL_CTS_COMPILING_WITH_HIPSYCL
template <typename T, size_t N,
typename R = typename std::make_unsigned<T>::type>
sycl::marray<R, N> abs_diff(sycl::marray<T, N> a, sycl::marray<T, N> b) {
return sycl_cts::math::run_func_on_marray<R, T, N>(
template <typename T, size_t N>
sycl::marray<T, N> abs_diff(sycl::marray<T, N> a, sycl::marray<T, N> b) {
return sycl_cts::math::run_func_on_marray<T, T, N>(
[](T x, T y) { return abs_diff(x, y); }, a, b);
}
#endif
Expand Down

0 comments on commit b0ab9bc

Please sign in to comment.