-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[DXIL] Remove incompatible metadata types when preparing DXIL. #136386
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 all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c1a89d6
add md node type filter, and test
bob80905 0399c6f
add dxil prepare pass
bob80905 19de155
remove hlsl file
bob80905 416084c
drop tbaa and memparallelloopaccess, add 3 dx mds, simplify test
bob80905 84ad1d4
prune whitelist
bob80905 fb2932e
address Justin
bob80905 b18f093
remove nonuniform test, patternmatch vars, simplify test description
bob80905 58683b6
address Justin
bob80905 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
bogner marked this conversation as resolved.
Show resolved
Hide resolved
|
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,32 @@ | ||
; RUN: opt -S --dxil-prepare %s | FileCheck %s | ||
|
||
; Test that only metadata nodes that are valid in DXIL are allowed through | ||
|
||
target triple = "dxilv1.0-unknown-shadermodel6.0-compute" | ||
|
||
; Function Attrs: noinline nounwind memory(readwrite, inaccessiblemem: none) | ||
define void @main(i32* %ptr) { | ||
entry: | ||
; metadata ID changes to 0 once the current !0 and !1 are removed | ||
; since they aren't in the allowlist. range needs a payload. | ||
; CHECK: %val = load i32, ptr %ptr, align 4, !range [[RANGEMD:![0-9]+]] | ||
%val = load i32, ptr %ptr, align 4, !range !2 | ||
|
||
%cmp.i = icmp ult i32 1, 2 | ||
; Ensure that the !llvm.loop metadata node gets dropped. | ||
; CHECK: br i1 %cmp.i, label %_Z4mainDv3_j.exit, label %_Z4mainDv3_j.exit{{$}} | ||
br i1 %cmp.i, label %_Z4mainDv3_j.exit, label %_Z4mainDv3_j.exit, !llvm.loop !0 | ||
|
||
_Z4mainDv3_j.exit: ; preds = %for.body.i, %entry | ||
ret void | ||
} | ||
|
||
; These next check lines check that only the range metadata remains | ||
; No more metadata should be necessary, the rest (the current 0 and 1) | ||
; should be removed. | ||
; CHECK-NOT: !{!"llvm.loop.mustprogress"} | ||
; CHECK: [[RANGEMD]] = !{i32 1, i32 5} | ||
; CHECK-NOT: !{!"llvm.loop.mustprogress"} | ||
!0 = distinct !{!0, !1} | ||
!1 = !{!"llvm.loop.mustprogress"} | ||
!2 = !{i32 1, i32 5} |
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.
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.
DXILPrepare has a bunch of overlap with the legalization pass. Seems like MetaData might not be able to move because legalization is a function level pass and this is a module level one, but at a minimum it seems like FNeg -> FSub should move.
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 agree. I think DXILPrepare should do things like translate attributes and metadata, insert no-op bitcasts to appease the bitcode writer, and that sort of thing. Replacing ops with their equivalents should squarely be a part of legalization, not here.
I've filed #137685