arb_gl_spirv: add test for uniform blocks with the same structure

Submitted by Józef Kucia on Nov. 21, 2018, 3:23 p.m.

Details

Message ID 20181121152329.1186-1-joseph.kucia@gmail.com
State New
Headers show
Series "arb_gl_spirv: add test for uniform blocks with the same structure" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Józef Kucia Nov. 21, 2018, 3:23 p.m.
This test reproduces a bug in Nvidia drivers:

error: binding mismatch between shaders for UBO (named __defaultname)
error: struct type mismatch between shaders for uniform (named __defaultname)
error: binding mismatch between shaders for UBO (named __defaultname)
error: struct type mismatch between shaders for uniform (named __defaultname)
error: binding mismatch between shaders for UBO (named __defaultname)
error: struct type mismatch between shaders for uniform (named __defaultname)
error: binding mismatch between shaders for UBO (named __defaultname)
error: struct type mismatch between shaders for uniform (named __defaultname)

The same issue is also present when SPIR-V debug names for uniform
blocks are the same.
---
 .../unnamed-uniform-blocks.shader_test        | 67 +++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100644 tests/spec/arb_gl_spirv/linker/uniform/unnamed-uniform-blocks.shader_test

Patch hide | download patch | download mbox

diff --git a/tests/spec/arb_gl_spirv/linker/uniform/unnamed-uniform-blocks.shader_test b/tests/spec/arb_gl_spirv/linker/uniform/unnamed-uniform-blocks.shader_test
new file mode 100644
index 000000000000..9dba7d44c37d
--- /dev/null
+++ b/tests/spec/arb_gl_spirv/linker/uniform/unnamed-uniform-blocks.shader_test
@@ -0,0 +1,67 @@ 
+# Test unnamed uniform blocks with the same structure
+
+[require]
+SPIRV YES
+GL >= 3.3
+GLSL >= 4.50
+
+[compute shader spirv]
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 33
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint GLCompute %4 "main"
+               OpExecutionMode %4 LocalSize 1 1 1
+               OpDecorate %9 Location 2
+               OpDecorate %9 DescriptorSet 0
+               OpDecorate %_arr_v4uint_uint_4 ArrayStride 16
+               OpMemberDecorate %_struct_18 0 Offset 0
+               OpDecorate %_struct_18 Block
+               OpDecorate %20 DescriptorSet 0
+               OpDecorate %20 Binding 0
+               OpDecorate %_arr_v4uint_uint_4_0 ArrayStride 16
+               OpMemberDecorate %_struct_26 0 Offset 0
+               OpDecorate %_struct_26 Block
+               OpDecorate %28 DescriptorSet 0
+               OpDecorate %28 Binding 1
+       %void = OpTypeVoid
+          %3 = OpTypeFunction %void
+       %uint = OpTypeInt 32 0
+          %7 = OpTypeImage %uint 2D 0 0 0 2 Rgba32ui
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+          %9 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+        %int = OpTypeInt 32 1
+      %v2int = OpTypeVector %int 2
+      %int_0 = OpConstant %int 0
+         %14 = OpConstantComposite %v2int %int_0 %int_0
+     %v4uint = OpTypeVector %uint 4
+     %uint_4 = OpConstant %uint 4
+%_arr_v4uint_uint_4 = OpTypeArray %v4uint %uint_4
+ %_struct_18 = OpTypeStruct %_arr_v4uint_uint_4
+%_ptr_Uniform__struct_18 = OpTypePointer Uniform %_struct_18
+         %20 = OpVariable %_ptr_Uniform__struct_18 Uniform
+     %uint_0 = OpConstant %uint 0
+%_ptr_Uniform_uint = OpTypePointer Uniform %uint
+%_arr_v4uint_uint_4_0 = OpTypeArray %v4uint %uint_4
+ %_struct_26 = OpTypeStruct %_arr_v4uint_uint_4_0
+%_ptr_Uniform__struct_26 = OpTypePointer Uniform %_struct_26
+         %28 = OpVariable %_ptr_Uniform__struct_26 Uniform
+          %4 = OpFunction %void None %3
+          %5 = OpLabel
+         %10 = OpLoad %7 %9
+         %23 = OpAccessChain %_ptr_Uniform_uint %20 %int_0 %int_0 %uint_0
+         %24 = OpLoad %uint %23
+         %29 = OpAccessChain %_ptr_Uniform_uint %28 %int_0 %int_0 %uint_0
+         %30 = OpLoad %uint %29
+         %31 = OpIAdd %uint %24 %30
+         %32 = OpCompositeConstruct %v4uint %31 %31 %31 %31
+               OpImageWrite %10 %14 %32
+               OpReturn
+               OpFunctionEnd
+
+[test]
+link success

