diff --git a/sycl/include/CL/sycl/detail/spirv.hpp b/sycl/include/CL/sycl/detail/spirv.hpp index cc89053783485..ec1a5cb184fa5 100644 --- a/sycl/include/CL/sycl/detail/spirv.hpp +++ b/sycl/include/CL/sycl/detail/spirv.hpp @@ -48,7 +48,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)); } @@ -153,9 +153,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; @@ -206,9 +206,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; @@ -682,9 +682,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; @@ -697,9 +697,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; @@ -712,9 +712,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; @@ -727,9 +727,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;