forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPIRV] Make access qualifier optional for spirv.Image type (llvm#110852
) The SPIRV backend has a special type named `spirv.Image`. This type is meant to correspond to the OpTypeImage instruction in SPIR-V, but there is one difference. The access qualifier operand in OpTypeImage is optional. On top of that, the access qualifiers are only valid for kernels, and not for shaders. We want to reuse this type when generating shader from HLSL, but we can't use the access qualifier. This commit make the access qualifer optional in the target extension type. The same is done for `spirv.SampledImage`. Contributes to llvm#81036
- Loading branch information
Showing
8 changed files
with
87 additions
and
29 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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,20 @@ | ||
; 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-NOT: OpCapability ImageBasic | ||
; CHECK-NOT: OpCapability ImageReadWrite | ||
; CHECK: OpCapability ImageBuffer | ||
; CHECK-NOT: OpCapability ImageBasic | ||
; CHECK-NOT: OpCapability ImageReadWrite | ||
|
||
; CHECK-DAG: [[Float:%[0-9]+]] = OpTypeFloat 32 | ||
; CHECK-DAG: [[Void:%[0-9]+]] = OpTypeVoid | ||
; CHECK-DAG: [[ImageType:%[0-9]+]] = OpTypeImage [[Float]] Buffer 2 0 0 2 R32i {{$}} | ||
; CHECK-DAG: [[ImageFuncType:%[0-9]+]] = OpTypeFunction [[Void]] [[ImageType]] | ||
|
||
; CHECK: {{%[0-9]+}} = OpFunction [[Void]] DontInline [[ImageFuncType]] | ||
define void @ImageWithNoAccessQualifier(target("spirv.Image", float, 5, 2, 0, 0, 2, 24) %img) #0 { | ||
ret void | ||
} | ||
|
||
attributes #0 = { convergent noinline norecurse "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" } |
This file contains 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,21 @@ | ||
; 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: [[Float:%[0-9]+]] = OpTypeFloat 32 | ||
; CHECK-DAG: [[Void:%[0-9]+]] = OpTypeVoid | ||
; CHECK-DAG: [[ImageType:%[0-9]+]] = OpTypeImage [[Float]] Buffer 2 0 0 1 R32i {{$}} | ||
; CHECK-DAG: [[ImageFuncType:%[0-9]+]] = OpTypeFunction [[Void]] [[ImageType]] | ||
; CHECK-DAG: [[SampledImageType:%[0-9]+]] = OpTypeSampledImage [[ImageType]] | ||
; CHECK-DAG: [[SampledImageFuncType:%[0-9]+]] = OpTypeFunction [[Void]] [[SampledImageType]] | ||
|
||
; CHECK: {{%[0-9]+}} = OpFunction [[Void]] DontInline [[ImageFuncType]] | ||
define void @ImageWithNoAccessQualifier(target("spirv.Image", float, 5, 2, 0, 0, 1, 24) %img) #0 { | ||
ret void | ||
} | ||
|
||
; CHECK: {{%[0-9]+}} = OpFunction [[Void]] DontInline [[SampledImageFuncType]] | ||
define void @SampledImageWithNoAccessQualifier(target("spirv.SampledImage", float, 5, 2, 0, 0, 1, 24) %img) #0 { | ||
ret void | ||
} | ||
|
||
attributes #0 = { convergent noinline norecurse "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" } |