diff --git a/sycl/include/CL/sycl/detail/spirv.hpp b/sycl/include/CL/sycl/detail/spirv.hpp index 6294bf89d928f..92d5f7499c603 100644 --- a/sycl/include/CL/sycl/detail/spirv.hpp +++ b/sycl/include/CL/sycl/detail/spirv.hpp @@ -55,7 +55,7 @@ template void GenericCall(const Functor &ApplyToBytes) { if (sizeof(T) >= sizeof(ShuffleChunkT)) { #pragma unroll - for (size_t Offset = 0; Offset < sizeof(T); + for (size_t Offset = 0; Offset + sizeof(ShuffleChunkT) <= sizeof(T); Offset += sizeof(ShuffleChunkT)) { ApplyToBytes(Offset, sizeof(ShuffleChunkT)); } @@ -160,9 +160,9 @@ EnableIfGenericBroadcast GroupBroadcast(T x, IdT local_id) { char *ResultBytes = reinterpret_cast(&Result); auto BroadcastBytes = [=](size_t Offset, size_t Size) { uint64_t BroadcastX, BroadcastResult; - detail::memcpy(&BroadcastX, XBytes + Offset, Size); + std::memcpy(&BroadcastX, XBytes + Offset, Size); BroadcastResult = GroupBroadcast(BroadcastX, local_id); - detail::memcpy(ResultBytes + Offset, &BroadcastResult, Size); + std::memcpy(ResultBytes + Offset, &BroadcastResult, Size); }; GenericCall(BroadcastBytes); return Result; @@ -213,9 +213,9 @@ EnableIfGenericBroadcast GroupBroadcast(T x, id local_id) { char *ResultBytes = reinterpret_cast(&Result); auto BroadcastBytes = [=](size_t Offset, size_t Size) { uint64_t BroadcastX, BroadcastResult; - detail::memcpy(&BroadcastX, XBytes + Offset, Size); + std::memcpy(&BroadcastX, XBytes + Offset, Size); BroadcastResult = GroupBroadcast(BroadcastX, local_id); - detail::memcpy(ResultBytes + Offset, &BroadcastResult, Size); + std::memcpy(ResultBytes + Offset, &BroadcastResult, Size); }; GenericCall(BroadcastBytes); return Result; @@ -697,9 +697,9 @@ EnableIfGenericShuffle SubgroupShuffle(T x, id<1> local_id) { char *ResultBytes = reinterpret_cast(&Result); auto ShuffleBytes = [=](size_t Offset, size_t Size) { ShuffleChunkT ShuffleX, ShuffleResult; - detail::memcpy(&ShuffleX, XBytes + Offset, Size); + std::memcpy(&ShuffleX, XBytes + Offset, Size); ShuffleResult = SubgroupShuffle(ShuffleX, local_id); - detail::memcpy(ResultBytes + Offset, &ShuffleResult, Size); + std::memcpy(ResultBytes + Offset, &ShuffleResult, Size); }; GenericCall(ShuffleBytes); return Result; @@ -712,9 +712,9 @@ EnableIfGenericShuffle SubgroupShuffleXor(T x, id<1> local_id) { char *ResultBytes = reinterpret_cast(&Result); auto ShuffleBytes = [=](size_t Offset, size_t Size) { ShuffleChunkT ShuffleX, ShuffleResult; - detail::memcpy(&ShuffleX, XBytes + Offset, Size); + std::memcpy(&ShuffleX, XBytes + Offset, Size); ShuffleResult = SubgroupShuffleXor(ShuffleX, local_id); - detail::memcpy(ResultBytes + Offset, &ShuffleResult, Size); + std::memcpy(ResultBytes + Offset, &ShuffleResult, Size); }; GenericCall(ShuffleBytes); return Result; @@ -727,9 +727,9 @@ EnableIfGenericShuffle SubgroupShuffleDown(T x, id<1> local_id) { char *ResultBytes = reinterpret_cast(&Result); auto ShuffleBytes = [=](size_t Offset, size_t Size) { ShuffleChunkT ShuffleX, ShuffleResult; - detail::memcpy(&ShuffleX, XBytes + Offset, Size); + std::memcpy(&ShuffleX, XBytes + Offset, Size); ShuffleResult = SubgroupShuffleDown(ShuffleX, local_id); - detail::memcpy(ResultBytes + Offset, &ShuffleResult, Size); + std::memcpy(ResultBytes + Offset, &ShuffleResult, Size); }; GenericCall(ShuffleBytes); return Result; @@ -742,9 +742,9 @@ EnableIfGenericShuffle SubgroupShuffleUp(T x, id<1> local_id) { char *ResultBytes = reinterpret_cast(&Result); auto ShuffleBytes = [=](size_t Offset, size_t Size) { ShuffleChunkT ShuffleX, ShuffleResult; - detail::memcpy(&ShuffleX, XBytes + Offset, Size); + std::memcpy(&ShuffleX, XBytes + Offset, Size); ShuffleResult = SubgroupShuffleUp(ShuffleX, local_id); - detail::memcpy(ResultBytes + Offset, &ShuffleResult, Size); + std::memcpy(ResultBytes + Offset, &ShuffleResult, Size); }; GenericCall(ShuffleBytes); return Result;