diff --git a/sycl/include/sycl/builtins_esimd.hpp b/sycl/include/sycl/builtins_esimd.hpp index cc7011584ffdc..fa720a405f9be 100644 --- a/sycl/include/sycl/builtins_esimd.hpp +++ b/sycl/include/sycl/builtins_esimd.hpp @@ -8,7 +8,6 @@ #pragma once -#include #include #include #include diff --git a/sycl/include/sycl/builtins_utils_scalar.hpp b/sycl/include/sycl/builtins_utils_scalar.hpp index af9d3b6268d45..194059fa28b21 100644 --- a/sycl/include/sycl/builtins_utils_scalar.hpp +++ b/sycl/include/sycl/builtins_utils_scalar.hpp @@ -10,7 +10,6 @@ #include // for address_space, decorated #include // for half -#include // for Boolean #include // for __SYCL_ALWAYS_INLINE #include // for is_svgenfloat, is_sge... #include // for is_contained, type_list diff --git a/sycl/include/sycl/detail/boolean.hpp b/sycl/include/sycl/detail/boolean.hpp deleted file mode 100644 index cdf00fe3f50cf..0000000000000 --- a/sycl/include/sycl/detail/boolean.hpp +++ /dev/null @@ -1,107 +0,0 @@ -//==----------- boolean.hpp - SYCL boolean type ----------------------------==// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#pragma once - -#include // for is_sgeninteger, msbIsSet -#include // for vector_alignment - -#include // for initializer_list -#include // for size_t -#include // for int8_t -#include // for is_same - -namespace sycl { -inline namespace _V1 { -namespace detail { - -template struct Assigner { - template static void assign(R &r, const T x) { - Assigner::assign(r, x); - r.template swizzle() = x.value[Num]; - } - - template - static void init(R &r, const T x) { - Assigner::template init(r, x); - ET v = x.template swizzle(); - r.value[Num] = msbIsSet(v) * (-1); - } -}; - -template <> struct Assigner<0> { - template static void assign(R &r, const T x) { - r.template swizzle<0>() = x.value[0]; - } - template - static void init(R &r, const T x) { - ET v = x.template swizzle<0>(); - r.value[0] = msbIsSet(v) * (-1); - } -}; - -template struct Boolean { - static_assert(((N == 2) || (N == 3) || (N == 4) || (N == 8) || (N == 16)), - "Invalid size"); - - using element_type = int8_t; - -#ifdef __SYCL_DEVICE_ONLY__ - using DataType = element_type __attribute__((ext_vector_type(N))); - using vector_t = DataType; -#else - using DataType = element_type[N]; -#endif - - Boolean() : value{0} {} - - Boolean(std::initializer_list l) { - for (size_t I = 0; I < N; ++I) { - value[I] = *(l.begin() + I) ? -1 : 0; - } - } - - Boolean(const Boolean &rhs) { - for (size_t I = 0; I < N; ++I) { - value[I] = rhs.value[I]; - } - } - - template Boolean(const T rhs) { - static_assert(is_vgeninteger_v, "Invalid constructor"); - Assigner::template init, T, typename T::element_type>( - *this, rhs); - } - -#ifdef __SYCL_DEVICE_ONLY__ - // TODO change this to the vectors assignment when the assignment will be - // fixed on Intel GPU NEO OpenCL runtime - Boolean(const vector_t rhs) { - for (size_t I = 0; I < N; ++I) { - value[I] = rhs[I]; - } - } - - operator vector_t() const { return value; } -#endif - - template operator T() const { - static_assert(is_vgeninteger_v, "Invalid conversion"); - T r; - Assigner::assign(r, *this); - return r; - } - -private: - template friend struct Assigner; - alignas(detail::vector_alignment::value) DataType value; -}; - -} // namespace detail -} // namespace _V1 -} // namespace sycl diff --git a/sycl/include/sycl/detail/generic_type_traits.hpp b/sycl/include/sycl/detail/generic_type_traits.hpp index f2bef691a45b9..e4d2f70d66095 100644 --- a/sycl/include/sycl/detail/generic_type_traits.hpp +++ b/sycl/include/sycl/detail/generic_type_traits.hpp @@ -27,8 +27,6 @@ namespace sycl { inline namespace _V1 { namespace detail { -template struct Boolean; - template inline constexpr bool is_svgenfloatf_v = is_contained_v; @@ -347,17 +345,6 @@ template auto convertToOpenCLType(T &&x) { return sycl::bit_cast(x); #else return x.template as(); -#endif - } else if constexpr (is_boolean_v) { -#ifdef __SYCL_DEVICE_ONLY__ - if constexpr (std::is_same_v, no_ref>) { - // Or should it be "int"? - return std::forward(x); - } else { - return static_cast(x); - } -#else - return std::forward(x); #endif #if (!defined(_HAS_STD_BYTE) || _HAS_STD_BYTE != 0) } else if constexpr (std::is_same_v) { @@ -437,9 +424,6 @@ template struct GetNumElements> { static constexpr int value = NumElements; }; -template struct GetNumElements> { - static constexpr int value = N; -}; // TryToGetElementType::type is T::element_type or T::value_type if those // exist, otherwise T. diff --git a/sycl/include/sycl/detail/type_traits.hpp b/sycl/include/sycl/detail/type_traits.hpp index 0f1d46ba5f731..0a20e51bdeec5 100644 --- a/sycl/include/sycl/detail/type_traits.hpp +++ b/sycl/include/sycl/detail/type_traits.hpp @@ -367,12 +367,6 @@ template struct is_bool : std::bool_constant>::value> {}; -// is_boolean -template struct Boolean; -template struct is_boolean : std::false_type {}; -template struct is_boolean> : std::true_type {}; -template inline constexpr bool is_boolean_v = is_boolean::value; - // is_pointer template struct is_pointer_impl : std::false_type {}; diff --git a/sycl/test-e2e/Basic/boolean.cpp b/sycl/test-e2e/Basic/boolean.cpp deleted file mode 100644 index 39ee7f878c43f..0000000000000 --- a/sycl/test-e2e/Basic/boolean.cpp +++ /dev/null @@ -1,135 +0,0 @@ -// RUN: %{build} -o %t.out -// RUN: %{run} %t.out -#include -#include - -#include -#include -#include - -using namespace sycl; -namespace s = sycl; -namespace d = s::detail; - -d::Boolean<3> foo() { - d::Boolean<3> b3{true, false, true}; - return b3; -} - -int main() { - { - s::long4 r{0}; - { - buffer BufR(&r, range<1>(1)); - queue myQueue; - myQueue.submit([&](handler &cgh) { - auto AccR = BufR.get_access(cgh); - cgh.single_task([=]() { - d::Boolean<4> b4{false, true, false, false}; - AccR[0] = b4; - }); - }); - } - long long r1 = r.s0(); - long long r2 = r.s1(); - long long r3 = r.s2(); - long long r4 = r.s3(); - - std::cout << "r1 " << r1 << " r2 " << r2 << " r3 " << r3 << " r4 " << r4 - << std::endl; - - assert(r1 == 0); - assert(r2 == -1); - assert(r3 == 0); - assert(r4 == 0); - } - - { - s::short3 r{0}; - { - buffer BufR(&r, range<1>(1)); - queue myQueue; - myQueue.submit([&](handler &cgh) { - auto AccR = BufR.get_access(cgh); - cgh.single_task([=]() { AccR[0] = foo(); }); - }); - } - short r1 = r.s0(); - short r2 = r.s1(); - short r3 = r.s2(); - - std::cout << "r1 " << r1 << " r2 " << r2 << " r3 " << r3 << std::endl; - - assert(r1 == -1); - assert(r2 == 0); - assert(r3 == -1); - } - - { - int r1[5]; - int r2[5]; - { - buffer BufR1(r1, range<1>(6)); - buffer BufR2(r2, range<1>(6)); - queue myQueue; - myQueue.submit([&](handler &cgh) { - auto AccR1 = BufR1.get_access(cgh); - auto AccR2 = BufR2.get_access(cgh); - cgh.single_task([=]() { - AccR1[0] = sizeof(d::Boolean<2>); - AccR1[1] = sizeof(d::Boolean<3>); - AccR1[2] = sizeof(d::Boolean<4>); - AccR1[3] = sizeof(d::Boolean<8>); - AccR1[4] = sizeof(d::Boolean<16>); - - AccR2[0] = alignof(d::Boolean<2>); - AccR2[1] = alignof(d::Boolean<3>); - AccR2[2] = alignof(d::Boolean<4>); - AccR2[3] = alignof(d::Boolean<8>); - AccR2[4] = alignof(d::Boolean<16>); - }); - }); - } - - for (size_t I = 0; I < 5; I++) { - std::cout << " r1[" << I << "] " << r1[I]; - } - std::cout << std::endl; - - for (size_t I = 0; I < 5; I++) { - std::cout << " r2[" << I << "] " << r2[I]; - } - std::cout << std::endl; - assert(r1[0] == sizeof(d::Boolean<2>)); - assert(r1[1] == sizeof(d::Boolean<3>)); - assert(r1[2] == sizeof(d::Boolean<4>)); - assert(r1[3] == sizeof(d::Boolean<8>)); - assert(r1[4] == sizeof(d::Boolean<16>)); - - assert(r2[0] == alignof(d::Boolean<2>)); - assert(r2[1] == alignof(d::Boolean<3>)); - assert(r2[2] == alignof(d::Boolean<4>)); - assert(r2[3] == alignof(d::Boolean<8>)); - assert(r2[4] == alignof(d::Boolean<16>)); - } - - { - s::int4 i4 = {1, -2, 0, -3}; - d::Boolean<4> b4(i4); - i4 = b4; - - int r1 = i4.s0(); - int r2 = i4.s1(); - int r3 = i4.s2(); - int r4 = i4.s3(); - - std::cout << "r1 " << r1 << " r2 " << r2 << " r3 " << r3 << " r4 " << r4 - << std::endl; - assert(r1 == 0); - assert(r2 == -1); - assert(r3 == 0); - assert(r4 == -1); - } - - return 0; -}