Skip to content

[SYCL][Reduction] Fix compilation with MSVC as host compiler #7728

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

Merged
merged 1 commit into from
Dec 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion sycl/include/sycl/reduction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,12 @@ class reduction_impl_algo : public reduction_impl_common<T, BinaryOperation> {
Func(Mem);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that it works just fine on the line 625.


reduction::withAuxHandler(CGH, [&](handler &CopyHandler) {
accessor Mem{*Buf, CopyHandler};
// MSVC (19.32.31329) has problems compiling the line below when used
// as a host compiler in c++17 mode (but not in c++latest)
// accessor Mem{*Buf, CopyHandler};
// so use the old-style API.
auto Mem =
Buf->template get_access<access::mode::read_write>(CopyHandler);
if constexpr (is_usm) {
// Can't capture whole reduction, copy into distinct variables.
bool IsUpdateOfUserVar = !base::initializeToIdentity();
Expand Down