-
Notifications
You must be signed in to change notification settings - Fork 14k
[Matrix] Propagate shape information through Select insts #141876
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4040d3f
[Matrix] Propagate shape information through Select insts
jroelofs e952bcb
Merge remote-tracking branch 'origin/main' into jroelofs/lower-matrix…
jroelofs c0c63f3
select with mismatched shape
jroelofs 5a4a6a5
no return value
jroelofs 6693f56
clean up condition lookup
jroelofs 1a4faa4
review feedback: don't take shape info from select conditions
jroelofs 48bed98
Merge remote-tracking branch 'origin/main' into jroelofs/lower-matrix…
jroelofs dc97261
Merge remote-tracking branch 'origin/main' into jroelofs/lower-matrix…
jroelofs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py | ||
; RUN: opt -passes='lower-matrix-intrinsics' -S < %s | FileCheck %s | ||
|
||
define void @select_2x2_bot(i1 %cond, ptr %lhs, ptr %rhs, ptr %out) { | ||
; CHECK-LABEL: @select_2x2_bot( | ||
; CHECK-NEXT: [[COL_LOAD:%.*]] = load <2 x float>, ptr [[LHS:%.*]], align 16 | ||
; CHECK-NEXT: [[VEC_GEP:%.*]] = getelementptr float, ptr [[LHS]], i64 2 | ||
; CHECK-NEXT: [[COL_LOAD1:%.*]] = load <2 x float>, ptr [[VEC_GEP]], align 8 | ||
; CHECK-NEXT: [[COL_LOAD2:%.*]] = load <2 x float>, ptr [[RHS:%.*]], align 16 | ||
; CHECK-NEXT: [[VEC_GEP3:%.*]] = getelementptr float, ptr [[RHS]], i64 2 | ||
; CHECK-NEXT: [[COL_LOAD4:%.*]] = load <2 x float>, ptr [[VEC_GEP3]], align 8 | ||
; CHECK-NEXT: [[TMP1:%.*]] = select i1 [[COND:%.*]], <2 x float> [[COL_LOAD]], <2 x float> [[COL_LOAD2]] | ||
; CHECK-NEXT: [[TMP2:%.*]] = select i1 [[COND]], <2 x float> [[COL_LOAD1]], <2 x float> [[COL_LOAD4]] | ||
; CHECK-NEXT: store <2 x float> [[TMP1]], ptr [[OUT:%.*]], align 4 | ||
; CHECK-NEXT: [[VEC_GEP5:%.*]] = getelementptr float, ptr [[OUT]], i64 2 | ||
; CHECK-NEXT: store <2 x float> [[TMP2]], ptr [[VEC_GEP5]], align 4 | ||
; CHECK-NEXT: ret void | ||
; | ||
%lhsv = load <4 x float>, ptr %lhs | ||
%rhsv = load <4 x float>, ptr %rhs | ||
%op = select i1 %cond, <4 x float> %lhsv, <4 x float> %rhsv | ||
jroelofs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
call void @llvm.matrix.column.major.store(<4 x float> %op, ptr %out, i64 2, i1 false, i32 2, i32 2) | ||
ret void | ||
} | ||
|
||
define void @select_2x2_lhs(i1 %cond, ptr %lhs, ptr %rhs, ptr %out) { | ||
; CHECK-LABEL: @select_2x2_lhs( | ||
; CHECK-NEXT: [[COL_LOAD:%.*]] = load <2 x float>, ptr [[LHS:%.*]], align 4 | ||
; CHECK-NEXT: [[VEC_GEP:%.*]] = getelementptr float, ptr [[LHS]], i64 2 | ||
; CHECK-NEXT: [[COL_LOAD1:%.*]] = load <2 x float>, ptr [[VEC_GEP]], align 4 | ||
; CHECK-NEXT: [[COL_LOAD2:%.*]] = load <2 x float>, ptr [[RHS:%.*]], align 16 | ||
; CHECK-NEXT: [[VEC_GEP3:%.*]] = getelementptr float, ptr [[RHS]], i64 2 | ||
; CHECK-NEXT: [[COL_LOAD4:%.*]] = load <2 x float>, ptr [[VEC_GEP3]], align 8 | ||
; CHECK-NEXT: [[TMP1:%.*]] = select i1 [[COND:%.*]], <2 x float> [[COL_LOAD]], <2 x float> [[COL_LOAD2]] | ||
; CHECK-NEXT: [[TMP2:%.*]] = select i1 [[COND]], <2 x float> [[COL_LOAD1]], <2 x float> [[COL_LOAD4]] | ||
; CHECK-NEXT: store <2 x float> [[TMP1]], ptr [[OUT:%.*]], align 16 | ||
; CHECK-NEXT: [[VEC_GEP5:%.*]] = getelementptr float, ptr [[OUT]], i64 2 | ||
; CHECK-NEXT: store <2 x float> [[TMP2]], ptr [[VEC_GEP5]], align 8 | ||
; CHECK-NEXT: ret void | ||
; | ||
%lhsv = call <4 x float> @llvm.matrix.column.major.load(ptr %lhs, i64 2, i1 false, i32 2, i32 2) | ||
%rhsv = load <4 x float>, ptr %rhs | ||
%op = select i1 %cond, <4 x float> %lhsv, <4 x float> %rhsv | ||
store <4 x float> %op, ptr %out | ||
ret void | ||
} | ||
|
||
define void @select_2x2_rhs(i1 %cond, ptr %lhs, ptr %rhs, ptr %out) { | ||
; CHECK-LABEL: @select_2x2_rhs( | ||
; CHECK-NEXT: [[COL_LOAD:%.*]] = load <2 x float>, ptr [[RHS:%.*]], align 16 | ||
; CHECK-NEXT: [[VEC_GEP:%.*]] = getelementptr float, ptr [[RHS]], i64 2 | ||
; CHECK-NEXT: [[COL_LOAD1:%.*]] = load <2 x float>, ptr [[VEC_GEP]], align 8 | ||
; CHECK-NEXT: [[COL_LOAD2:%.*]] = load <2 x float>, ptr [[RHS1:%.*]], align 4 | ||
; CHECK-NEXT: [[VEC_GEP3:%.*]] = getelementptr float, ptr [[RHS1]], i64 2 | ||
; CHECK-NEXT: [[COL_LOAD4:%.*]] = load <2 x float>, ptr [[VEC_GEP3]], align 4 | ||
; CHECK-NEXT: [[TMP1:%.*]] = select i1 [[COND:%.*]], <2 x float> [[COL_LOAD]], <2 x float> [[COL_LOAD2]] | ||
; CHECK-NEXT: [[TMP2:%.*]] = select i1 [[COND]], <2 x float> [[COL_LOAD1]], <2 x float> [[COL_LOAD4]] | ||
; CHECK-NEXT: store <2 x float> [[TMP1]], ptr [[OUT:%.*]], align 16 | ||
; CHECK-NEXT: [[VEC_GEP2:%.*]] = getelementptr float, ptr [[OUT]], i64 2 | ||
; CHECK-NEXT: store <2 x float> [[TMP2]], ptr [[VEC_GEP2]], align 8 | ||
; CHECK-NEXT: ret void | ||
; | ||
%lhsv = load <4 x float>, ptr %lhs | ||
%rhsv = call <4 x float> @llvm.matrix.column.major.load(ptr %rhs, i64 2, i1 false, i32 2, i32 2) | ||
%op = select i1 %cond, <4 x float> %lhsv, <4 x float> %rhsv | ||
store <4 x float> %op, ptr %out | ||
ret void | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.