Skip to content

Commit 9d908d8

Browse files
authored
Revert "[SYCL] Fix performance regression in parallel_for with using id class (#5385)" (#6013)
This reverts commit a5760aa. Test is kept to check that id is converted from item within kernel.
1 parent abd0369 commit 9d908d8

File tree

3 files changed

+7
-15
lines changed

3 files changed

+7
-15
lines changed

sycl/include/CL/sycl/detail/stl_type_traits.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,6 @@ struct is_output_iterator<T, output_iterator_requirements<T>> {
7878
static constexpr bool value = true;
7979
};
8080

81-
template <typename T, typename U>
82-
inline constexpr bool is_same_v = std::is_same<T, U>::value;
83-
84-
template <typename T, typename U>
85-
inline constexpr bool is_convertible_v = std::is_convertible<T, U>::value;
86-
8781
} // namespace detail
8882
} // namespace sycl
8983
} // __SYCL_INLINE_NAMESPACE(cl)

sycl/include/CL/sycl/handler.hpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -927,14 +927,11 @@ class __SYCL_EXPORT handler {
927927
}
928928

929929
template <int Dims, typename LambdaArgType> struct TransformUserItemType {
930-
using type = typename std::conditional_t<
931-
detail::is_same_v<id<Dims>, LambdaArgType>, LambdaArgType,
932-
typename std::conditional_t<
933-
detail::is_convertible_v<nd_item<Dims>, LambdaArgType>,
934-
nd_item<Dims>,
935-
typename std::conditional_t<
936-
detail::is_convertible_v<item<Dims>, LambdaArgType>, item<Dims>,
937-
LambdaArgType>>>;
930+
using type = typename std::conditional<
931+
std::is_convertible<nd_item<Dims>, LambdaArgType>::value, nd_item<Dims>,
932+
typename std::conditional<
933+
std::is_convertible<item<Dims>, LambdaArgType>::value, item<Dims>,
934+
LambdaArgType>::type>::type;
938935
};
939936

940937
/// Defines and invokes a SYCL kernel function for the specified range.

sycl/test/basic_tests/parallel_for_type_check.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// RUN: %clangxx -fsycl -fsycl-device-only -D__SYCL_INTERNAL_API -O0 -c -emit-llvm -S -o - %s | FileCheck %s
22

33
// This test performs basic type check for sycl::id that is used in result type.
4+
// Check that sycl::id is converted from sycl::item.
45

56
#include <CL/sycl.hpp>
67
#include <iostream>
@@ -21,7 +22,7 @@ int main() {
2122
auto buf_acc = data_buf.get_access<sycl::access::mode::read_write>(h);
2223
h.parallel_for(
2324
sycl::range<1>{sz},
24-
// CHECK: cl{{.*}}sycl{{.*}}detail{{.*}}RoundedRangeKernel{{.*}}id{{.*}}main{{.*}}handler
25+
// CHECK: cl{{.*}}sycl{{.*}}detail{{.*}}RoundedRangeKernel{{.*}}item{{.*}}main{{.*}}handler
2526
[=](sycl::id<1> item) { buf_acc[item] += 1; });
2627
});
2728
q.wait();

0 commit comments

Comments
 (0)