Zink emits out-of-bounds OpCompositeExtract in KHR-GL46.sparse_texture2_tests.SparseTexture2Lookup
With both !27306 (merged) and !27414 (merged) applied, on Intel, Zink emits an out-of-bounds OpCompositeExtract in KHR-GL46.sparse_texture2_tests.SparseTexture2Lookup
:
przanoni@deegeetoo:~/git/VK-GL-CTS/build/external/openglcts/modules$ mkdir /tmp/spirv
przanoni@deegeetoo:~/git/VK-GL-CTS/build/external/openglcts/modules$ MESA_SPIRV_FAIL_DUMP_PATH=/tmp/spirv with-mesa zink ./glcts -n KHR-GL46.sparse_texture2_tests.SparseTexture2Lookup
Writing test log into TestResults.qpa
dEQP Core vulkan-cts-1.3.7.3-206-g6057d2df3332b9f234e196088267c350abfe71ea (0x6057d2df) starting..
target implementation = 'Default'
Test case 'KHR-GL46.sparse_texture2_tests.SparseTexture2Lookup'..
MESA: error: ../../src/vulkan/runtime/vk_nir.c:60: SPIR-V offset 1592: SPIR-V parsing FAILED:
In file ../../src/compiler/spirv/spirv_to_nir.c:4294
All indices in an OpCompositeExtract must be in-bounds
1592 bytes into the SPIR-V binary
SPIR-V parsing FAILED:
In file ../../src/compiler/spirv/spirv_to_nir.c:4294
All indices in an OpCompositeExtract must be in-bounds
1592 bytes into the SPIR-V binary
/home/przanoni/bin/with-mesa: line 149: 559022 Trace/breakpoint trap $TO_RUN
przanoni@deegeetoo:~/git/VK-GL-CTS/build/external/openglcts/modules$ ls /tmp/spirv/
fail-0.spirv
przanoni@deegeetoo:~/git/VK-GL-CTS/build/external/openglcts/modules$ spirv-val /tmp/spirv/fail-0.spirv
error: line 98: Vector access is out of bounds, vector size is 4, but access index is 4
%68 = OpCompositeExtract %float %67 4
przanoni@deegeetoo:~/git/VK-GL-CTS/build/external/openglcts/modules$ spirv-dis /tmp/spirv/fail-0.spirv
; SPIR-V
; Version: 1.6
; Generator: Khronos; 0
; Bound: 145
; Schema: 0
OpCapability SparseResidency
OpCapability VulkanMemoryModel
OpCapability StorageImageExtendedFormats
OpCapability VulkanMemoryModelDeviceScope
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical Vulkan
OpEntryPoint GLCompute %main "main" %uniform_0_32 %uni_out %uni_in %gl_WorkGroupID
OpExecutionMode %main LocalSize 1 1 1
OpSource Unknown 0
OpName %main "main"
OpName %struct_uniform_0_32 "struct_uniform_0@32"
OpName %uniform_0_32 "uniform_0@32"
OpName %uni_out "uni_out"
OpName %uni_in "uni_in"
OpName %gl_WorkGroupID "gl_WorkGroupID"
OpDecorate %_arr_uint_uint_4 ArrayStride 4
OpDecorate %struct_uniform_0_32 Block
OpMemberDecorate %struct_uniform_0_32 0 Offset 0
OpDecorate %uniform_0_32 DescriptorSet 0
OpDecorate %uniform_0_32 Binding 5
OpDecorate %uni_out NonReadable
OpDecorate %uni_out Aliased
OpDecorate %uni_out DescriptorSet 4
OpDecorate %uni_out Binding 0
OpDecorate %uni_in DescriptorSet 2
OpDecorate %uni_in Binding 0
OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId
%void = OpTypeVoid
%3 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
%_arr_uint_uint_4 = OpTypeArray %uint %uint_4
%struct_uniform_0_32 = OpTypeStruct %_arr_uint_uint_4
%uint_1 = OpConstant %uint 1
%_arr_struct_uniform_0_32_uint_1 = OpTypeArray %struct_uniform_0_32 %uint_1
%_ptr_Uniform__arr_struct_uniform_0_32_uint_1 = OpTypePointer Uniform %_arr_struct_uniform_0_32_uint_1
%uniform_0_32 = OpVariable %_ptr_Uniform__arr_struct_uniform_0_32_uint_1 Uniform
%13 = OpTypeImage %uint 2D 0 0 0 2 R8ui
%_ptr_UniformConstant_13 = OpTypePointer UniformConstant %13
%uni_out = OpVariable %_ptr_UniformConstant_13 UniformConstant
%float = OpTypeFloat 32
%17 = OpTypeImage %float 2D 0 0 0 1 Unknown
%18 = OpTypeSampledImage %17
%_ptr_UniformConstant_18 = OpTypePointer UniformConstant %18
%uni_in = OpVariable %_ptr_UniformConstant_18 UniformConstant
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%uint_255 = OpConstant %uint 255
%v4uint = OpTypeVector %uint 4
%33 = OpConstantComposite %v4uint %uint_255 %uint_255 %uint_255 %uint_255
%bool = OpTypeBool
%true = OpConstantTrue %bool
%uint_0 = OpConstant %uint 0
%37 = OpConstantComposite %v4uint %uint_0 %uint_0 %uint_0 %uint_0
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input
%int_511 = OpConstant %int 511
%v2float = OpTypeVector %float 2
%float_512 = OpConstant %float 512
%v4float = OpTypeVector %float 4
%_struct_65 = OpTypeStruct %uint %v4float
%uint_8 = OpConstant %uint 8
%v2uint = OpTypeVector %uint 2
%_ptr_Uniform_struct_uniform_0_32 = OpTypePointer Uniform %struct_uniform_0_32
%_ptr_Uniform__arr_uint_uint_4 = OpTypePointer Uniform %_arr_uint_uint_4
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
%int_n1 = OpConstant %int -1
%float_1_00800002 = OpConstant %float 1.00800002
%float_0_991999984 = OpConstant %float 0.991999984
%main = OpFunction %void None %3
%28 = OpLabel
OpBranch %21
%21 = OpLabel
%38 = OpUndef %uint
%39 = OpUndef %uint
%40 = OpUndef %uint
%41 = OpUndef %uint
%42 = OpUndef %uint
%43 = OpUndef %uint
%44 = OpUndef %uint
%45 = OpUndef %uint
%46 = OpUndef %uint
%50 = OpLoad %v3uint %gl_WorkGroupID
%51 = OpCompositeExtract %uint %50 0
%52 = OpConvertUToF %float %51
%53 = OpCompositeExtract %uint %50 1
%54 = OpConvertUToF %float %53
%57 = OpCompositeConstruct %v2float %52 %54
%59 = OpCompositeConstruct %v2float %float_512 %float_512
%60 = OpFDiv %v2float %57 %59
%61 = OpLoad %18 %uni_in
%63 = OpImage %17 %61
%64 = OpImageSparseGather %_struct_65 %61 %60 %uint_0 None
%66 = OpCompositeExtract %uint %64 0
%67 = OpCompositeExtract %v4float %64 1
%68 = OpCompositeExtract %float %67 4
%69 = OpImageSparseTexelsResident %bool %66
%70 = OpImageSparseTexelsResident %bool %66
%71 = OpLogicalAnd %bool %69 %70
%72 = OpImageSparseTexelsResident %bool %66
%73 = OpLogicalAnd %bool %71 %72
%74 = OpImageSparseTexelsResident %bool %66
%75 = OpLogicalAnd %bool %73 %74
OpMemoryBarrier %uint_1 %uint_8
%77 = OpCompositeExtract %uint %50 0
%78 = OpCompositeExtract %uint %50 1
%79 = OpCompositeConstruct %v4uint %77 %78 %46 %45
%80 = OpLoad %13 %uni_out
%82 = OpVectorShuffle %v2uint %79 %79 0 1
%83 = OpBitcast %v4uint %33
OpImageWrite %80 %82 %83 None
%84 = OpCompositeExtract %uint %50 0
%85 = OpBitcast %int %84
%86 = OpCompositeExtract %uint %50 1
%87 = OpBitcast %int %86
%88 = OpExtInst %int %1 SMin %85 %87
%89 = OpSLessThan %bool %int_1 %88
%90 = OpCompositeExtract %uint %50 0
%91 = OpBitcast %int %90
%92 = OpSLessThan %bool %91 %int_511
%93 = OpLogicalAnd %bool %89 %92
%94 = OpCompositeExtract %uint %50 1
%95 = OpBitcast %int %94
%96 = OpSLessThan %bool %95 %int_511
%97 = OpLogicalAnd %bool %93 %96
%99 = OpAccessChain %_ptr_Uniform_struct_uniform_0_32 %uniform_0_32 %uint_0
%101 = OpAccessChain %_ptr_Uniform__arr_uint_uint_4 %99 %uint_0
%103 = OpAccessChain %_ptr_Uniform_uint %101 %uint_0
%104 = OpLoad %uint %103
%106 = OpBitcast %int %104
%107 = OpIAdd %int %106 %int_n1
%108 = OpCompositeExtract %uint %50 0
%109 = OpBitcast %int %108
%110 = OpSLessThan %bool %109 %107
%111 = OpLogicalAnd %bool %97 %110
%112 = OpLogicalEqual %bool %73 %true
%114 = OpCompositeExtract %float %67 3
%115 = OpFOrdLessThan %bool %float_1_00800002 %114
%116 = OpSelect %bool %112 %115 %true
%118 = OpCompositeExtract %float %67 3
%119 = OpFOrdLessThan %bool %118 %float_0_991999984
%120 = OpLogicalOr %bool %116 %119
%121 = OpLogicalAnd %bool %120 %111
OpBranch %122
%122 = OpLabel
OpSelectionMerge %123 None
OpBranchConditional %121 %22 %23
%22 = OpLabel
%124 = OpCompositeExtract %uint %50 0
%125 = OpCompositeExtract %uint %50 1
%126 = OpCompositeConstruct %v4uint %124 %125 %43 %42
%127 = OpLoad %13 %uni_out
%128 = OpVectorShuffle %v2uint %126 %126 0 1
%129 = OpBitcast %v4uint %37
OpImageWrite %127 %128 %129 None
OpBranch %123
%23 = OpLabel
OpBranch %123
%123 = OpLabel
OpBranch %24
%24 = OpLabel
%130 = OpBitcast %int %104
%131 = OpIAdd %int %130 %int_1
%132 = OpCompositeExtract %uint %50 0
%133 = OpBitcast %int %132
%134 = OpSGreaterThanEqual %bool %133 %131
%135 = OpLogicalAnd %bool %97 %134
%136 = OpLogicalAnd %bool %112 %135
OpBranch %137
%137 = OpLabel
OpSelectionMerge %138 None
OpBranchConditional %136 %25 %26
%25 = OpLabel
%139 = OpCompositeExtract %uint %50 0
%140 = OpCompositeExtract %uint %50 1
%141 = OpCompositeConstruct %v4uint %139 %140 %40 %39
%142 = OpLoad %13 %uni_out
%143 = OpVectorShuffle %v2uint %141 %141 0 1
%144 = OpBitcast %v4uint %37
OpImageWrite %142 %143 %144 None
OpBranch %138
%26 = OpLabel
OpBranch %138
%138 = OpLabel
OpBranch %27
%27 = OpLabel
OpReturn
OpFunctionEnd