Comments

Hi,

some weeks ago I sent a series with ubo/ssbo tests (still pending review)

https://lists.freedesktop.org/archives/piglit/2018-September/025116.html

All those has the name stripped. Could you try them and see if any of
them triggers the NVIDIA bug you found?

BR

On 21/11/18 16:23, Józef Kucia wrote:
> This test reproduces a bug in Nvidia drivers:
>
> error: binding mismatch between shaders for UBO (named __defaultname)
> error: struct type mismatch between shaders for uniform (named __defaultname)
> error: binding mismatch between shaders for UBO (named __defaultname)
> error: struct type mismatch between shaders for uniform (named __defaultname)
> error: binding mismatch between shaders for UBO (named __defaultname)
> error: struct type mismatch between shaders for uniform (named __defaultname)
> error: binding mismatch between shaders for UBO (named __defaultname)
> error: struct type mismatch between shaders for uniform (named __defaultname)
>
> The same issue is also present when SPIR-V debug names for uniform
> blocks are the same.
> ---
>  .../unnamed-uniform-blocks.shader_test        | 67 +++++++++++++++++++
>  1 file changed, 67 insertions(+)
>  create mode 100644 tests/spec/arb_gl_spirv/linker/uniform/unnamed-uniform-blocks.shader_test
>
> diff --git a/tests/spec/arb_gl_spirv/linker/uniform/unnamed-uniform-blocks.shader_test b/tests/spec/arb_gl_spirv/linker/uniform/unnamed-uniform-blocks.shader_test
> new file mode 100644
> index 000000000000..9dba7d44c37d
> --- /dev/null
> +++ b/tests/spec/arb_gl_spirv/linker/uniform/unnamed-uniform-blocks.shader_test
> @@ -0,0 +1,67 @@
> +# Test unnamed uniform blocks with the same structure
> +
> +[require]
> +SPIRV YES
> +GL >= 3.3
> +GLSL >= 4.50
> +
> +[compute shader spirv]
> +; SPIR-V
> +; Version: 1.0
> +; Generator: Khronos Glslang Reference Front End; 7
> +; Bound: 33
> +; Schema: 0
> +               OpCapability Shader
> +          %1 = OpExtInstImport "GLSL.std.450"
> +               OpMemoryModel Logical GLSL450
> +               OpEntryPoint GLCompute %4 "main"
> +               OpExecutionMode %4 LocalSize 1 1 1
> +               OpDecorate %9 Location 2
> +               OpDecorate %9 DescriptorSet 0
> +               OpDecorate %_arr_v4uint_uint_4 ArrayStride 16
> +               OpMemberDecorate %_struct_18 0 Offset 0
> +               OpDecorate %_struct_18 Block
> +               OpDecorate %20 DescriptorSet 0
> +               OpDecorate %20 Binding 0
> +               OpDecorate %_arr_v4uint_uint_4_0 ArrayStride 16
> +               OpMemberDecorate %_struct_26 0 Offset 0
> +               OpDecorate %_struct_26 Block
> +               OpDecorate %28 DescriptorSet 0
> +               OpDecorate %28 Binding 1
> +       %void = OpTypeVoid
> +          %3 = OpTypeFunction %void
> +       %uint = OpTypeInt 32 0
> +          %7 = OpTypeImage %uint 2D 0 0 0 2 Rgba32ui
> +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
> +          %9 = OpVariable %_ptr_UniformConstant_7 UniformConstant
> +        %int = OpTypeInt 32 1
> +      %v2int = OpTypeVector %int 2
> +      %int_0 = OpConstant %int 0
> +         %14 = OpConstantComposite %v2int %int_0 %int_0
> +     %v4uint = OpTypeVector %uint 4
> +     %uint_4 = OpConstant %uint 4
> +%_arr_v4uint_uint_4 = OpTypeArray %v4uint %uint_4
> + %_struct_18 = OpTypeStruct %_arr_v4uint_uint_4
> +%_ptr_Uniform__struct_18 = OpTypePointer Uniform %_struct_18
> +         %20 = OpVariable %_ptr_Uniform__struct_18 Uniform
> +     %uint_0 = OpConstant %uint 0
> +%_ptr_Uniform_uint = OpTypePointer Uniform %uint
> +%_arr_v4uint_uint_4_0 = OpTypeArray %v4uint %uint_4
> + %_struct_26 = OpTypeStruct %_arr_v4uint_uint_4_0
> +%_ptr_Uniform__struct_26 = OpTypePointer Uniform %_struct_26
> +         %28 = OpVariable %_ptr_Uniform__struct_26 Uniform
> +          %4 = OpFunction %void None %3
> +          %5 = OpLabel
> +         %10 = OpLoad %7 %9
> +         %23 = OpAccessChain %_ptr_Uniform_uint %20 %int_0 %int_0 %uint_0
> +         %24 = OpLoad %uint %23
> +         %29 = OpAccessChain %_ptr_Uniform_uint %28 %int_0 %int_0 %uint_0
> +         %30 = OpLoad %uint %29
> +         %31 = OpIAdd %uint %24 %30
> +         %32 = OpCompositeConstruct %v4uint %31 %31 %31 %31
> +               OpImageWrite %10 %14 %32
> +               OpReturn
> +               OpFunctionEnd
> +
> +[test]
> +link success
On Thu, Nov 22, 2018 at 11:21 AM apinheiro <apinheiro@igalia.com> wrote:
> some weeks ago I sent a series with ubo/ssbo tests (still pending review)
>
> https://lists.freedesktop.org/archives/piglit/2018-September/025116.html
>
> All those has the name stripped. Could you try them and see if any of
> them triggers the NVIDIA bug you found?

