Add support for offset load/store#2804
Conversation
| !4 = !{} | ||
| !5 = !{i16 6, i16 14} | ||
| !6 = !{!"-ze-opt-level=O2"} | ||
| !7 = !{!"ModuleMD", !8, !9, !111, !112, !143, !144, !148, !151, !152, !153, !189, !215, !228, !229, !230, !246, !247, !248, !249, !250, !251, !252, !253, !254, !255, !259, !260, !267, !268, !269, !270, !271, !272, !273, !274, !275, !276, !277, !278, !280, !284, !285, !286, !287, !288, !289, !290, !291, !292, !293, !294, !295, !296, !297, !298, !299, !300, !301, !302, !303, !304, !305, !307, !310, !311, !312, !314, !315, !316, !321} |
There was a problem hiding this comment.
Please shorten the tests - we won't need all of these metadata
There was a problem hiding this comment.
Thanks for the suggestions! I have updated the test.
0bf6ab2 to
47c9ada
Compare
MrSidims
left a comment
There was a problem hiding this comment.
2 nits, other than that the patch is LGTM
| _SPIRV_OP(CooperativeMatrixConstructChecked, true, 8) | ||
| #undef _SPIRV_OP | ||
|
|
||
| class SPIRVJointMatrixOffsetInstructionsINTELInstBase |
There was a problem hiding this comment.
| class SPIRVJointMatrixOffsetInstructionsINTELInstBase | |
| class SPIRVCooperativeMatrixOffsetInstructionsINTELInstBase |
There was a problem hiding this comment.
Thanks! I have fixed this :)
|
|
||
| #define _SPIRV_OP(x, ...) \ | ||
| typedef SPIRVInstTemplate< \ | ||
| SPIRVJointMatrixOffsetInstructionsINTELInstBase, \ |
There was a problem hiding this comment.
I have also fixed this.
| @@ -0,0 +1,152 @@ | |||
| ; This is an adapted copy of test/extensions/INTEL/SPV_INTEL_joint_matrix/joint_matrix.ll | |||
There was a problem hiding this comment.
Lets use KHR/SPV_KHR_cooperative_matrix test as the template...
There was a problem hiding this comment.
Thanks for the suggestions! I have updated the test :)
| ; CHECK-SPIRV: CooperativeMatrixLoadOffsetINTEL [[#MatTy1]] | ||
| ; CHECK-SPIRV: CooperativeMatrixLoadOffsetINTEL [[#MatTy2]] | ||
| ; CHECK-SPIRV: CooperativeMatrixLoadOffsetINTEL [[#MatTy3]] | ||
| ; CHECK-SPIRV: JointMatrixMadINTEL [[#MatTy1]] |
There was a problem hiding this comment.
...so here we would have CooperativeMatrixMulAddKHR instruction.
Reason: JointMatrixMadINTEL will be deprecated. And real-life SYCL joint_matrix workflows with switch to cooperative matrix KHR when intel/llvm#16045 is merged
There was a problem hiding this comment.
Thanks! I have change this.
ff970c8 to
4dca946
Compare
|
@vmaksimo I just did some code clean up. Could you please help review this PR? Thanks for helping :) |
|
Spec is available as rev 17 of intel/llvm#12497 |
|
CI issue was fixed in main by 4a85dd8, please rebase on top to get CI passing |
| _SPIRV_OP(CooperativeMatrixLoadOffset, true, 8, true, 6) | ||
| _SPIRV_OP(CooperativeMatrixStoreOffset, false, 7, true, 7) |
There was a problem hiding this comment.
Please verify that the last optional operand Memory Operand is really translated as Literal to SPIR-V (there are no checks for that in test, so the bug can be hidden). If no, please apply my suggestion, it should work this way if I'm not misunderstanding
| _SPIRV_OP(CooperativeMatrixLoadOffset, true, 8, true, 6) | |
| _SPIRV_OP(CooperativeMatrixStoreOffset, false, 7, true, 7) | |
| _SPIRV_OP(CooperativeMatrixLoadOffset, true, 8, true, 5) | |
| _SPIRV_OP(CooperativeMatrixStoreOffset, false, 7, true, 6) |
There was a problem hiding this comment.
Hello Viktoria! Thanks so much for the suggestion! I have checked that the last operand Memory Operand is not translated to Literal. I have applied the suggested change :)
… accepts two separate arguments: the row index and the column index.
4dca946 to
3fbd371
Compare
vmaksimo
left a comment
There was a problem hiding this comment.
LGTM.
Applying the suggestion is not required to get this merged.
test/extensions/INTEL/SPV_INTEL_joint_matrix/joint_matrix_load_store_offset.ll
Outdated
Show resolved
Hide resolved
|
@vmaksimo Could you please help merge this PR or if I need to get approval from anyone else? Thanks! |
Add a new form of load/store operations for cooperative matrices that accepts two separate arguments: the row index and the column index. Unlike the original approach requiring a pointer to the matrix base, this new form of load/store operations is expected to yield better optimized code on 2dblock read/write instructions on PVC.
CapabilityCooperativeMatrixOffsetInstructionsINTEL = 6238
OpCooperativeMatrixLoadOffsetINTEL = 6239
OpCooperativeMatrixStoreOffsetINTEL = 6240