Skip to content

Commit ebcc223

Browse files
committed
Offset subgroup read/write by subgroup id
1 parent a4f74a9 commit ebcc223

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libdevice/nativecpu_utils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ __spirv_MemoryBarrier(uint32_t Memory, uint32_t Semantics) {
6565
template <> \
6666
__SYCL_CONVERGENT__ DEVICE_EXTERNAL Type \
6767
__spirv_SubgroupBlockReadINTEL<Type>(const OCL_GLOBAL PType *Ptr) noexcept { \
68-
return *Ptr; \
68+
return Ptr[__spirv_SubgroupLocalInvocationId()]; \
6969
} \
7070
template <> \
7171
__SYCL_CONVERGENT__ DEVICE_EXTERNAL void \
7272
__spirv_SubgroupBlockWriteINTEL<Type>(PType OCL_GLOBAL * ptr, \
7373
Type v) noexcept { \
74-
*(Type *)ptr = v; \
74+
((Type*)ptr)[__spirv_SubgroupLocalInvocationId()] = v; \
7575
}
7676

7777
#define DefSubgroupBlockINTEL_vt(Type, VT_name) \

0 commit comments

Comments
 (0)