Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

YixingZhang007
Copy link

@YixingZhang007 YixingZhang007 commented Oct 25, 2024

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.

ICapabilityCooperativeMatrixOffsetInstructionsINTEL = 6211
IOpCooperativeMatrixLoadOffsetINTEL = 6212
IOpCooperativeMatrixStoreOffsetINTEL = 6213

@CLAassistant
Copy link

CLAassistant commented Oct 25, 2024

CLA assistant check
All committers have signed the CLA.

@YixingZhang007 YixingZhang007 marked this pull request as draft October 25, 2024 02:15
!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}
Copy link
Contributor

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

Copy link
Author

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.

… accepts two separate arguments: the row index and the column index.
@YixingZhang007 YixingZhang007 marked this pull request as ready for review November 18, 2024 20:33
Copy link
Contributor

@MrSidims MrSidims left a 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class SPIRVJointMatrixOffsetInstructionsINTELInstBase
class SPIRVCooperativeMatrixOffsetInstructionsINTELInstBase

Copy link
Author

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, \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Copy link
Author

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
Copy link
Contributor

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...

Copy link
Author

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]]
Copy link
Contributor

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

Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants