- 
                Notifications
    
You must be signed in to change notification settings  - Fork 15.1k
 
          [SPIR-V] Support nonuniformindex intrsinsic in SPIRV CodeGen.
          #162540
        
          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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 
                       There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You changed this test from a non uniform index into an array of storage images (RWBuffer) into an array of storage buffer (RWStructuredBuffers). Can you look at the full set of tests that we will need? See #122355. You cannot generate all of these from HLSL yet. For now add that can be generated from HLSL. Look at the tables in https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/SPIR-V.rst#textures and https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/SPIR-V.rst#constanttexturestructuredbyte-buffers to see the links between HLSL type and the Vulkan type. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for pointing out! Based on our discussion 
  | 
            
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| ; RUN: llc -O0 -mtriple=spirv1.6-unknown-vulkan1.3-compute %s -o - | FileCheck %s --match-full-lines | ||
| ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv1.6-unknown-vulkan1.3-compute %s -o - -filetype=obj | spirv-val %} | ||
| 
     | 
||
| ; CHECK-DAG: OpCapability Shader | ||
| ; CHECK-DAG: OpCapability ShaderNonUniformEXT | ||
| ; CHECK-DAG: OpDecorate {{%[0-9]+}} NonUniformEXT | ||
| ; CHECK-DAG: OpDecorate {{%[0-9]+}} NonUniformEXT | ||
| ; CHECK-DAG: OpDecorate {{%[0-9]+}} NonUniformEXT | ||
| ; CHECK-DAG: OpDecorate {{%[0-9]+}} NonUniformEXT | ||
| ; CHECK-DAG: OpDecorate %[[#access1:]] NonUniformEXT | ||
| @ReadWriteStructuredBuf.str = private unnamed_addr constant [23 x i8] c"ReadWriteStructuredBuf\00", align 1 | ||
| 
     | 
||
| define void @main() local_unnamed_addr #0 { | ||
| entry: | ||
| %0 = tail call i32 @llvm.spv.thread.id.in.group.i32(i32 0) | ||
| %add.i = add i32 %0, 1 | ||
| %1 = tail call noundef i32 @llvm.spv.resource.nonuniformindex(i32 %add.i) | ||
| %2 = tail call target("spirv.VulkanBuffer", [0 x <4 x i32>], 12, 1) @llvm.spv.resource.handlefromimplicitbinding.tspirv.VulkanBuffer_a0v4i32_12_1t(i32 0, i32 0, i32 64, i32 %1, ptr nonnull @ReadWriteStructuredBuf.str) | ||
| %3 = tail call noundef align 16 dereferenceable(16) ptr addrspace(11) @llvm.spv.resource.getpointer.p11.tspirv.VulkanBuffer_a0v4i32_12_1t(target("spirv.VulkanBuffer", [0 x <4 x i32>], 12, 1) %2, i32 98) | ||
| %4 = load <4 x i32>, ptr addrspace(11) %3, align 16 | ||
| %vecins.i = insertelement <4 x i32> %4, i32 99, i64 0 | ||
| ; CHECK: %[[#access1]] = OpAccessChain {{.*}} | ||
| ; CHECK: OpStore %[[#access1]] {{%[0-9]+}} Aligned 16 | ||
| store <4 x i32> %vecins.i, ptr addrspace(11) %3, align 16 | ||
| ret void | ||
| } | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| ; RUN: llc -O0 -mtriple=spirv1.6-unknown-vulkan1.3-compute %s -o - | FileCheck %s --match-full-lines | ||
| ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv1.6-unknown-vulkan1.3-compute %s -o - -filetype=obj | spirv-val %} | ||
| 
     | 
||
| ; CHECK-DAG: OpCapability Shader | ||
| ; CHECK-DAG: OpCapability ShaderNonUniformEXT | ||
| ; CHECK-DAG: OpCapability StorageTexelBufferArrayNonUniformIndexingEXT | ||
| ; CHECK-DAG: OpDecorate {{%[0-9]+}} NonUniformEXT | ||
| ; CHECK-DAG: OpDecorate %[[#access:]] NonUniformEXT | ||
| ; CHECK-DAG: OpDecorate %[[#load:]] NonUniformEXT | ||
| @ReadWriteBuf.str = private unnamed_addr constant [13 x i8] c"ReadWriteBuf\00", align 1 | ||
| 
     | 
||
| define void @main() local_unnamed_addr #0 { | ||
| entry: | ||
| %0 = tail call i32 @llvm.spv.thread.id.in.group.i32(i32 0) | ||
| %1 = tail call noundef i32 @llvm.spv.resource.nonuniformindex(i32 %0) | ||
| %2 = tail call target("spirv.Image", i32, 5, 2, 0, 0, 2, 33) @llvm.spv.resource.handlefromimplicitbinding.tspirv.Image_i32_5_2_0_0_2_33t(i32 0, i32 0, i32 64, i32 %1, ptr nonnull @ReadWriteBuf.str) | ||
| %3 = tail call noundef align 4 dereferenceable(4) ptr addrspace(11) @llvm.spv.resource.getpointer.p11.tspirv.Image_i32_5_2_0_0_2_33t(target("spirv.Image", i32, 5, 2, 0, 0, 2, 33) %2, i32 96) | ||
| ; CHECK: {{%[0-9]+}} = OpCompositeExtract {{.*}} | ||
| ; CHECK: %[[#access]] = OpAccessChain {{.*}} | ||
| ; CHECK: %[[#load]] = OpLoad {{%[0-9]+}} %[[#access]] | ||
| ; CHECK: OpImageWrite %[[#load]] {{%[0-9]+}} {{%[0-9]+}} | ||
| store i32 95, ptr addrspace(11) %3, align 4 | ||
| ret void | ||
| } | 
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.