Skip to content

Instantly share code, notes, and snippets.

@pashu123
Created February 14, 2023 05:02
Show Gist options
  • Save pashu123/4d32cf56fe1751de4a8170675fd23ec3 to your computer and use it in GitHub Desktop.
Save pashu123/4d32cf56fe1751de4a8170675fd23ec3 to your computer and use it in GitHub Desktop.
; SPIR-V
; Version: 1.3
; Generator: Khronos; 22
; Bound: 356
; Schema: 0
OpCapability Int64
OpCapability Shader
OpCapability GroupNonUniformShuffle
OpExtension "SPV_KHR_storage_buffer_storage_class"
%105 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %forward_dispatch_43 "forward_dispatch_43" %__builtin_var_LocalInvocationId__ %__builtin_var_WorkgroupId__
OpExecutionMode %forward_dispatch_43 LocalSize 256 1 1
OpName %__workgroup_mem__6 "__workgroup_mem__6"
OpName %__workgroup_mem__5 "__workgroup_mem__5"
OpName %__workgroup_mem__4 "__workgroup_mem__4"
OpName %__builtin_var_WorkgroupId__ "__builtin_var_WorkgroupId__"
OpName %__builtin_var_LocalInvocationId__ "__builtin_var_LocalInvocationId__"
OpName %__resource_var_0_0_ "__resource_var_0_0_"
OpName %__resource_var_0_1_ "__resource_var_0_1_"
OpName %forward_dispatch_43 "forward_dispatch_43"
OpDecorate %__builtin_var_WorkgroupId__ BuiltIn WorkgroupId
OpDecorate %__builtin_var_LocalInvocationId__ BuiltIn LocalInvocationId
OpDecorate %_runtimearr_v4float ArrayStride 16
OpMemberDecorate %_struct_18 0 Offset 0
OpDecorate %_struct_18 Block
OpDecorate %__resource_var_0_0_ Binding 0
OpDecorate %__resource_var_0_0_ DescriptorSet 0
OpDecorate %__resource_var_0_1_ Binding 1
OpDecorate %__resource_var_0_1_ DescriptorSet 0
%float = OpTypeFloat 32
%uint = OpTypeInt 32 0
%uint_8 = OpConstant %uint 8
%_arr_float_uint_8 = OpTypeArray %float %uint_8
%_struct_2 = OpTypeStruct %_arr_float_uint_8
%_ptr_Workgroup__struct_2 = OpTypePointer Workgroup %_struct_2
%__workgroup_mem__6 = OpVariable %_ptr_Workgroup__struct_2 Workgroup
%__workgroup_mem__5 = OpVariable %_ptr_Workgroup__struct_2 Workgroup
%__workgroup_mem__4 = OpVariable %_ptr_Workgroup__struct_2 Workgroup
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%__builtin_var_WorkgroupId__ = OpVariable %_ptr_Input_v3uint Input
%ulong = OpTypeInt 64 0
%v3ulong = OpTypeVector %ulong 3
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
%__builtin_var_LocalInvocationId__ = OpVariable %_ptr_Input_v3ulong Input
%v4float = OpTypeVector %float 4
%_runtimearr_v4float = OpTypeRuntimeArray %v4float
%_struct_18 = OpTypeStruct %_runtimearr_v4float
%_ptr_StorageBuffer__struct_18 = OpTypePointer StorageBuffer %_struct_18
%__resource_var_0_0_ = OpVariable %_ptr_StorageBuffer__struct_18 StorageBuffer
%__resource_var_0_1_ = OpVariable %_ptr_StorageBuffer__struct_18 StorageBuffer
%void = OpTypeVoid
%23 = OpTypeFunction %void
%ulong_5898240 = OpConstant %ulong 5898240
%ulong_2304 = OpConstant %ulong 2304
%ulong_21233664 = OpConstant %ulong 21233664
%ulong_18446744073709551615 = OpConstant %ulong 18446744073709551615
%ulong_4 = OpConstant %ulong 4
%ulong_0 = OpConstant %ulong 0
%float_0_693147182 = OpConstant %float 0.693147182
%33 = OpConstantComposite %v4float %float_0_693147182 %float_0_693147182 %float_0_693147182 %float_0_693147182
%float_1_44269502 = OpConstant %float 1.44269502
%35 = OpConstantComposite %v4float %float_1_44269502 %float_1_44269502 %float_1_44269502 %float_1_44269502
%float_1 = OpConstant %float 1
%37 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%float_0_499705136 = OpConstant %float 0.499705136
%39 = OpConstantComposite %v4float %float_0_499705136 %float_0_499705136 %float_0_499705136 %float_0_499705136
%float_0_168738902 = OpConstant %float 0.168738902
%41 = OpConstantComposite %v4float %float_0_168738902 %float_0_168738902 %float_0_168738902 %float_0_168738902
%float_0_0366896503 = OpConstant %float 0.0366896503
%43 = OpConstantComposite %v4float %float_0_0366896503 %float_0_0366896503 %float_0_0366896503 %float_0_0366896503
%float_0_0131435003 = OpConstant %float 0.0131435003
%45 = OpConstantComposite %v4float %float_0_0131435003 %float_0_0131435003 %float_0_0131435003 %float_0_0131435003
%v4uint = OpTypeVector %uint 4
%uint_23 = OpConstant %uint 23
%48 = OpConstantComposite %v4uint %uint_23 %uint_23 %uint_23 %uint_23
%float_0x1p_128 = OpConstant %float 0x1p+128
%50 = OpConstantComposite %v4float %float_0x1p_128 %float_0x1p_128 %float_0x1p_128 %float_0x1p_128
%float_1_17549435en38 = OpConstant %float 1.17549435e-38
%52 = OpConstantComposite %v4float %float_1_17549435en38 %float_1_17549435en38 %float_1_17549435en38 %float_1_17549435en38
%uint_127 = OpConstant %uint 127
%54 = OpConstantComposite %v4uint %uint_127 %uint_127 %uint_127 %uint_127
%uint_4294967169 = OpConstant %uint 4294967169
%56 = OpConstantComposite %v4uint %uint_4294967169 %uint_4294967169 %uint_4294967169 %uint_4294967169
%float_n0x1p_128 = OpConstant %float -0x1p+128
%58 = OpConstantComposite %v4float %float_n0x1p_128 %float_n0x1p_128 %float_n0x1p_128 %float_n0x1p_128
%uint_1 = OpConstant %uint 1
%uint_2 = OpConstant %uint 2
%uint_4 = OpConstant %uint 4
%uint_16 = OpConstant %uint 16
%ulong_32 = OpConstant %ulong 32
%ulong_7 = OpConstant %ulong 7
%uint_0 = OpConstant %uint 0
%float_0 = OpConstant %float 0
%67 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
%ulong_1024 = OpConstant %ulong 1024
%ulong_9216 = OpConstant %ulong 9216
%float_n1_00000002e_30 = OpConstant %float -1.00000002e+30
%_ptr_Function_v4float = OpTypePointer Function %v4float
%bool = OpTypeBool
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%v4bool = OpTypeVector %bool 4
%uint_3 = OpConstant %uint 3
%_ptr_Workgroup_float = OpTypePointer Workgroup %float
%uint_264 = OpConstant %uint 264
%forward_dispatch_43 = OpFunction %void None %23
%26 = OpLabel
%81 = OpVariable %_ptr_Function_v4float Function
%188 = OpVariable %_ptr_Function_v4float Function
%72 = OpLoad %v3ulong %__builtin_var_LocalInvocationId__
%73 = OpCompositeExtract %ulong %72 0
%74 = OpLoad %v3uint %__builtin_var_WorkgroupId__
%75 = OpCompositeExtract %uint %74 0
%76 = OpUConvert %ulong %75
%77 = OpLoad %v3uint %__builtin_var_WorkgroupId__
%78 = OpCompositeExtract %uint %77 1
%79 = OpUConvert %ulong %78
OpBranch %82
%82 = OpLabel
%85 = OpPhi %ulong %111 %83 %ulong_0 %26
%86 = OpPhi %v4float %110 %83 %58 %26
%88 = OpSLessThan %bool %85 %ulong_9216
OpLoopMerge %84 %83 None
OpBranchConditional %88 %83 %84
%83 = OpLabel
%89 = OpSLessThan %bool %85 %ulong_0
%90 = OpISub %ulong %ulong_18446744073709551615 %85
%91 = OpSelect %ulong %89 %90 %85
%92 = OpSDiv %ulong %91 %ulong_4
%93 = OpISub %ulong %ulong_18446744073709551615 %92
%94 = OpSelect %ulong %89 %93 %92
%95 = OpIMul %ulong %79 %ulong_21233664
%96 = OpIAdd %ulong %73 %95
%97 = OpIMul %ulong %76 %ulong_2304
%98 = OpIAdd %ulong %96 %97
%99 = OpIAdd %ulong %94 %98
%100 = OpIAdd %ulong %99 %ulong_5898240
%102 = OpAccessChain %_ptr_StorageBuffer_v4float %__resource_var_0_0_ %ulong_0 %100
%103 = OpLoad %v4float %102
%104 = OpExtInst %v4float %105 FMax %103 %86
%107 = OpIsNan %v4bool %103
%108 = OpIsNan %v4bool %86
%109 = OpSelect %v4float %107 %103 %104
%110 = OpSelect %v4float %108 %86 %109
OpStore %81 %110
%111 = OpIAdd %ulong %85 %ulong_1024
OpBranch %82
%84 = OpLabel
%112 = OpLoad %v4float %81
%113 = OpCompositeExtract %float %112 0
%114 = OpCompositeExtract %float %112 1
%115 = OpCompositeExtract %float %112 2
%116 = OpCompositeExtract %float %112 3
%117 = OpExtInst %float %105 FMax %113 %114
%118 = OpExtInst %float %105 FMax %117 %115
%119 = OpExtInst %float %105 FMax %118 %116
%120 = OpGroupNonUniformShuffleXor %float %uint_3 %119 %uint_1
%122 = OpExtInst %float %105 FMax %119 %120
%123 = OpIsNan %bool %119
%124 = OpIsNan %bool %120
%125 = OpSelect %float %123 %119 %122
%126 = OpSelect %float %124 %120 %125
%127 = OpGroupNonUniformShuffleXor %float %uint_3 %126 %uint_2
%128 = OpExtInst %float %105 FMax %126 %127
%129 = OpIsNan %bool %126
%130 = OpIsNan %bool %127
%131 = OpSelect %float %129 %126 %128
%132 = OpSelect %float %130 %127 %131
%133 = OpGroupNonUniformShuffleXor %float %uint_3 %132 %uint_4
%134 = OpExtInst %float %105 FMax %132 %133
%135 = OpIsNan %bool %132
%136 = OpIsNan %bool %133
%137 = OpSelect %float %135 %132 %134
%138 = OpSelect %float %136 %133 %137
%139 = OpGroupNonUniformShuffleXor %float %uint_3 %138 %uint_8
%140 = OpExtInst %float %105 FMax %138 %139
%141 = OpIsNan %bool %138
%142 = OpIsNan %bool %139
%143 = OpSelect %float %141 %138 %140
%144 = OpSelect %float %142 %139 %143
%145 = OpGroupNonUniformShuffleXor %float %uint_3 %144 %uint_16
%146 = OpExtInst %float %105 FMax %144 %145
%147 = OpIsNan %bool %144
%148 = OpIsNan %bool %145
%149 = OpSelect %float %147 %144 %146
%150 = OpSelect %float %148 %145 %149
%151 = OpUDiv %ulong %73 %ulong_32
%152 = OpUMod %ulong %73 %ulong_32
%153 = OpIEqual %bool %152 %ulong_0
OpBranch %154
%154 = OpLabel
OpSelectionMerge %156 None
OpBranchConditional %153 %155 %156
%155 = OpLabel
%158 = OpAccessChain %_ptr_Workgroup_float %__workgroup_mem__4 %ulong_0 %151
OpStore %158 %150
OpBranch %156
%156 = OpLabel
OpControlBarrier %uint_2 %uint_2 %uint_264
%160 = OpExtInst %ulong %105 UMin %152 %ulong_7
%161 = OpAccessChain %_ptr_Workgroup_float %__workgroup_mem__4 %ulong_0 %160
%162 = OpLoad %float %161
%163 = OpGroupNonUniformShuffleXor %float %uint_3 %162 %uint_1
%164 = OpExtInst %float %105 FMax %162 %163
%165 = OpIsNan %bool %162
%166 = OpIsNan %bool %163
%167 = OpSelect %float %165 %162 %164
%168 = OpSelect %float %166 %163 %167
%169 = OpGroupNonUniformShuffleXor %float %uint_3 %168 %uint_2
%170 = OpExtInst %float %105 FMax %168 %169
%171 = OpIsNan %bool %168
%172 = OpIsNan %bool %169
%173 = OpSelect %float %171 %168 %170
%174 = OpSelect %float %172 %169 %173
%175 = OpGroupNonUniformShuffleXor %float %uint_3 %174 %uint_4
%176 = OpExtInst %float %105 FMax %174 %175
%177 = OpIsNan %bool %174
%178 = OpIsNan %bool %175
%179 = OpSelect %float %177 %174 %176
%180 = OpSelect %float %178 %175 %179
%181 = OpGroupNonUniformShuffle %float %uint_3 %180 %uint_0
%182 = OpExtInst %float %105 FMax %181 %float_n1_00000002e_30
%183 = OpIsNan %bool %181
%184 = OpIsNan %bool %float_n1_00000002e_30
%185 = OpSelect %float %183 %181 %182
%186 = OpSelect %float %184 %float_n1_00000002e_30 %185
%187 = OpCompositeConstruct %v4float %186 %186 %186 %186
OpBranch %189
%189 = OpLabel
%192 = OpPhi %ulong %240 %190 %ulong_0 %156
%193 = OpPhi %v4float %239 %190 %67 %156
%194 = OpSLessThan %bool %192 %ulong_9216
OpLoopMerge %191 %190 None
OpBranchConditional %194 %190 %191
%190 = OpLabel
%195 = OpSLessThan %bool %192 %ulong_0
%196 = OpISub %ulong %ulong_18446744073709551615 %192
%197 = OpSelect %ulong %195 %196 %192
%198 = OpSDiv %ulong %197 %ulong_4
%199 = OpISub %ulong %ulong_18446744073709551615 %198
%200 = OpSelect %ulong %195 %199 %198
%201 = OpIMul %ulong %79 %ulong_21233664
%202 = OpIAdd %ulong %73 %201
%203 = OpIMul %ulong %76 %ulong_2304
%204 = OpIAdd %ulong %202 %203
%205 = OpIAdd %ulong %200 %204
%206 = OpIAdd %ulong %205 %ulong_5898240
%207 = OpAccessChain %_ptr_StorageBuffer_v4float %__resource_var_0_0_ %ulong_0 %206
%208 = OpLoad %v4float %207
%209 = OpFSub %v4float %208 %187
%210 = OpIsNan %v4bool %209
%211 = OpLogicalOr %v4bool %210 %210
%212 = OpFMul %v4float %209 %35
%213 = OpExtInst %v4float %105 Floor %212
%214 = OpFMul %v4float %213 %33
%215 = OpFSub %v4float %209 %214
%216 = OpFMul %v4float %215 %215
%217 = OpFMul %v4float %216 %216
%218 = OpExtInst %v4float %105 Fma %37 %215 %37
%219 = OpExtInst %v4float %105 Fma %41 %215 %39
%220 = OpExtInst %v4float %105 Fma %45 %215 %43
%221 = OpExtInst %v4float %105 Fma %219 %216 %218
%222 = OpExtInst %v4float %105 Fma %220 %217 %221
%223 = OpConvertFToS %v4uint %213
%224 = OpIAdd %v4uint %223 %54
%225 = OpShiftLeftLogical %v4uint %224 %48
%226 = OpBitcast %v4float %225
%227 = OpFMul %v4float %222 %226
%228 = OpSLessThanEqual %v4bool %223 %54
%229 = OpSGreaterThanEqual %v4bool %223 %56
%230 = OpFOrdEqual %v4bool %209 %58
%231 = OpFOrdEqual %v4bool %209 %50
%232 = OpFOrdGreaterThan %v4bool %209 %67
%233 = OpLogicalAnd %v4bool %228 %229
%234 = OpSelect %v4float %232 %50 %52
%235 = OpSelect %v4float %233 %227 %234
%236 = OpSelect %v4float %231 %50 %235
%237 = OpSelect %v4float %230 %67 %236
%238 = OpSelect %v4float %211 %209 %237
%239 = OpFAdd %v4float %238 %193
OpStore %188 %239
%240 = OpIAdd %ulong %192 %ulong_1024
OpBranch %189
%191 = OpLabel
%241 = OpLoad %v4float %188
%242 = OpCompositeExtract %float %241 0
%243 = OpCompositeExtract %float %241 1
%244 = OpCompositeExtract %float %241 2
%245 = OpCompositeExtract %float %241 3
%246 = OpFAdd %float %242 %243
%247 = OpFAdd %float %246 %244
%248 = OpFAdd %float %247 %245
%249 = OpGroupNonUniformShuffleXor %float %uint_3 %248 %uint_1
%250 = OpFAdd %float %248 %249
%251 = OpGroupNonUniformShuffleXor %float %uint_3 %250 %uint_2
%252 = OpFAdd %float %250 %251
%253 = OpGroupNonUniformShuffleXor %float %uint_3 %252 %uint_4
%254 = OpFAdd %float %252 %253
%255 = OpGroupNonUniformShuffleXor %float %uint_3 %254 %uint_8
%256 = OpFAdd %float %254 %255
%257 = OpGroupNonUniformShuffleXor %float %uint_3 %256 %uint_16
%258 = OpFAdd %float %256 %257
OpBranch %259
%259 = OpLabel
OpSelectionMerge %261 None
OpBranchConditional %153 %260 %261
%260 = OpLabel
%262 = OpAccessChain %_ptr_Workgroup_float %__workgroup_mem__5 %ulong_0 %151
OpStore %262 %258
OpBranch %261
%261 = OpLabel
OpControlBarrier %uint_2 %uint_2 %uint_264
%263 = OpAccessChain %_ptr_Workgroup_float %__workgroup_mem__5 %ulong_0 %160
%264 = OpLoad %float %263
%265 = OpGroupNonUniformShuffleXor %float %uint_3 %264 %uint_1
%266 = OpFAdd %float %264 %265
%267 = OpGroupNonUniformShuffleXor %float %uint_3 %266 %uint_2
%268 = OpFAdd %float %266 %267
%269 = OpGroupNonUniformShuffleXor %float %uint_3 %268 %uint_4
%270 = OpFAdd %float %268 %269
%271 = OpGroupNonUniformShuffle %float %uint_3 %270 %uint_0
%272 = OpFAdd %float %271 %float_0
OpBranch %273
%273 = OpLabel
OpSelectionMerge %275 None
OpBranchConditional %153 %274 %275
%274 = OpLabel
%276 = OpAccessChain %_ptr_Workgroup_float %__workgroup_mem__6 %ulong_0 %151
OpStore %276 %150
OpBranch %275
%275 = OpLabel
OpControlBarrier %uint_2 %uint_2 %uint_264
%277 = OpAccessChain %_ptr_Workgroup_float %__workgroup_mem__6 %ulong_0 %160
%278 = OpLoad %float %277
%279 = OpGroupNonUniformShuffleXor %float %uint_3 %278 %uint_1
%280 = OpExtInst %float %105 FMax %278 %279
%281 = OpIsNan %bool %278
%282 = OpIsNan %bool %279
%283 = OpSelect %float %281 %278 %280
%284 = OpSelect %float %282 %279 %283
%285 = OpGroupNonUniformShuffleXor %float %uint_3 %284 %uint_2
%286 = OpExtInst %float %105 FMax %284 %285
%287 = OpIsNan %bool %284
%288 = OpIsNan %bool %285
%289 = OpSelect %float %287 %284 %286
%290 = OpSelect %float %288 %285 %289
%291 = OpGroupNonUniformShuffleXor %float %uint_3 %290 %uint_4
%292 = OpExtInst %float %105 FMax %290 %291
%293 = OpIsNan %bool %290
%294 = OpIsNan %bool %291
%295 = OpSelect %float %293 %290 %292
%296 = OpSelect %float %294 %291 %295
%297 = OpGroupNonUniformShuffle %float %uint_3 %296 %uint_0
%298 = OpExtInst %float %105 FMax %297 %float_n1_00000002e_30
%299 = OpIsNan %bool %297
%300 = OpSelect %float %299 %297 %298
%301 = OpSelect %float %184 %float_n1_00000002e_30 %300
%302 = OpCompositeConstruct %v4float %272 %272 %272 %272
%303 = OpCompositeConstruct %v4float %301 %301 %301 %301
OpBranch %304
%304 = OpLabel
%307 = OpPhi %ulong %355 %305 %ulong_0 %275
%308 = OpSLessThan %bool %307 %ulong_9216
OpLoopMerge %306 %305 None
OpBranchConditional %308 %305 %306
%305 = OpLabel
%309 = OpSLessThan %bool %307 %ulong_0
%310 = OpISub %ulong %ulong_18446744073709551615 %307
%311 = OpSelect %ulong %309 %310 %307
%312 = OpSDiv %ulong %311 %ulong_4
%313 = OpISub %ulong %ulong_18446744073709551615 %312
%314 = OpSelect %ulong %309 %313 %312
%315 = OpIMul %ulong %79 %ulong_21233664
%316 = OpIAdd %ulong %73 %315
%317 = OpIMul %ulong %76 %ulong_2304
%318 = OpIAdd %ulong %316 %317
%319 = OpIAdd %ulong %314 %318
%320 = OpIAdd %ulong %319 %ulong_5898240
%321 = OpAccessChain %_ptr_StorageBuffer_v4float %__resource_var_0_0_ %ulong_0 %320
%322 = OpLoad %v4float %321
%323 = OpFSub %v4float %322 %303
%324 = OpIsNan %v4bool %323
%325 = OpLogicalOr %v4bool %324 %324
%326 = OpFMul %v4float %323 %35
%327 = OpExtInst %v4float %105 Floor %326
%328 = OpFMul %v4float %327 %33
%329 = OpFSub %v4float %323 %328
%330 = OpFMul %v4float %329 %329
%331 = OpFMul %v4float %330 %330
%332 = OpExtInst %v4float %105 Fma %37 %329 %37
%333 = OpExtInst %v4float %105 Fma %41 %329 %39
%334 = OpExtInst %v4float %105 Fma %45 %329 %43
%335 = OpExtInst %v4float %105 Fma %333 %330 %332
%336 = OpExtInst %v4float %105 Fma %334 %331 %335
%337 = OpConvertFToS %v4uint %327
%338 = OpIAdd %v4uint %337 %54
%339 = OpShiftLeftLogical %v4uint %338 %48
%340 = OpBitcast %v4float %339
%341 = OpFMul %v4float %336 %340
%342 = OpSLessThanEqual %v4bool %337 %54
%343 = OpSGreaterThanEqual %v4bool %337 %56
%344 = OpFOrdEqual %v4bool %323 %58
%345 = OpFOrdEqual %v4bool %323 %50
%346 = OpFOrdGreaterThan %v4bool %323 %67
%347 = OpLogicalAnd %v4bool %342 %343
%348 = OpSelect %v4float %346 %50 %52
%349 = OpSelect %v4float %347 %341 %348
%350 = OpSelect %v4float %345 %50 %349
%351 = OpSelect %v4float %344 %67 %350
%352 = OpSelect %v4float %325 %323 %351
%353 = OpFDiv %v4float %352 %302
%354 = OpAccessChain %_ptr_StorageBuffer_v4float %__resource_var_0_1_ %ulong_0 %319
OpStore %354 %353
%355 = OpIAdd %ulong %307 %ulong_1024
OpBranch %304
%306 = OpLabel
OpReturn
OpFunctionEnd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment