Skip to content

Commit 47c9ada

Browse files
Add a new form of load/store operations for cooperative matrices that accepts two separate arguments: the row index and the column index.
1 parent 196bbc9 commit 47c9ada

File tree

7 files changed

+189
-0
lines changed

7 files changed

+189
-0
lines changed

lib/SPIRV/SPIRVReader.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3540,6 +3540,7 @@ Instruction *SPIRVToLLVM::transSPIRVBuiltinFromInst(SPIRVInstruction *BI,
35403540
case internal::OpJointMatrixLoadINTEL:
35413541
case OpCooperativeMatrixLoadKHR:
35423542
case internal::OpCooperativeMatrixLoadCheckedINTEL:
3543+
case internal::OpCooperativeMatrixLoadOffsetINTEL:
35433544
case internal::OpTaskSequenceCreateINTEL:
35443545
case internal::OpConvertHandleToImageINTEL:
35453546
case internal::OpConvertHandleToSampledImageINTEL:

lib/SPIRV/libSPIRV/SPIRVEnum.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ template <> inline void SPIRVMap<SPIRVCapabilityKind, SPIRVCapVec>::init() {
221221
{CapabilityCooperativeMatrixKHR});
222222
ADD_VEC_INIT(internal::CapabilityCooperativeMatrixCheckedInstructionsINTEL,
223223
{CapabilityCooperativeMatrixKHR});
224+
ADD_VEC_INIT(internal::CapabilityCooperativeMatrixOffsetInstructionsINTEL,
225+
{CapabilityCooperativeMatrixKHR});
224226
}
225227

226228
template <> inline void SPIRVMap<SPIRVExecutionModelKind, SPIRVCapVec>::init() {

lib/SPIRV/libSPIRV/SPIRVInstruction.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3710,6 +3710,27 @@ _SPIRV_OP(CooperativeMatrixStoreChecked, false, 8, true, 8)
37103710
_SPIRV_OP(CooperativeMatrixConstructChecked, true, 8)
37113711
#undef _SPIRV_OP
37123712

3713+
class SPIRVJointMatrixOffsetInstructionsINTELInstBase
3714+
: public SPIRVInstTemplateBase {
3715+
protected:
3716+
std::optional<ExtensionID> getRequiredExtension() const override {
3717+
return ExtensionID::SPV_INTEL_joint_matrix;
3718+
}
3719+
SPIRVCapVec getRequiredCapability() const override {
3720+
return getVec(
3721+
internal::CapabilityCooperativeMatrixOffsetInstructionsINTEL);
3722+
}
3723+
};
3724+
3725+
#define _SPIRV_OP(x, ...) \
3726+
typedef SPIRVInstTemplate< \
3727+
SPIRVJointMatrixOffsetInstructionsINTELInstBase, \
3728+
internal::Op##x##INTEL, __VA_ARGS__> \
3729+
SPIRV##x##INTEL;
3730+
_SPIRV_OP(CooperativeMatrixLoadOffset, true, 8, true, 6)
3731+
_SPIRV_OP(CooperativeMatrixStoreOffset, false, 7, true, 7)
3732+
#undef _SPIRV_OP
3733+
37133734
class SPIRVCooperativeMatrixInvocationInstructionsINTELInstBase
37143735
: public SPIRVInstTemplateBase {
37153736
protected:

lib/SPIRV/libSPIRV/SPIRVNameMapEnum.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,8 @@ template <> inline void SPIRVMap<Capability, std::string>::init() {
671671
"CooperativeMatrixInvocationInstructionsINTEL");
672672
add(internal::CapabilityCooperativeMatrixCheckedInstructionsINTEL,
673673
"CooperativeMatrixCheckedInstructionsINTEL");
674+
add(internal::CapabilityCooperativeMatrixOffsetInstructionsINTEL,
675+
"CooperativeMatrixOffsetInstructionsINTEL");
674676
add(internal::CapabilitySubgroupRequirementsINTEL,
675677
"SubgroupRequirementsINTEL");
676678
add(internal::CapabilityTaskSequenceINTEL, "TaskSequenceINTEL");

lib/SPIRV/libSPIRV/SPIRVOpCodeEnumInternal.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ _SPIRV_OP_INTERNAL(CooperativeMatrixLoadCheckedINTEL,
2222
internal::OpCooperativeMatrixLoadCheckedINTEL)
2323
_SPIRV_OP_INTERNAL(CooperativeMatrixStoreCheckedINTEL,
2424
internal::OpCooperativeMatrixStoreCheckedINTEL)
25+
_SPIRV_OP_INTERNAL(CooperativeMatrixLoadOffsetINTEL,
26+
internal::OpCooperativeMatrixLoadOffsetINTEL)
27+
_SPIRV_OP_INTERNAL(CooperativeMatrixStoreOffsetINTEL,
28+
internal::OpCooperativeMatrixStoreOffsetINTEL)
2529
_SPIRV_OP_INTERNAL(CooperativeMatrixConstructCheckedINTEL,
2630
internal::OpCooperativeMatrixConstructCheckedINTEL)
2731
_SPIRV_OP_INTERNAL(CooperativeMatrixApplyFunctionINTEL,

lib/SPIRV/libSPIRV/spirv_internal.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ enum InternalOp {
7777
IOpCooperativeMatrixLoadCheckedINTEL = 6193,
7878
IOpCooperativeMatrixStoreCheckedINTEL = 6194,
7979
IOpCooperativeMatrixConstructCheckedINTEL = 6195,
80+
IOpCooperativeMatrixLoadOffsetINTEL = 6212,
81+
IOpCooperativeMatrixStoreOffsetINTEL = 6213,
8082
IOpJointMatrixWorkItemLengthINTEL = 6410,
8183
IOpTypeTaskSequenceINTEL = 6199,
8284
IOpComplexFMulINTEL = 6415,
@@ -114,6 +116,7 @@ enum InternalCapability {
114116
ICapGlobalVariableDecorationsINTEL = 6146,
115117
ICapabilityTaskSequenceINTEL = 6162,
116118
ICapabilityCooperativeMatrixCheckedInstructionsINTEL = 6192,
119+
ICapabilityCooperativeMatrixOffsetInstructionsINTEL = 6211,
117120
ICapabilityCooperativeMatrixPrefetchINTEL = 6411,
118121
ICapabilityComplexFloatMulDivINTEL = 6414,
119122
ICapabilityTensorFloat32RoundingINTEL = 6425,
@@ -187,6 +190,10 @@ _SPIRV_OP(Op, CooperativeMatrixLoadCheckedINTEL)
187190
_SPIRV_OP(Op, CooperativeMatrixStoreCheckedINTEL)
188191
_SPIRV_OP(Op, CooperativeMatrixConstructCheckedINTEL)
189192

193+
_SPIRV_OP(Capability, CooperativeMatrixOffsetInstructionsINTEL)
194+
_SPIRV_OP(Op, CooperativeMatrixLoadOffsetINTEL)
195+
_SPIRV_OP(Op, CooperativeMatrixStoreOffsetINTEL)
196+
190197
_SPIRV_OP(Capability, CooperativeMatrixInvocationInstructionsINTEL)
191198
_SPIRV_OP(Op, CooperativeMatrixApplyFunctionINTEL)
192199

0 commit comments

Comments
 (0)