Skip to content

Commit

Permalink
Some fixes after the previous change
Browse files Browse the repository at this point in the history
  • Loading branch information
aelovikov-intel committed Aug 14, 2024
1 parent 92076d8 commit 0ef1aad
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion sycl/include/sycl/accessor_image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ class image_accessor

template <int Dims = Dimensions, typename = std::enable_if_t<Dims == 1>>
range<1> get_range() const {
int Range = getRangeInternal();
int Range = static_cast<int>(getRangeInternal());
return range<1>(Range);
}
template <int Dims = Dimensions, typename = std::enable_if_t<Dims == 2>>
Expand Down
13 changes: 7 additions & 6 deletions sycl/include/syclcompat/math.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ inline constexpr RetT extend_vbinary2(AT a, BT b, RetT c,
if constexpr (NeedAdd) {
return temp[0] + temp[1] + c;
}
return sycl::vec<IntT, 2>{temp[0], temp[1]}.template as<sycl::vec<RetT, 1>>();
return static_cast<RetT>(sycl::vec<IntT, 2>{temp[0], temp[1]}.template as<sycl::vec<RetT, 1>>());
}

template <typename RetT, bool NeedSat, bool NeedAdd, typename AT, typename BT,
Expand All @@ -213,8 +213,9 @@ inline constexpr RetT extend_vbinary4(AT a, BT b, RetT c,
return temp[0] + temp[1] + temp[2] + temp[3] + c;
}

return sycl::vec<IntT, 4>{temp[0], temp[1], temp[2], temp[3]}
.template as<sycl::vec<RetT, 1>>();
return static_cast<RetT>(
sycl::vec<IntT, 4>{temp[0], temp[1], temp[2], temp[3]}
.template as<sycl::vec<RetT, 1>>());
}

template <typename ValueT> inline bool isnan(const ValueT a) {
Expand Down Expand Up @@ -610,7 +611,7 @@ inline unsigned vectorized_unary(unsigned a, const UnaryOperation unary_op) {
auto v1 = v0.as<VecT>();
auto v2 = unary_op(v1);
v0 = v2.template as<sycl::vec<unsigned, 1>>();
return v0;
return unsigned{v0};
}

/// Compute vectorized absolute difference for two values without modulo
Expand Down Expand Up @@ -663,7 +664,7 @@ inline unsigned vectorized_isgreater<sycl::ushort2, unsigned>(unsigned a,
v4[0] = v2[0] > v3[0];
v4[1] = v2[1] > v3[1];
v0 = v4.template as<sycl::vec<unsigned, 1>>();
return v0;
return unsigned{v0};
}

/// Returns min(max(val, min_val), max_val)
Expand Down Expand Up @@ -989,7 +990,7 @@ inline unsigned vectorized_binary(unsigned a, unsigned b,
auto v4 =
detail::vectorized_binary<VecT, BinaryOperation>()(v2, v3, binary_op);
v0 = v4.template as<sycl::vec<unsigned, 1>>();
return v0;
return unsigned{v0};
}

template <typename T1, typename T2>
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/syclcompat/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ inline int cast_double_to_int(double d, bool use_high32 = true) {
inline double cast_ints_to_double(int high32, int low32) {
sycl::int2 v0{high32, low32};
auto v1 = v0.as<sycl::vec<double, 1>>();
return v1;
return static_cast<double>(v1);
}

/// Reverse the bit order of an unsigned integer
Expand Down

0 comments on commit 0ef1aad

Please sign in to comment.