-
Notifications
You must be signed in to change notification settings - Fork 769
[SYCL] Pull oneDPL tuple to use in reduction implementation #3481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SYCL] Pull oneDPL tuple to use in reduction implementation #3481
Conversation
bd85aa1
to
87eeacb
Compare
eccc202
to
102ec23
Compare
Using sycl::detail::tuple is a temporary work-around for various problems caused by using std::tuple: a) reduction using std::tuple cannot be compiled on Windows because std::tuple cannot be copied to DEVICE. b) internal error in level_zero RT. The new sycl::detail::tuple class is a very limited version of oneDPL's implementation of tuple. It includes such functionality: - convert from std::tuple and to std::tuple - tie(), get<I>(), tuple_element, make_tuple This change enables parallel_for() with number of reductions more than 1 for level_zero and for Windows. Signed-off-by: Vyacheslav N Klochkov <[email protected]>
102ec23
to
64aece7
Compare
const std::tuple<ReducerT...> &Reducers, | ||
const std::tuple<ResultT...> Identities, | ||
ReduTupleT<ResultT...> Identities, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to drop const
here?
const std::tuple<ResultT...> Identities, | ||
ReduTupleT<InputAccT...> LocalAccs, | ||
ReduTupleT<LocalAccT...> InputAccs, | ||
ReduTupleT<ResultT...> Identities, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question about const
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tuple is passed by value here, so 'const' does not have any effect, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question, I'm not sure! I just wanted to check if it was deliberate, because you did more than just change the type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tuple is passed by value here, so 'const' does not have any effect, right?
Both versions are equivalent from the caller POV, but const
protects from modifying the value within the callee scope if needed.
@@ -30,6 +31,15 @@ using cl::sycl::detail::is_sgeninteger; | |||
using cl::sycl::detail::queue_impl; | |||
using cl::sycl::detail::remove_AS; | |||
|
|||
// std::tuple seems to be a) too heavy and b) not copyable to device now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please clarify what specifically makes std::tuple
heavy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll eventually have to do that. At this moment I only know that SPIR-V file for a reduction test with std::tuple is 34% bigger than SPIRV for the same reduction test with sycl::detail::tuple (i.e. with this change).
…y property The corresponding changes in SYCL RT: intel/llvm#3410 intel/llvm#3481 Signed-off-by: Vyacheslav N Klochkov <[email protected]>
* [SYCL] Add test cases for SYCL2020 reductions + initialize_to_identity property The corresponding changes in SYCL RT: intel/llvm#3410 intel/llvm#3481 This patch - adds checks for SYCL-2020 reductions with initialize_to_identity property (#3410) - enables the test reduction_nd_N_vars.cpp for level-zero (#3481) - reduces some of tests by eliminating unneeded/duplicated checks. - removes the test reduction_transparent.cpp as useless because transparent operators already checked in many other tests. - reduces runtime of reduction tests by about 200x in average by re-using queue created once instead of creating it in each of test-cases Signed-off-by: Vyacheslav N Klochkov <[email protected]>
) * [SYCL] Add test cases for SYCL2020 reductions + initialize_to_identity property The corresponding changes in SYCL RT: intel#3410 intel#3481 This patch - adds checks for SYCL-2020 reductions with initialize_to_identity property (intel/llvm-test-suite#3410) - enables the test reduction_nd_N_vars.cpp for level-zero (intel/llvm-test-suite#3481) - reduces some of tests by eliminating unneeded/duplicated checks. - removes the test reduction_transparent.cpp as useless because transparent operators already checked in many other tests. - reduces runtime of reduction tests by about 200x in average by re-using queue created once instead of creating it in each of test-cases Signed-off-by: Vyacheslav N Klochkov <[email protected]>
Using sycl::detail::tuple is a temporary work-around for various
problems caused by using std::tuple:
a) reduction using std::tuple cannot be compiled on Windows because
std::tuple cannot be copied to DEVICE.
b) internal error in level_zero RT.
The new sycl::detail::tuple class is a very limited version
of oneDPL's implementation of tuple. It includes such functionality:
This change enables parallel_for() with number of reductions
more than 1 for level_zero and for Windows.
The corresponding changes in LIT tests: intel/llvm-test-suite#194
Signed-off-by: Vyacheslav N Klochkov [email protected]