Skip to content

Commit 3625ac8

Browse files
committed
[SYCL] Use encoding in SPIR-V for subgroup methods.
Also the following changes applied: - enable vector types for shuffle functions; - fixed multiple type definition issue; - fixed builtin signatures to fit GPU requirements; - improved LIT tests covering subgroup feature; - added check for global adress space of pointers used in load/store methods; - added input types verification for template methods. Signed-off-by: Vladimir Lazarev <[email protected]>
1 parent 1c25d07 commit 3625ac8

File tree

18 files changed

+705
-534
lines changed

18 files changed

+705
-534
lines changed

sycl/include/CL/__spirv/spirv_ops.hpp

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,54 @@ __SPIRV_ATOMICS(__SPIRV_ATOMIC_UNSIGNED, unsigned long long)
110110
__SPIRV_ATOMICS(__SPIRV_ATOMIC_MINMAX, Min)
111111
__SPIRV_ATOMICS(__SPIRV_ATOMIC_MINMAX, Max)
112112

113+
extern bool OpGroupAll(int32_t Scope, bool Predicate) noexcept;
114+
115+
extern bool OpGroupAny(int32_t Scope, bool Predicate) noexcept;
116+
117+
template <typename dataT>
118+
extern dataT OpGroupBroadcast(int32_t Scope, dataT Value,
119+
uint32_t LocalId) noexcept;
120+
121+
template <typename dataT>
122+
extern dataT OpGroupIAdd(int32_t Scope, int32_t Op, dataT Value) noexcept;
123+
template <typename dataT>
124+
extern dataT OpGroupFAdd(int32_t Scope, int32_t Op, dataT Value) noexcept;
125+
template <typename dataT>
126+
extern dataT OpGroupUMin(int32_t Scope, int32_t Op, dataT Value) noexcept;
127+
template <typename dataT>
128+
extern dataT OpGroupSMin(int32_t Scope, int32_t Op, dataT Value) noexcept;
129+
template <typename dataT>
130+
extern dataT OpGroupFMin(int32_t Scope, int32_t Op, dataT Value) noexcept;
131+
template <typename dataT>
132+
extern dataT OpGroupUMax(int32_t Scope, int32_t Op, dataT Value) noexcept;
133+
template <typename dataT>
134+
extern dataT OpGroupSMax(int32_t Scope, int32_t Op, dataT Value) noexcept;
135+
template <typename dataT>
136+
extern dataT OpGroupFMax(int32_t Scope, int32_t Op, dataT Value) noexcept;
137+
template <typename dataT>
138+
extern dataT OpSubgroupShuffleINTEL(dataT Data, uint32_t InvocationId) noexcept;
139+
template <typename dataT>
140+
extern dataT OpSubgroupShuffleDownINTEL(dataT Current, dataT Next,
141+
uint32_t Delta) noexcept;
142+
template <typename dataT>
143+
extern dataT OpSubgroupShuffleUpINTEL(dataT Previous, dataT Current,
144+
uint32_t Delta) noexcept;
145+
template <typename dataT>
146+
extern dataT OpSubgroupShuffleXorINTEL(dataT Data, uint32_t Value) noexcept;
147+
148+
template <typename dataT>
149+
extern dataT OpSubgroupBlockReadINTEL(const __global uint16_t *Ptr) noexcept;
150+
151+
template <typename dataT>
152+
extern void OpSubgroupBlockWriteINTEL(__global uint16_t *Ptr,
153+
dataT Data) noexcept;
154+
155+
template <typename dataT>
156+
extern dataT OpSubgroupBlockReadINTEL(const __global uint32_t *Ptr) noexcept;
157+
158+
template <typename dataT>
159+
extern void OpSubgroupBlockWriteINTEL(__global uint32_t *Ptr,
160+
dataT Data) noexcept;
113161
#else
114162

115163
template <typename dataT>

sycl/include/CL/__spirv/spirv_types.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@ enum MemorySemantics {
4444
// Only in such cases the class is recognized as SPIRV type OpTypeEvent.
4545
class OpTypeEvent;
4646

47+
enum GroupOperation { Reduce = 0, InclusiveScan = 1, ExclusiveScan = 2 };
4748
} // namespace __spirv
4849
} // namespace cl

sycl/include/CL/__spirv/spirv_vars.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ DEFINE_INT_ID_TO_XYZ_CONVERTER(GlobalOffset)
3636

3737
#undef DEFINE_INT_ID_TO_XYZ_CONVERTER
3838

39+
extern const __constant uint32_t VarSubgroupSize;
40+
extern const __constant uint32_t VarSubgroupMaxSize;
41+
extern const __constant uint32_t VarNumSubgroups;
42+
extern const __constant uint32_t VarNumEnqueuedSubgroups;
43+
extern const __constant uint32_t VarSubgroupId;
44+
extern const __constant uint32_t VarSubgroupLocalInvocationId;
45+
3946
} // namespace __spirv
4047
} // namespace cl
4148
#endif // __SYCL_DEVICE_ONLY__

0 commit comments

Comments
 (0)