Skip to content

Commit f37f942

Browse files
[SYCL][Reduction] Fix compilation with MSVC as host compiler (#7728)
It has issues with CTAD still...
1 parent e5de913 commit f37f942

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sycl/include/sycl/reduction.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,12 @@ class reduction_impl_algo : public reduction_impl_common<T, BinaryOperation> {
626626
Func(Mem);
627627

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

0 commit comments

Comments
 (0)