arb_gl_spirv @ execution @ ubo @ matrix @ column-vs-row.shader_test
triggers the NVIDIA bug.

BTW, where can I find the "shader_test_spirv.py" script?

Thanks,
Józef
On 23/11/18 19:41, Józef Kucia wrote:
> On Thu, Nov 22, 2018 at 11:21 AM apinheiro <apinheiro@igalia.com> wrote:
>> some weeks ago I sent a series with ubo/ssbo tests (still pending review)
>>
>> https://lists.freedesktop.org/archives/piglit/2018-September/025116.html
>>
>> All those has the name stripped. Could you try them and see if any of
>> them triggers the NVIDIA bug you found?
> arb_gl_spirv @ execution @ ubo @ matrix @ column-vs-row.shader_test
> triggers the NVIDIA bug.


Then do you think that your test is still needed? An alternative, as we
didn't add any compute shader using ubo/ssbo, would be rename and update
the description of your test (something like "compute shader using ubo").

Also if you are interested to get those tests integrated, you can just
take a look an review them, wink wink


>
> BTW, where can I find the "shader_test_spirv.py" script?


You can find it on our WIP (so several wip and fixme patches)
ARB_gl_spirv piglit branch:

https://github.com/Igalia/piglit/tree/igalia/arb_gl_spirv

On the directory generated_spv

We didn't send it to review yet because it needs a lot of cleaning and
squashing. We will do that eventually, but we are focus first on getting
ARB_gl_spirv finished.


>
> Thanks,
> Józef
>
On Sat, Nov 24, 2018 at 9:17 AM apinheiro <apinheiro@igalia.com> wrote:
> Then do you think that your test is still needed? An alternative, as we
> didn't add any compute shader using ubo/ssbo, would be rename and update
> the description of your test (something like "compute shader using ubo").

No, my test shouldn't be needed when we have another test which also
reproduced the Nvidia driver bug.

>
> Also if you are interested to get those tests integrated, you can just
> take a look an review them, wink wink

I'll try to find time to review, at least, some of those tests.