-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[LowerMatrixIntrinsics] Fix type suffix for matrix.multiply.* #100940
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
Conversation
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write If you have received no comments on your PR for a week, you can request a review If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
@llvm/pr-subscribers-llvm-transforms Author: sbite0138 (sbite0138) ChangesBased on the proposal PDF and the test code under llvm/test/Transforms/LowerMatrixIntrinsics, the suffix for the This PR corrects the places where these suffixes do not follow the aforementioned format. Full diff: https://github.com/llvm/llvm-project/pull/100940.diff 4 Files Affected:
diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double-row-major.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double-row-major.ll
index c196de17c4fe3..1638c1b1dd867 100644
--- a/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double-row-major.ll
+++ b/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double-row-major.ll
@@ -246,8 +246,8 @@ define <9 x double> @multiply_2x3(<6 x double> %a, <6 x double> %b) {
; CHECK-NEXT: ret <9 x double> [[TMP65]]
;
entry:
- %c = call <9 x double> @llvm.matrix.multiply.v6f64.v6f64.v6f64(<6 x double> %a, <6 x double> %b, i32 3, i32 2, i32 3)
+ %c = call <9 x double> @llvm.matrix.multiply.v9f64.v6f64.v6f64(<6 x double> %a, <6 x double> %b, i32 3, i32 2, i32 3)
ret <9 x double> %c
}
-declare <9 x double> @llvm.matrix.multiply.v6f64.v6f64.v6f64(<6 x double>, <6 x double>, i32, i32, i32)
+declare <9 x double> @llvm.matrix.multiply.v9f64.v6f64.v6f64(<6 x double>, <6 x double>, i32, i32, i32)
diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double.ll
index c27dd0ceaea60..fa07c51630305 100644
--- a/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double.ll
+++ b/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double.ll
@@ -246,8 +246,8 @@ define <9 x double> @multiply_2x3(<6 x double> %a, <6 x double> %b) {
; CHECK-NEXT: ret <9 x double> [[TMP65]]
;
entry:
- %c = call <9 x double> @llvm.matrix.multiply.v6f64.v6f64.v6f64(<6 x double> %a, <6 x double> %b, i32 3, i32 2, i32 3)
+ %c = call <9 x double> @llvm.matrix.multiply.v9f64.v6f64.v6f64(<6 x double> %a, <6 x double> %b, i32 3, i32 2, i32 3)
ret <9 x double> %c
}
-declare <9 x double> @llvm.matrix.multiply.v6f64.v6f64.v6f64(<6 x double>, <6 x double>, i32, i32, i32)
+declare <9 x double> @llvm.matrix.multiply.v9f64.v6f64.v6f64(<6 x double>, <6 x double>, i32, i32, i32)
diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-i32-row-major.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-i32-row-major.ll
index d7e3f92354f5f..8ad9e2e77860a 100644
--- a/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-i32-row-major.ll
+++ b/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-i32-row-major.ll
@@ -67,11 +67,11 @@ define <4 x i32> @multiply_2x2(<4 x i32> %a, <4 x i32> %b) {
; RM-NEXT: ret <4 x i32> [[TMP28]]
;
entry:
- %c = call <4 x i32> @llvm.matrix.multiply.v4f64.v4f64.v4f64(<4 x i32> %a, <4 x i32> %b, i32 2, i32 2, i32 2)
+ %c = call <4 x i32> @llvm.matrix.multiply.v4i32.v4i32.v4i32(<4 x i32> %a, <4 x i32> %b, i32 2, i32 2, i32 2)
ret <4 x i32> %c
}
-declare <4 x i32> @llvm.matrix.multiply.v4f64.v4f64.v4f64(<4 x i32>, <4 x i32>, i32, i32, i32)
+declare <4 x i32> @llvm.matrix.multiply.v4i32.v4i32.v4i32(<4 x i32>, <4 x i32>, i32, i32, i32)
define <4 x i32> @multiply_1x2(<2 x i32> %a, <2 x i32> %b) {
; RM-LABEL: @multiply_1x2(
@@ -111,11 +111,11 @@ define <4 x i32> @multiply_1x2(<2 x i32> %a, <2 x i32> %b) {
; RM-NEXT: ret <4 x i32> [[TMP16]]
;
entry:
- %c = call <4 x i32> @llvm.matrix.multiply.v4f64.v2f64.v2f64(<2 x i32> %a, <2 x i32> %b, i32 2, i32 1, i32 2)
+ %c = call <4 x i32> @llvm.matrix.multiply.v4i32.v2i32.v2i32(<2 x i32> %a, <2 x i32> %b, i32 2, i32 1, i32 2)
ret <4 x i32> %c
}
-declare <4 x i32> @llvm.matrix.multiply.v4f64.v2f64.v2f64(<2 x i32>, <2 x i32>, i32, i32, i32)
+declare <4 x i32> @llvm.matrix.multiply.v4i32.v2i32.v2i32(<2 x i32>, <2 x i32>, i32, i32, i32)
define <9 x i32> @multiply_2x3(<6 x i32> %a, <6 x i32> %b) {
; RM-LABEL: @multiply_2x3(
@@ -248,8 +248,8 @@ define <9 x i32> @multiply_2x3(<6 x i32> %a, <6 x i32> %b) {
; RM-NEXT: ret <9 x i32> [[TMP65]]
;
entry:
- %c = call <9 x i32> @llvm.matrix.multiply.v6f64.v6f64.v6f64(<6 x i32> %a, <6 x i32> %b, i32 3, i32 2, i32 3)
+ %c = call <9 x i32> @llvm.matrix.multiply.v9i32.v6i32.v6i32(<6 x i32> %a, <6 x i32> %b, i32 3, i32 2, i32 3)
ret <9 x i32> %c
}
-declare <9 x i32> @llvm.matrix.multiply.v6f64.v6f64.v6f64(<6 x i32>, <6 x i32>, i32, i32, i32)
+declare <9 x i32> @llvm.matrix.multiply.v9i32.v6i32.v6i32(<6 x i32>, <6 x i32>, i32, i32, i32)
diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-i32.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-i32.ll
index 1fbc7a2c0b87a..243cf84b64647 100644
--- a/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-i32.ll
+++ b/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-i32.ll
@@ -246,8 +246,8 @@ define <9 x i32> @multiply_2x3(<6 x i32> %a, <6 x i32> %b) {
; CHECK-NEXT: ret <9 x i32> [[TMP65]]
;
entry:
- %c = call <9 x i32> @llvm.matrix.multiply.v6i32.v6i32.v6i32(<6 x i32> %a, <6 x i32> %b, i32 3, i32 2, i32 3)
+ %c = call <9 x i32> @llvm.matrix.multiply.v9i32.v6i32.v6i32(<6 x i32> %a, <6 x i32> %b, i32 3, i32 2, i32 3)
ret <9 x i32> %c
}
-declare <9 x i32> @llvm.matrix.multiply.v6i32.v6i32.v6i32(<6 x i32>, <6 x i32>, i32, i32, i32)
+declare <9 x i32> @llvm.matrix.multiply.v9i32.v6i32.v6i32(<6 x i32>, <6 x i32>, i32, i32, i32)
|
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, thanks!
Very interesting to see that this isn't caught by the IR verifier. Would be interesting to follow up to see if the verifier could be extended to catch those violations.
|
Thank you for the approval! I agree that it would be great if the verifier could detect such places, and I am interested in extending it to catch these violations. However, I am not very familiar with the internals of LLVM, so it might take me some time to investigate and implement improvements. By the way, as mentioned above in the thread, I have turned off the "Keep my email addresses private" setting in response to the GitHub Actions bot's message. Is there anything else I need to do? (Do I need to rebase or anything else?) |
There are already verifier checks for matrix intrinsics here: https://github.com/llvm/llvm-project/blob/main/llvm/lib/IR/Verifier.cpp#L5992 Not sure how to get the mangled types for the intrinsic though.
I think that should be good now. |
@sbite0138 Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested Please check whether problems have been caused by your change specifically, as How to do this, and the rest of the post-merge process, is covered in detail here. If your change does cause a problem, it may be reverted, or you can revert it yourself. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! |
@sbite0138 please let me know if there's anything I could do to help |
Based on the proposal PDF and the test code under llvm/test/Transforms/LowerMatrixIntrinsics, the suffix for the
@llvm.matrix.multiply.*
intrinsic should be {output matrix type}.{input matrix 1 type}.{input matrix 2 type} (e.g.,@llvm.matrix.multiply.v4i32.v4i32.v4i32
).This PR corrects the places where these suffixes do not follow the aforementioned format.