-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[SPIRV] Implement handle_fromBinding intrinsic. #111052
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
+164
−9
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
dc691ca
[SPIRV] Implement image_fromBinding intrinsic.
s-perron 59a2ca4
Fixs from code review.
s-perron 39e39f6
Use foldImm
s-perron a0c5f9b
Redo the name for the resource.
s-perron b9cba8d
Fix typo
s-perron 44a525b
Merge branch 'main' into image_from_binding
s-perron 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
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
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,58 @@ | ||
| ; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-vulkan-library %s -o - | FileCheck %s | ||
| ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-vulkan-library %s -o - -filetype=obj | spirv-val %} | ||
|
|
||
| ; CHECK-DAG: OpDecorate [[IntBufferVar:%[0-9]+]] DescriptorSet 16 | ||
| ; CHECK-DAG: OpDecorate [[IntBufferVar]] Binding 7 | ||
| ; CHECK-DAG: OpDecorate [[FloatBufferVar:%[0-9]+]] DescriptorSet 16 | ||
| ; CHECK-DAG: OpDecorate [[FloatBufferVar]] Binding 7 | ||
|
|
||
| ; CHECK-DAG: [[float:%[0-9]+]] = OpTypeFloat 32 | ||
| ; CHECK-DAG: [[int:%[0-9]+]] = OpTypeInt 32 0 | ||
| ; CHECK-DAG: [[RWBufferTypeInt:%[0-9]+]] = OpTypeImage [[int]] Buffer 2 0 0 2 R32i {{$}} | ||
| ; CHECK-DAG: [[RWBufferTypeFloat:%[0-9]+]] = OpTypeImage [[float]] Buffer 2 0 0 2 R32f {{$}} | ||
| ; CHECK-DAG: [[IntBufferPtrType:%[0-9]+]] = OpTypePointer UniformConstant [[RWBufferTypeInt]] | ||
| ; CHECK-DAG: [[FloatBufferPtrType:%[0-9]+]] = OpTypePointer UniformConstant [[RWBufferTypeFloat]] | ||
| ; CHECK-DAG: [[IntBufferVar]] = OpVariable [[IntBufferPtrType]] UniformConstant | ||
| ; CHECK-DAG: [[FloatBufferVar]] = OpVariable [[FloatBufferPtrType]] UniformConstant | ||
|
|
||
| ; CHECK: {{%[0-9]+}} = OpFunction {{%[0-9]+}} DontInline {{%[0-9]+}} | ||
| ; CHECK-NEXT: OpLabel | ||
| define void @RWBufferLoad() #0 { | ||
| ; CHECK-NEXT: [[buffer:%[0-9]+]] = OpLoad [[RWBufferTypeInt]] [[IntBufferVar]] | ||
| %buffer0 = call target("spirv.Image", i32, 5, 2, 0, 0, 2, 24) | ||
| @llvm.spv.handle.fromBinding.tspirv.Image_f32_5_2_0_0_2_24( | ||
| i32 16, i32 7, i32 1, i32 0, i1 false) | ||
|
|
||
| ; Make sure we use the same variable with multiple loads. | ||
| ; CHECK-NEXT: [[buffer:%[0-9]+]] = OpLoad [[RWBufferTypeInt]] [[IntBufferVar]] | ||
| %buffer1 = call target("spirv.Image", i32, 5, 2, 0, 0, 2, 24) | ||
| @llvm.spv.handle.fromBinding.tspirv.Image_f32_5_2_0_0_2_24( | ||
| i32 16, i32 7, i32 1, i32 0, i1 false) | ||
| ret void | ||
| } | ||
|
|
||
| ; CHECK: {{%[0-9]+}} = OpFunction {{%[0-9]+}} DontInline {{%[0-9]+}} | ||
| ; CHECK-NEXT: OpLabel | ||
| define void @UseDifferentGlobalVar() #0 { | ||
| ; Make sure we use a different variable from the first function. They have | ||
| ; different types. | ||
| ; CHECK-NEXT: [[buffer:%[0-9]+]] = OpLoad [[RWBufferTypeFloat]] [[FloatBufferVar]] | ||
| %buffer0 = call target("spirv.Image", float, 5, 2, 0, 0, 2, 3) | ||
| @llvm.spv.handle.fromBinding.tspirv.Image_f32_5_2_0_0_2_3( | ||
| i32 16, i32 7, i32 1, i32 0, i1 false) | ||
| ret void | ||
| } | ||
|
|
||
| ; CHECK: {{%[0-9]+}} = OpFunction {{%[0-9]+}} DontInline {{%[0-9]+}} | ||
| ; CHECK-NEXT: OpLabel | ||
| define void @ReuseGlobalVarFromFirstFunction() #0 { | ||
| ; Make sure we use the same variable as the first function. They should be the | ||
| ; same in case one function calls the other. | ||
| ; CHECK-NEXT: [[buffer:%[0-9]+]] = OpLoad [[RWBufferTypeInt]] [[IntBufferVar]] | ||
| %buffer1 = call target("spirv.Image", i32, 5, 2, 0, 0, 2, 24) | ||
| @llvm.spv.handle.fromBinding.tspirv.Image_f32_5_2_0_0_2_24( | ||
| i32 16, i32 7, i32 1, i32 0, i1 false) | ||
| ret void | ||
| } | ||
|
|
||
| attributes #0 = { convergent noinline norecurse "frame-pointer"="all" "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" "no-trapping-math"="true" "stack-protector-buffer-size"="8" } |
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.