-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for offset load/store #2804
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please shorten the tests - we won't need all of these metadata
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestions! I have updated the test.
0bf6ab2
to
47c9ada
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 nits, other than that the patch is LGTM
@@ -3710,6 +3710,27 @@ _SPIRV_OP(CooperativeMatrixStoreChecked, false, 8, true, 8) | |||
_SPIRV_OP(CooperativeMatrixConstructChecked, true, 8) | |||
#undef _SPIRV_OP | |||
|
|||
class SPIRVJointMatrixOffsetInstructionsINTELInstBase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class SPIRVJointMatrixOffsetInstructionsINTELInstBase | |
class SPIRVCooperativeMatrixOffsetInstructionsINTELInstBase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I have fixed this :)
|
||
#define _SPIRV_OP(x, ...) \ | ||
typedef SPIRVInstTemplate< \ | ||
SPIRVJointMatrixOffsetInstructionsINTELInstBase, \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets use KHR/SPV_KHR_cooperative_matrix test as the template...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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