Skip to content
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

Crash: Samsung S24 seems to crash with validation layer #9317

Open
Nielsbishere opened this issue Jan 26, 2025 · 8 comments
Open

Crash: Samsung S24 seems to crash with validation layer #9317

Nielsbishere opened this issue Jan 26, 2025 · 8 comments
Assignees
Labels
GPU-AV GPU Assisted Validation

Comments

@Nielsbishere
Copy link

Environment:

  • OS: Android 14 (Samsung S24)
  • GPU and driver version: Xclipse 940 (build number UP1A.231005.007.S921BXXS5AXKA)
  • SDK or header version if building from repo: latest (happens on either main manual build or the release)
  • Options enabled (synchronization, best practices, etc.): Yes (all of them)

Describe the Issue

Creating this specific spirv compute pipeline (vkCreateComputePipelines) will crash the validation layer on android. Both HLSL and SPIRV are available and of course a minimum repro as well.
This seems to be android specific and the validation layer supplied with my current desktop environment seems to behave fine with both the minimum repro and the real final executable.

Expected behavior

Not crashing.

Valid Usage ID

01-26 00:42:24.033 22352 22401 W OxC3    : Validation Warning: [ WARNING-GPU-Assisted-Validation ] Object 0: handle = 0xb400006f7760c110, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0x24b5c69f | vkCreateDevice(): Internal Warning: Forcing fragmentStoresAndAtomics to VK_TRUE
01-26 00:42:24.033 22352 22401 W OxC3    : Validation Warning: [ WARNING-GPU-Assisted-Validation ] Object 0: handle = 0xb400006f7760c110, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0x24b5c69f | vkCreateDevice(): Internal Warning: Forcing vertexPipelineStoresAndAtomics to VK_TRUE
01-26 00:42:24.033 22352 22401 W OxC3    : Validation Warning: [ WARNING-GPU-Assisted-Validation ] Object 0: handle = 0xb400006f7760c110, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0x24b5c69f | vkCreateDevice(): Internal Warning: Forcing shaderInt64 to VK_TRUE
01-26 00:42:24.034 22352 22401 W OxC3    : Validation Warning: [ WARNING-GPU-Assisted-Validation ] Object 0: handle = 0xb400006f7760c110, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0x24b5c69f | vkCreateDevice(): Internal Warning: Adding a VkPhysicalDeviceTimelineSemaphoreFeatures to pNext with timelineSemaphore set to VK_TRUE
01-26 00:42:24.034 22352 22401 W OxC3    : Validation Warning: [ WARNING-GPU-Assisted-Validation ] Object 0: handle = 0xb400006f7760c110, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0x24b5c69f | vkCreateDevice(): Internal Warning: Adding a VkPhysicalDeviceVulkanMemoryModelFeatures to pNext with vulkanMemoryModel and vulkanMemoryModelDeviceScope set to VK_TRUE
01-26 00:42:24.034 22352 22401 W OxC3    : Validation Warning: [ WARNING-GPU-Assisted-Validation ] Object 0: handle = 0xb400006f7760c110, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0x24b5c69f | vkCreateDevice(): Internal Warning: Adding a VkPhysicalDeviceBufferDeviceAddressFeatures to pNext with bufferDeviceAddress set to VK_TRUE
01-26 00:42:24.034 22352 22401 W OxC3    : Validation Warning: [ WARNING-GPU-Assisted-Validation ] Object 0: handle = 0xb400006f7760c110, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0x24b5c69f | vkCreateDevice(): Internal Warning: Adding a VkPhysicalDevice8BitStorageFeatures to pNext with uniformAndStorageBuffer8BitAccess set to VK_TRUE
01-26 00:42:24.039 22352 22401 D OxC3    : Validation Information: [ WARNING-cache-file-error ] | MessageID = 0xb8515d13 | vkCreateDevice(): Cannot open shader validation cache at /tmp/shader_validation_cache-10511.bin for reading (it may not exist yet)
01-26 00:42:24.040 22352 22401 W OxC3    : Validation Warning: [ WARNING-GPU-Assisted-Validation ] | MessageID = 0x24b5c69f | vkCreateDevice(): Internal Warning: Ray Query validation option was enabled, but the rayQuery feature is not enabled. [Disabling gpuav_validate_ray_query]

Additional context

https://github.com/Oxsomi/vulkan_validation_layer_repro_android here is the repro, in order to repro it, create lib/arm64-v8a/libVkLayer_khronos_validation.so with the latest validation layer. To build it you need conan, python, cmake, msys2 and android ndk, sdk and jdk set up correctly (.so wasn't included because it was too big).

I can also provide the prebuilt apk if need be. Here is the original source of the SPIRV file: https://github.com/Oxsomi/rt_core/blob/main/res/shaders/indirect_prepare.hlsl which will generate the following spirv:

OpCapability Shader
OpCapability ImageQuery
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %2 "main" %3
OpExecutionMode %2 LocalSize 256 1 1
OpDecorate %3 BuiltIn GlobalInvocationId
OpDecorate %5 DescriptorSet 1
OpDecorate %5 Binding 0
OpDecorate %7 DescriptorSet 1
OpDecorate %7 Binding 4
OpDecorate %9 DescriptorSet 2
OpDecorate %9 Binding 0
OpDecorate %10 ArrayStride 4
OpMemberDecorate %6 0 Offset 0
OpDecorate %6 BufferBlock
OpDecorate %11 ArrayStride 16
OpDecorate %12 ArrayStride 16
OpMemberDecorate %8 0 Offset 0
OpMemberDecorate %8 1 Offset 4
OpMemberDecorate %8 2 Offset 8
OpMemberDecorate %8 3 Offset 12
OpMemberDecorate %8 4 Offset 16
OpMemberDecorate %8 5 Offset 144
OpDecorate %8 Block
%13 = OpTypeInt 32 1
%14 = OpConstant %13 0
%15 = OpConstant %13 3
%16 = OpConstant %13 4
%17 = OpConstant %13 5
%18 = OpTypeFloat 32
%19 = OpTypeInt 32 0
%20 = OpConstant %19 131071
%21 = OpConstant %19 4294967295
%22 = OpConstant %19 2
%23 = OpConstant %19 0
%24 = OpConstant %18 0.0
%25 = OpConstant %18 2.0
%26 = OpTypeVector %18 3
%27 = OpConstant %18 1.0
%28 = OpConstantComposite %26 %24 %27 %24
%29 = OpConstant %19 4
%30 = OpConstant %19 3
%31 = OpConstant %19 1
%32 = OpConstant %19 6
%33 = OpConstant %19 9
%34 = OpConstant %19 32
%35 = OpConstant %19 31
%36 = OpConstant %19 92
%37 = OpConstant %19 64
%38 = OpConstant %19 8
%39 = OpConstant %19 12
%40 = OpConstant %19 16
%41 = OpConstant %19 20
%42 = OpConstant %19 131072
%4 = OpTypeImage %18 2D 2 0 0 1 Unknown
%43 = OpTypeArray %4 %42
%44 = OpTypePointer UniformConstant %43
%10 = OpTypeRuntimeArray %19
%6 = OpTypeStruct %10
%45 = OpTypeArray %6 %42
%46 = OpTypePointer Uniform %45
%47 = OpTypeVector %19 4
%11 = OpTypeArray %47 %38
%48 = OpConstant %19 23
%12 = OpTypeArray %47 %48
%8 = OpTypeStruct %19 %18 %18 %19 %11 %12
%49 = OpTypePointer Uniform %8
%50 = OpTypeVector %19 3
%51 = OpTypePointer Input %50
%52 = OpTypeVoid
%53 = OpTypeFunction %52
%54 = OpTypeVector %18 4
%55 = OpTypeMatrix %54 4
%56 = OpTypeBool
%57 = OpTypePointer Uniform %19
%58 = OpTypePointer UniformConstant %4
%59 = OpTypeVector %19 2
%5 = OpVariable %44 UniformConstant
%7 = OpVariable %46 Uniform
%9 = OpVariable %49 Uniform
%3 = OpVariable %51 Input
%60 = OpConstant %18 -2.0
%61 = OpConstantComposite %26 %24 %24 %60
%62 = OpConstant %18 -5.877471754111438e-39
%63 = OpConstantComposite %26 %25 %25 %25
%64 = OpConstant %18 0.5773502588272095
%65 = OpConstant %18 1.001001000404358
%66 = OpConstant %18 -0.10010010004043579
%67 = OpConstantComposite %54 %24 %64 %24 %24
%68 = OpConstantComposite %54 %24 %24 %65 %27
%69 = OpConstantComposite %54 %24 %24 %66 %24
%70 = OpConstantNull %13
%71 = OpConstantNull %19
%72 = OpConstant %19 5
%73 = OpConstant %19 7
%74 = OpConstant %19 10
%75 = OpConstant %19 11
%76 = OpConstant %19 13
%77 = OpConstant %19 14
%78 = OpConstant %19 15
%79 = OpConstant %19 17
%80 = OpConstant %19 18
%81 = OpConstant %19 19
%82 = OpConstant %19 21
%83 = OpConstant %19 22
%84 = OpConstant %19 24
%85 = OpConstant %19 25
%86 = OpConstant %19 26
%87 = OpConstant %19 27
%88 = OpConstant %19 28
%89 = OpConstant %19 29
%90 = OpConstant %19 30
%91 = OpConstant %19 33
%92 = OpConstant %19 34
%93 = OpConstant %19 35
%94 = OpConstant %19 36
%95 = OpConstant %19 37
%96 = OpConstant %19 38
%97 = OpConstant %19 39
%98 = OpConstant %19 40
%99 = OpConstant %19 41
%100 = OpConstant %19 42
%101 = OpConstant %19 43
%102 = OpConstant %19 44
%103 = OpConstant %19 45
%104 = OpConstant %19 46
%105 = OpConstant %19 47
%106 = OpConstant %19 48
%107 = OpConstant %19 49
%108 = OpConstant %19 50
%109 = OpConstant %19 51
%110 = OpConstant %19 52
%111 = OpConstant %19 53
%112 = OpConstant %19 54
%113 = OpConstant %19 55
%114 = OpConstant %19 56
%115 = OpConstant %19 57
%116 = OpConstant %19 58
%117 = OpConstant %19 59
%118 = OpConstant %19 60
%119 = OpConstant %19 61
%120 = OpConstant %19 62
%121 = OpConstant %19 63
%122 = OpConstant %19 65
%123 = OpConstant %19 66
%124 = OpConstant %19 67
%125 = OpConstant %19 68
%126 = OpConstant %19 69
%127 = OpConstant %19 70
%128 = OpConstant %19 71
%129 = OpConstant %19 72
%130 = OpConstant %19 73
%131 = OpConstant %19 74
%132 = OpConstant %19 75
%133 = OpConstant %19 76
%134 = OpConstant %19 77
%135 = OpConstant %19 78
%136 = OpConstant %19 79
%137 = OpConstant %19 80
%138 = OpConstant %19 81
%139 = OpConstant %19 82
%140 = OpConstant %19 83
%141 = OpConstant %19 84
%142 = OpConstant %19 85
%143 = OpConstant %19 86
%144 = OpConstant %19 87
%145 = OpConstant %19 88
%146 = OpConstant %19 89
%147 = OpConstant %19 90
%148 = OpConstant %19 91
%149 = OpConstant %19 93
%150 = OpConstant %19 94
%151 = OpConstant %19 95
%152 = OpConstant %18 0.057792820036411285
%153 = OpConstant %18 0.033366698771715164
%154 = OpConstant %18 29.970001220703125
%155 = OpConstant %18 -0.3333333134651184
%156 = OpConstant %18 0.33366698026657104
%157 = OpConstant %19 2147483648
%158 = OpConstant %19 1065353216
%159 = OpConstant %19 1058262330
%160 = OpConstant %19 1065361613
%161 = OpConstant %19 3184329032
%162 = OpConstantComposite %54 %152 %24 %24 %24
%2 = OpFunction %52 None %53
%163 = OpLabel
%164 = OpLoad %50 %3
%165 = OpCompositeExtract %19 %164 0
OpSelectionMerge %166 None
OpSwitch %23 %167
%167 = OpLabel
%168 = OpUGreaterThanEqual %56 %165 %22
OpSelectionMerge %169 None
OpBranchConditional %168 %170 %169
%170 = OpLabel
OpBranch %166
%169 = OpLabel
%171 = OpIEqual %56 %165 %23
OpSelectionMerge %172 None
OpBranchConditional %171 %173 %172
%173 = OpLabel
%174 = OpAccessChain %57 %9 %15
%175 = OpLoad %19 %174
%176 = OpINotEqual %56 %175 %23
OpSelectionMerge %177 None
OpBranchConditional %176 %178 %177
%178 = OpLabel
%179 = OpAccessChain %57 %9 %16 %23 %14
%180 = OpLoad %19 %179
%181 = OpINotEqual %56 %180 %21
OpSelectionMerge %182 None
OpBranchConditional %181 %183 %182
%183 = OpLabel
%184 = OpBitwiseAnd %19 %180 %20
%185 = OpAccessChain %58 %5 %184
%186 = OpLoad %4 %185
%187 = OpImageQuerySizeLod %59 %186 %23
%188 = OpCompositeExtract %19 %187 0
%189 = OpCompositeExtract %19 %187 1
%190 = OpConvertUToF %18 %188
%191 = OpConvertUToF %18 %189
%192 = OpFDiv %18 %190 %191
OpBranch %182
%182 = OpLabel
%193 = OpPhi %18 (%27 : %178) (%192 : %183)
OpBranch %177
%177 = OpLabel
%194 = OpPhi %18 (%27 : %173) (%193 : %182)
%195 = OpExtInst %26 %1 Normalize %61
%196 = OpExtInst %26 %1 Normalize %28
%197 = OpExtInst %26 %1 Cross %196 %195
%198 = OpExtInst %26 %1 Normalize %197
%199 = OpExtInst %26 %1 Cross %195 %198
%200 = OpCompositeExtract %18 %198 0
%201 = OpCompositeExtract %18 %199 0
%202 = OpCompositeExtract %18 %195 0
%203 = OpCompositeExtract %18 %198 1
%204 = OpCompositeExtract %18 %199 1
%205 = OpCompositeExtract %18 %195 1
%206 = OpCompositeExtract %18 %198 2
%207 = OpCompositeExtract %18 %199 2
%208 = OpCompositeExtract %18 %195 2
%209 = OpDot %18 %195 %63
%210 = OpFNegate %18 %209
%211 = OpCompositeConstruct %54 %200 %201 %202 %24
%212 = OpCompositeConstruct %54 %203 %204 %205 %24
%213 = OpCompositeConstruct %54 %206 %207 %208 %24
%214 = OpCompositeConstruct %54 %62 %62 %210 %27
%215 = OpCompositeConstruct %55 %211 %212 %213 %214
%216 = OpFDiv %18 %64 %194
%217 = OpCompositeConstruct %54 %216 %24 %24 %24
%218 = OpCompositeConstruct %55 %217 %67 %68 %69
%219 = OpMatrixTimesMatrix %55 %218 %215
%220 = OpFMul %18 %207 %205
%221 = OpFNegate %18 %220
%222 = OpFMul %18 %204 %208
%223 = OpFAdd %18 %221 %222
%224 = OpFMul %18 %206 %205
%225 = OpFMul %18 %203 %208
%226 = OpFSub %18 %224 %225
%227 = OpFMul %18 %206 %204
%228 = OpFNegate %18 %227
%229 = OpFMul %18 %203 %207
%230 = OpFAdd %18 %228 %229
%231 = OpFMul %18 %227 %210
%232 = OpFMul %18 %229 %210
%233 = OpFSub %18 %231 %232
%234 = OpFMul %18 %200 %223
%235 = OpFMul %18 %201 %226
%236 = OpFAdd %18 %234 %235
%237 = OpFMul %18 %202 %230
%238 = OpFAdd %18 %236 %237
%239 = OpFDiv %18 %27 %238
%240 = OpFMul %18 %207 %202
%241 = OpFMul %18 %201 %208
%242 = OpFSub %18 %240 %241
%243 = OpFMul %18 %204 %202
%244 = OpFNegate %18 %243
%245 = OpFMul %18 %201 %205
%246 = OpFAdd %18 %244 %245
%247 = OpCompositeConstruct %54 %223 %242 %246 %24
%248 = OpFMul %18 %206 %202
%249 = OpFNegate %18 %248
%250 = OpFMul %18 %200 %208
%251 = OpFAdd %18 %249 %250
%252 = OpFMul %18 %203 %202
%253 = OpFMul %18 %200 %205
%254 = OpFSub %18 %252 %253
%255 = OpCompositeConstruct %54 %226 %251 %254 %24
%256 = OpFMul %18 %206 %201
%257 = OpFMul %18 %200 %207
%258 = OpFSub %18 %256 %257
%259 = OpFMul %18 %203 %201
%260 = OpFNegate %18 %259
%261 = OpFMul %18 %200 %204
%262 = OpFAdd %18 %260 %261
%263 = OpCompositeConstruct %54 %230 %258 %262 %24
%264 = OpFMul %18 %256 %210
%265 = OpFNegate %18 %264
%266 = OpFMul %18 %257 %210
%267 = OpFAdd %18 %265 %266
%268 = OpFMul %18 %259 %210
%269 = OpFMul %18 %261 %210
%270 = OpFSub %18 %268 %269
%271 = OpFMul %18 %229 %202
%272 = OpFMul %18 %227 %202
%273 = OpFSub %18 %271 %272
%274 = OpFMul %18 %256 %205
%275 = OpFAdd %18 %273 %274
%276 = OpFMul %18 %257 %205
%277 = OpFSub %18 %275 %276
%278 = OpFMul %18 %259 %208
%279 = OpFSub %18 %277 %278
%280 = OpFMul %18 %261 %208
%281 = OpFAdd %18 %279 %280
%282 = OpCompositeConstruct %54 %233 %267 %270 %281
%283 = OpCompositeConstruct %54 %239 %239 %239 %239
%284 = OpFMul %54 %247 %283
%285 = OpFMul %54 %255 %283
%286 = OpFMul %54 %263 %283
%287 = OpFMul %54 %282 %283
%288 = OpFMul %18 %154 %194
%289 = OpFDiv %18 %152 %194
%290 = OpCompositeConstruct %54 %24 %289 %24 %24
%291 = OpFDiv %18 %155 %194
%292 = OpCompositeConstruct %54 %24 %24 %24 %291
%293 = OpFDiv %18 %153 %194
%294 = OpFDiv %18 %156 %194
%295 = OpCompositeConstruct %54 %24 %24 %293 %294
%296 = OpCompositeConstruct %54 %288 %288 %288 %288
%297 = OpFMul %54 %162 %296
%298 = OpFMul %54 %290 %296
%299 = OpFMul %54 %292 %296
%300 = OpFMul %54 %295 %296
%301 = OpCompositeExtract %18 %219 0 0
%302 = OpCompositeExtract %18 %219 1 0
%303 = OpCompositeExtract %18 %219 2 0
%304 = OpCompositeExtract %18 %219 3 0
%305 = OpCompositeExtract %18 %219 0 1
%306 = OpCompositeExtract %18 %219 1 1
%307 = OpCompositeExtract %18 %219 2 1
%308 = OpCompositeExtract %18 %219 3 1
%309 = OpCompositeExtract %18 %219 0 2
%310 = OpCompositeExtract %18 %219 1 2
%311 = OpCompositeExtract %18 %219 2 2
%312 = OpCompositeExtract %18 %219 3 2
%313 = OpCompositeExtract %18 %219 0 3
%314 = OpCompositeExtract %18 %219 1 3
%315 = OpCompositeExtract %18 %219 2 3
%316 = OpCompositeExtract %18 %219 3 3
%317 = OpFMul %18 %307 %312
%318 = OpFMul %18 %317 %314
%319 = OpFMul %18 %308 %311
%320 = OpFMul %18 %319 %314
%321 = OpFSub %18 %318 %320
%322 = OpFMul %18 %308 %310
%323 = OpFMul %18 %322 %315
%324 = OpFAdd %18 %321 %323
%325 = OpFMul %18 %306 %312
%326 = OpFMul %18 %325 %315
%327 = OpFSub %18 %324 %326
%328 = OpFMul %18 %307 %310
%329 = OpFMul %18 %328 %316
%330 = OpFSub %18 %327 %329
%331 = OpFMul %18 %306 %311
%332 = OpFMul %18 %331 %316
%333 = OpFAdd %18 %330 %332
%334 = OpFMul %18 %304 %311
%335 = OpFMul %18 %334 %314
%336 = OpFMul %18 %303 %312
%337 = OpFMul %18 %336 %314
%338 = OpFSub %18 %335 %337
%339 = OpFMul %18 %304 %310
%340 = OpFMul %18 %339 %315
%341 = OpFSub %18 %338 %340
%342 = OpFMul %18 %302 %312
%343 = OpFMul %18 %342 %315
%344 = OpFAdd %18 %341 %343
%345 = OpFMul %18 %303 %310
%346 = OpFMul %18 %345 %316
%347 = OpFAdd %18 %344 %346
%348 = OpFMul %18 %302 %311
%349 = OpFMul %18 %348 %316
%350 = OpFSub %18 %347 %349
%351 = OpFMul %18 %303 %308
%352 = OpFMul %18 %351 %314
%353 = OpFMul %18 %304 %307
%354 = OpFMul %18 %353 %314
%355 = OpFSub %18 %352 %354
%356 = OpFMul %18 %304 %306
%357 = OpFMul %18 %356 %315
%358 = OpFAdd %18 %355 %357
%359 = OpFMul %18 %302 %308
%360 = OpFMul %18 %359 %315
%361 = OpFSub %18 %358 %360
%362 = OpFMul %18 %303 %306
%363 = OpFMul %18 %362 %316
%364 = OpFSub %18 %361 %363
%365 = OpFMul %18 %302 %307
%366 = OpFMul %18 %365 %316
%367 = OpFAdd %18 %364 %366
%368 = OpFMul %18 %353 %310
%369 = OpFMul %18 %351 %310
%370 = OpFSub %18 %368 %369
%371 = OpFMul %18 %356 %311
%372 = OpFSub %18 %370 %371
%373 = OpFMul %18 %359 %311
%374 = OpFAdd %18 %372 %373
%375 = OpFMul %18 %362 %312
%376 = OpFAdd %18 %374 %375
%377 = OpFMul %18 %365 %312
%378 = OpFSub %18 %376 %377
%379 = OpFMul %18 %301 %333
%380 = OpFMul %18 %305 %350
%381 = OpFAdd %18 %379 %380
%382 = OpFMul %18 %309 %367
%383 = OpFAdd %18 %381 %382
%384 = OpFMul %18 %313 %378
%385 = OpFAdd %18 %383 %384
%386 = OpFDiv %18 %27 %385
%387 = OpFMul %18 %319 %313
%388 = OpFMul %18 %317 %313
%389 = OpFSub %18 %387 %388
%390 = OpFMul %18 %308 %309
%391 = OpFMul %18 %390 %315
%392 = OpFSub %18 %389 %391
%393 = OpFMul %18 %305 %312
%394 = OpFMul %18 %393 %315
%395 = OpFAdd %18 %392 %394
%396 = OpFMul %18 %307 %309
%397 = OpFMul %18 %396 %316
%398 = OpFAdd %18 %395 %397
%399 = OpFMul %18 %305 %311
%400 = OpFMul %18 %399 %316
%401 = OpFSub %18 %398 %400
%402 = OpFMul %18 %325 %313
%403 = OpFMul %18 %322 %313
%404 = OpFSub %18 %402 %403
%405 = OpFMul %18 %390 %314
%406 = OpFAdd %18 %404 %405
%407 = OpFMul %18 %393 %314
%408 = OpFSub %18 %406 %407
%409 = OpFMul %18 %306 %309
%410 = OpFMul %18 %409 %316
%411 = OpFSub %18 %408 %410
%412 = OpFMul %18 %305 %310
%413 = OpFMul %18 %412 %316
%414 = OpFAdd %18 %411 %413
%415 = OpFMul %18 %328 %313
%416 = OpFMul %18 %331 %313
%417 = OpFSub %18 %415 %416
%418 = OpFMul %18 %396 %314
%419 = OpFSub %18 %417 %418
%420 = OpFMul %18 %399 %314
%421 = OpFAdd %18 %419 %420
%422 = OpFMul %18 %409 %315
%423 = OpFAdd %18 %421 %422
%424 = OpFMul %18 %412 %315
%425 = OpFSub %18 %423 %424
%426 = OpCompositeConstruct %54 %333 %401 %414 %425
%427 = OpFMul %18 %336 %313
%428 = OpFMul %18 %334 %313
%429 = OpFSub %18 %427 %428
%430 = OpFMul %18 %304 %309
%431 = OpFMul %18 %430 %315
%432 = OpFAdd %18 %429 %431
%433 = OpFMul %18 %301 %312
%434 = OpFMul %18 %433 %315
%435 = OpFSub %18 %432 %434
%436 = OpFMul %18 %303 %309
%437 = OpFMul %18 %436 %316
%438 = OpFSub %18 %435 %437
%439 = OpFMul %18 %301 %311
%440 = OpFMul %18 %439 %316
%441 = OpFAdd %18 %438 %440
%442 = OpFMul %18 %339 %313
%443 = OpFMul %18 %342 %313
%444 = OpFSub %18 %442 %443
%445 = OpFMul %18 %430 %314
%446 = OpFSub %18 %444 %445
%447 = OpFMul %18 %433 %314
%448 = OpFAdd %18 %446 %447
%449 = OpFMul %18 %302 %309
%450 = OpFMul %18 %449 %316
%451 = OpFAdd %18 %448 %450
%452 = OpFMul %18 %301 %310
%453 = OpFMul %18 %452 %316
%454 = OpFSub %18 %451 %453
%455 = OpFMul %18 %348 %313
%456 = OpFMul %18 %345 %313
%457 = OpFSub %18 %455 %456
%458 = OpFMul %18 %436 %314
%459 = OpFAdd %18 %457 %458
%460 = OpFMul %18 %439 %314
%461 = OpFSub %18 %459 %460
%462 = OpFMul %18 %449 %315
%463 = OpFSub %18 %461 %462
%464 = OpFMul %18 %452 %315
%465 = OpFAdd %18 %463 %464
%466 = OpCompositeConstruct %54 %350 %441 %454 %465
%467 = OpFMul %18 %353 %313
%468 = OpFMul %18 %351 %313
%469 = OpFSub %18 %467 %468
%470 = OpFMul %18 %304 %305
%471 = OpFMul %18 %470 %315
%472 = OpFSub %18 %469 %471
%473 = OpFMul %18 %301 %308
%474 = OpFMul %18 %473 %315
%475 = OpFAdd %18 %472 %474
%476 = OpFMul %18 %303 %305
%477 = OpFMul %18 %476 %316
%478 = OpFAdd %18 %475 %477
%479 = OpFMul %18 %301 %307
%480 = OpFMul %18 %479 %316
%481 = OpFSub %18 %478 %480
%482 = OpFMul %18 %359 %313
%483 = OpFMul %18 %356 %313
%484 = OpFSub %18 %482 %483
%485 = OpFMul %18 %470 %314
%486 = OpFAdd %18 %484 %485
%487 = OpFMul %18 %473 %314
%488 = OpFSub %18 %486 %487
%489 = OpFMul %18 %302 %305
%490 = OpFMul %18 %489 %316
%491 = OpFSub %18 %488 %490
%492 = OpFMul %18 %301 %306
%493 = OpFMul %18 %492 %316
%494 = OpFAdd %18 %491 %493
%495 = OpFMul %18 %362 %313
%496 = OpFMul %18 %365 %313
%497 = OpFSub %18 %495 %496
%498 = OpFMul %18 %476 %314
%499 = OpFSub %18 %497 %498
%500 = OpFMul %18 %479 %314
%501 = OpFAdd %18 %499 %500
%502 = OpFMul %18 %489 %315
%503 = OpFAdd %18 %501 %502
%504 = OpFMul %18 %492 %315
%505 = OpFSub %18 %503 %504
%506 = OpCompositeConstruct %54 %367 %481 %494 %505
%507 = OpFMul %18 %351 %309
%508 = OpFMul %18 %353 %309
%509 = OpFSub %18 %507 %508
%510 = OpFMul %18 %470 %311
%511 = OpFAdd %18 %509 %510
%512 = OpFMul %18 %473 %311
%513 = OpFSub %18 %511 %512
%514 = OpFMul %18 %476 %312
%515 = OpFSub %18 %513 %514
%516 = OpFMul %18 %479 %312
%517 = OpFAdd %18 %515 %516
%518 = OpFMul %18 %356 %309
%519 = OpFMul %18 %359 %309
%520 = OpFSub %18 %518 %519
%521 = OpFMul %18 %470 %310
%522 = OpFSub %18 %520 %521
%523 = OpFMul %18 %473 %310
%524 = OpFAdd %18 %522 %523
%525 = OpFMul %18 %489 %312
%526 = OpFAdd %18 %524 %525
%527 = OpFMul %18 %492 %312
%528 = OpFSub %18 %526 %527
%529 = OpFMul %18 %365 %309
%530 = OpFMul %18 %362 %309
%531 = OpFSub %18 %529 %530
%532 = OpFMul %18 %476 %310
%533 = OpFAdd %18 %531 %532
%534 = OpFMul %18 %479 %310
%535 = OpFSub %18 %533 %534
%536 = OpFMul %18 %489 %311
%537 = OpFSub %18 %535 %536
%538 = OpFMul %18 %492 %311
%539 = OpFAdd %18 %537 %538
%540 = OpCompositeConstruct %54 %378 %517 %528 %539
%541 = OpCompositeConstruct %54 %386 %386 %386 %386
%542 = OpFMul %54 %426 %541
%543 = OpFMul %54 %466 %541
%544 = OpFMul %54 %506 %541
%545 = OpFMul %54 %540 %541
%546 = OpAccessChain %57 %9 %17 %31 %23
%547 = OpLoad %19 %546
%548 = OpBitwiseAnd %19 %547 %20
%549 = OpAccessChain %57 %7 %548 %23 %23
%550 = OpBitcast %19 %200
OpStore %549 %550
%551 = OpAccessChain %57 %7 %548 %23 %31
%552 = OpBitcast %19 %203
OpStore %551 %552
%553 = OpAccessChain %57 %7 %548 %23 %22
%554 = OpBitcast %19 %206
OpStore %553 %554
%555 = OpAccessChain %57 %7 %548 %23 %30
OpStore %555 %157
%556 = OpAccessChain %57 %7 %548 %23 %29
%557 = OpBitcast %19 %201
OpStore %556 %557
%558 = OpAccessChain %57 %7 %548 %23 %72
%559 = OpBitcast %19 %204
OpStore %558 %559
%560 = OpAccessChain %57 %7 %548 %23 %32
%561 = OpBitcast %19 %207
OpStore %560 %561
%562 = OpAccessChain %57 %7 %548 %23 %73
OpStore %562 %157
%563 = OpAccessChain %57 %7 %548 %23 %38
%564 = OpBitcast %19 %202
OpStore %563 %564
%565 = OpAccessChain %57 %7 %548 %23 %33
%566 = OpBitcast %19 %205
OpStore %565 %566
%567 = OpAccessChain %57 %7 %548 %23 %74
%568 = OpBitcast %19 %208
OpStore %567 %568
%569 = OpAccessChain %57 %7 %548 %23 %75
%570 = OpBitcast %19 %210
OpStore %569 %570
%571 = OpAccessChain %57 %7 %548 %23 %39
OpStore %571 %23
%572 = OpAccessChain %57 %7 %548 %23 %76
OpStore %572 %23
%573 = OpAccessChain %57 %7 %548 %23 %77
OpStore %573 %23
%574 = OpAccessChain %57 %7 %548 %23 %78
OpStore %574 %158
%575 = OpAccessChain %57 %7 %548 %23 %40
%576 = OpBitcast %19 %216
OpStore %575 %576
%577 = OpAccessChain %57 %7 %548 %23 %79
OpStore %577 %23
%578 = OpAccessChain %57 %7 %548 %23 %80
OpStore %578 %23
%579 = OpAccessChain %57 %7 %548 %23 %81
OpStore %579 %23
%580 = OpAccessChain %57 %7 %548 %23 %41
OpStore %580 %23
%581 = OpAccessChain %57 %7 %548 %23 %82
OpStore %581 %159
%582 = OpAccessChain %57 %7 %548 %23 %83
OpStore %582 %23
%583 = OpAccessChain %57 %7 %548 %23 %48
OpStore %583 %23
%584 = OpAccessChain %57 %7 %548 %23 %84
OpStore %584 %23
%585 = OpAccessChain %57 %7 %548 %23 %85
OpStore %585 %23
%586 = OpAccessChain %57 %7 %548 %23 %86
OpStore %586 %160
%587 = OpAccessChain %57 %7 %548 %23 %87
OpStore %587 %161
%588 = OpAccessChain %57 %7 %548 %23 %88
OpStore %588 %23
%589 = OpAccessChain %57 %7 %548 %23 %89
OpStore %589 %23
%590 = OpAccessChain %57 %7 %548 %23 %90
OpStore %590 %158
%591 = OpAccessChain %57 %7 %548 %23 %35
OpStore %591 %23
%592 = OpAccessChain %57 %7 %548 %23 %34
%593 = OpBitcast %19 %301
OpStore %592 %593
%594 = OpAccessChain %57 %7 %548 %23 %91
%595 = OpBitcast %19 %302
OpStore %594 %595
%596 = OpAccessChain %57 %7 %548 %23 %92
%597 = OpBitcast %19 %303
OpStore %596 %597
%598 = OpAccessChain %57 %7 %548 %23 %93
%599 = OpBitcast %19 %304
OpStore %598 %599
%600 = OpAccessChain %57 %7 %548 %23 %94
%601 = OpBitcast %19 %305
OpStore %600 %601
%602 = OpAccessChain %57 %7 %548 %23 %95
%603 = OpBitcast %19 %306
OpStore %602 %603
%604 = OpAccessChain %57 %7 %548 %23 %96
%605 = OpBitcast %19 %307
OpStore %604 %605
%606 = OpAccessChain %57 %7 %548 %23 %97
%607 = OpBitcast %19 %308
OpStore %606 %607
%608 = OpAccessChain %57 %7 %548 %23 %98
%609 = OpBitcast %19 %309
OpStore %608 %609
%610 = OpAccessChain %57 %7 %548 %23 %99
%611 = OpBitcast %19 %310
OpStore %610 %611
%612 = OpAccessChain %57 %7 %548 %23 %100
%613 = OpBitcast %19 %311
OpStore %612 %613
%614 = OpAccessChain %57 %7 %548 %23 %101
%615 = OpBitcast %19 %312
OpStore %614 %615
%616 = OpAccessChain %57 %7 %548 %23 %102
%617 = OpBitcast %19 %313
OpStore %616 %617
%618 = OpAccessChain %57 %7 %548 %23 %103
%619 = OpBitcast %19 %314
OpStore %618 %619
%620 = OpAccessChain %57 %7 %548 %23 %104
%621 = OpBitcast %19 %315
OpStore %620 %621
%622 = OpAccessChain %57 %7 %548 %23 %105
%623 = OpBitcast %19 %316
OpStore %622 %623
%624 = OpCompositeExtract %18 %284 0
%625 = OpCompositeExtract %18 %285 0
%626 = OpCompositeExtract %18 %286 0
%627 = OpCompositeExtract %18 %287 0
%628 = OpCompositeExtract %18 %284 1
%629 = OpCompositeExtract %18 %285 1
%630 = OpCompositeExtract %18 %286 1
%631 = OpCompositeExtract %18 %287 1
%632 = OpCompositeExtract %18 %284 2
%633 = OpCompositeExtract %18 %285 2
%634 = OpCompositeExtract %18 %286 2
%635 = OpCompositeExtract %18 %287 2
%636 = OpCompositeExtract %18 %284 3
%637 = OpCompositeExtract %18 %285 3
%638 = OpCompositeExtract %18 %286 3
%639 = OpCompositeExtract %18 %287 3
%640 = OpAccessChain %57 %7 %548 %23 %106
%641 = OpBitcast %19 %624
OpStore %640 %641
%642 = OpAccessChain %57 %7 %548 %23 %107
%643 = OpBitcast %19 %625
OpStore %642 %643
%644 = OpAccessChain %57 %7 %548 %23 %108
%645 = OpBitcast %19 %626
OpStore %644 %645
%646 = OpAccessChain %57 %7 %548 %23 %109
%647 = OpBitcast %19 %627
OpStore %646 %647
%648 = OpAccessChain %57 %7 %548 %23 %110
%649 = OpBitcast %19 %628
OpStore %648 %649
%650 = OpAccessChain %57 %7 %548 %23 %111
%651 = OpBitcast %19 %629
OpStore %650 %651
%652 = OpAccessChain %57 %7 %548 %23 %112
%653 = OpBitcast %19 %630
OpStore %652 %653
%654 = OpAccessChain %57 %7 %548 %23 %113
%655 = OpBitcast %19 %631
OpStore %654 %655
%656 = OpAccessChain %57 %7 %548 %23 %114
%657 = OpBitcast %19 %632
OpStore %656 %657
%658 = OpAccessChain %57 %7 %548 %23 %115
%659 = OpBitcast %19 %633
OpStore %658 %659
%660 = OpAccessChain %57 %7 %548 %23 %116
%661 = OpBitcast %19 %634
OpStore %660 %661
%662 = OpAccessChain %57 %7 %548 %23 %117
%663 = OpBitcast %19 %635
OpStore %662 %663
%664 = OpAccessChain %57 %7 %548 %23 %118
%665 = OpBitcast %19 %636
OpStore %664 %665
%666 = OpAccessChain %57 %7 %548 %23 %119
%667 = OpBitcast %19 %637
OpStore %666 %667
%668 = OpAccessChain %57 %7 %548 %23 %120
%669 = OpBitcast %19 %638
OpStore %668 %669
%670 = OpAccessChain %57 %7 %548 %23 %121
%671 = OpBitcast %19 %639
OpStore %670 %671
%672 = OpCompositeExtract %18 %297 0
%673 = OpCompositeExtract %18 %298 0
%674 = OpCompositeExtract %18 %299 0
%675 = OpCompositeExtract %18 %300 0
%676 = OpCompositeExtract %18 %297 1
%677 = OpCompositeExtract %18 %298 1
%678 = OpCompositeExtract %18 %299 1
%679 = OpCompositeExtract %18 %300 1
%680 = OpCompositeExtract %18 %297 2
%681 = OpCompositeExtract %18 %298 2
%682 = OpCompositeExtract %18 %299 2
%683 = OpCompositeExtract %18 %300 2
%684 = OpCompositeExtract %18 %297 3
%685 = OpCompositeExtract %18 %298 3
%686 = OpCompositeExtract %18 %299 3
%687 = OpCompositeExtract %18 %300 3
%688 = OpAccessChain %57 %7 %548 %23 %37
%689 = OpBitcast %19 %672
OpStore %688 %689
%690 = OpAccessChain %57 %7 %548 %23 %122
%691 = OpBitcast %19 %673
OpStore %690 %691
%692 = OpAccessChain %57 %7 %548 %23 %123
%693 = OpBitcast %19 %674
OpStore %692 %693
%694 = OpAccessChain %57 %7 %548 %23 %124
%695 = OpBitcast %19 %675
OpStore %694 %695
%696 = OpAccessChain %57 %7 %548 %23 %125
%697 = OpBitcast %19 %676
OpStore %696 %697
%698 = OpAccessChain %57 %7 %548 %23 %126
%699 = OpBitcast %19 %677
OpStore %698 %699
%700 = OpAccessChain %57 %7 %548 %23 %127
%701 = OpBitcast %19 %678
OpStore %700 %701
%702 = OpAccessChain %57 %7 %548 %23 %128
%703 = OpBitcast %19 %679
OpStore %702 %703
%704 = OpAccessChain %57 %7 %548 %23 %129
%705 = OpBitcast %19 %680
OpStore %704 %705
%706 = OpAccessChain %57 %7 %548 %23 %130
%707 = OpBitcast %19 %681
OpStore %706 %707
%708 = OpAccessChain %57 %7 %548 %23 %131
%709 = OpBitcast %19 %682
OpStore %708 %709
%710 = OpAccessChain %57 %7 %548 %23 %132
%711 = OpBitcast %19 %683
OpStore %710 %711
%712 = OpAccessChain %57 %7 %548 %23 %133
%713 = OpBitcast %19 %684
OpStore %712 %713
%714 = OpAccessChain %57 %7 %548 %23 %134
%715 = OpBitcast %19 %685
OpStore %714 %715
%716 = OpAccessChain %57 %7 %548 %23 %135
%717 = OpBitcast %19 %686
OpStore %716 %717
%718 = OpAccessChain %57 %7 %548 %23 %136
%719 = OpBitcast %19 %687
OpStore %718 %719
%720 = OpCompositeExtract %18 %542 0
%721 = OpCompositeExtract %18 %543 0
%722 = OpCompositeExtract %18 %544 0
%723 = OpCompositeExtract %18 %545 0
%724 = OpCompositeExtract %18 %542 1
%725 = OpCompositeExtract %18 %543 1
%726 = OpCompositeExtract %18 %544 1
%727 = OpCompositeExtract %18 %545 1
%728 = OpCompositeExtract %18 %542 2
%729 = OpCompositeExtract %18 %543 2
%730 = OpCompositeExtract %18 %544 2
%731 = OpCompositeExtract %18 %545 2
%732 = OpCompositeExtract %18 %542 3
%733 = OpCompositeExtract %18 %543 3
%734 = OpCompositeExtract %18 %544 3
%735 = OpCompositeExtract %18 %545 3
%736 = OpAccessChain %57 %7 %548 %23 %137
%737 = OpBitcast %19 %720
OpStore %736 %737
%738 = OpAccessChain %57 %7 %548 %23 %138
%739 = OpBitcast %19 %721
OpStore %738 %739
%740 = OpAccessChain %57 %7 %548 %23 %139
%741 = OpBitcast %19 %722
OpStore %740 %741
%742 = OpAccessChain %57 %7 %548 %23 %140
%743 = OpBitcast %19 %723
OpStore %742 %743
%744 = OpAccessChain %57 %7 %548 %23 %141
%745 = OpBitcast %19 %724
OpStore %744 %745
%746 = OpAccessChain %57 %7 %548 %23 %142
%747 = OpBitcast %19 %725
OpStore %746 %747
%748 = OpAccessChain %57 %7 %548 %23 %143
%749 = OpBitcast %19 %726
OpStore %748 %749
%750 = OpAccessChain %57 %7 %548 %23 %144
%751 = OpBitcast %19 %727
OpStore %750 %751
%752 = OpAccessChain %57 %7 %548 %23 %145
%753 = OpBitcast %19 %728
OpStore %752 %753
%754 = OpAccessChain %57 %7 %548 %23 %146
%755 = OpBitcast %19 %729
OpStore %754 %755
%756 = OpAccessChain %57 %7 %548 %23 %147
%757 = OpBitcast %19 %730
OpStore %756 %757
%758 = OpAccessChain %57 %7 %548 %23 %148
%759 = OpBitcast %19 %731
OpStore %758 %759
%760 = OpAccessChain %57 %7 %548 %23 %36
%761 = OpBitcast %19 %732
OpStore %760 %761
%762 = OpAccessChain %57 %7 %548 %23 %149
%763 = OpBitcast %19 %733
OpStore %762 %763
%764 = OpAccessChain %57 %7 %548 %23 %150
%765 = OpBitcast %19 %734
OpStore %764 %765
%766 = OpAccessChain %57 %7 %548 %23 %151
%767 = OpBitcast %19 %735
OpStore %766 %767
OpBranch %172
%172 = OpLabel
OpSelectionMerge %768 None
OpBranchConditional %171 %769 %768
%769 = OpLabel
%770 = OpAccessChain %57 %9 %17 %23 %30
%771 = OpLoad %19 %770
%772 = OpBitwiseAnd %19 %771 %20
%773 = OpAccessChain %57 %7 %772 %23 %23
OpStore %773 %31
%774 = OpAccessChain %57 %7 %772 %23 %31
OpStore %774 %31
%775 = OpAccessChain %57 %7 %772 %23 %22
OpStore %775 %31
OpBranch %768
%768 = OpLabel
%776 = OpAccessChain %57 %9 %17 %23 %22
%777 = OpLoad %19 %776
OpSelectionMerge %778 None
OpSwitch %165 %779 0 %780
%780 = OpLabel
OpBranch %778
%779 = OpLabel
OpBranch %778
%778 = OpLabel
%781 = OpPhi %19 (%30 : %780) (%32 : %779)
%782 = OpPhi %19 (%32 : %780) (%33 : %779)
%783 = OpIMul %19 %165 %34
%784 = OpBitwiseAnd %19 %777 %20
%785 = OpShiftRightLogical %19 %783 %22
%786 = OpAccessChain %57 %7 %784 %23 %785
OpStore %786 %781
%787 = OpIAdd %19 %783 %29
%788 = OpShiftRightLogical %19 %787 %22
%789 = OpAccessChain %57 %7 %784 %23 %788
OpStore %789 %31
%790 = OpIAdd %19 %783 %38
%791 = OpShiftRightLogical %19 %790 %22
%792 = OpAccessChain %57 %7 %784 %23 %791
OpStore %792 %782
%793 = OpIAdd %19 %783 %39
%794 = OpShiftRightLogical %19 %793 %22
%795 = OpAccessChain %57 %7 %784 %23 %794
%796 = OpBitcast %19 %70
OpStore %795 %796
%797 = OpIAdd %19 %783 %40
%798 = OpShiftRightLogical %19 %797 %22
%799 = OpAccessChain %57 %7 %784 %23 %798
OpStore %799 %71
%800 = OpIAdd %19 %783 %41
%801 = OpShiftRightLogical %19 %800 %22
%802 = OpAccessChain %57 %7 %784 %23 %801
OpStore %802 %71
%803 = OpIAdd %19 %801 %31
%804 = OpAccessChain %57 %7 %784 %23 %803
OpStore %804 %71
%805 = OpIAdd %19 %801 %22
%806 = OpAccessChain %57 %7 %784 %23 %805
OpStore %806 %71
OpBranch %166
%166 = OpLabel
OpReturn
OpFunctionEnd
@spencer-lunarg
Copy link
Contributor

@Nielsbishere I am trying to grasp what is going on and reproduce a minimal test

running this through SPIRV-Cross (https://godbolt.org/z/qE95f8jvb) I at first thought it might be the huge 131072 array of descriptors (instead of a runtime array) but reducing that to 1 didn't fix it

So it seems GPU-AV is not crashing, but at least on linux mesa with ToT drivers, it takes 20 seconds to compile this pipeline. We do 113 instrumentation on descriptor indexes and if I limit it to like 10 or 30 I see the linear build up of time to compile

If you could get me a stack trace (aka, want to confirm this idea) that what is happening here is GPU-AV is creating such a large shader that the Android compiler just gives up and crashes

@Nielsbishere
Copy link
Author

Nielsbishere commented Jan 27, 2025

The reason why this array is so big is because of poor man's bindless; all of the arrays are sized big as an initial test (ofc this is wasteful for memory, so in the future they'd be dynamically sized and reduced to a much more acceptable size).

Why is such a slow shader to compile? Is it just because of the descriptor array size?

What is a reliable way I can get a stack trace on crash? I tried attaching a signal and printing the stack trace there (this works perfectly fine in most cases like on osx, linux and windows; also on segfaults), but it doesn't seem to work here. It just crashes without giving me any info. Maybe I made a mistake in the stacktrace, I'll try again.

Is it possible android has something similar to what windows has (TDR limit) where after a certain time it times you out and just aborts (but in this case not cleanly and not because of a render but rather because of a shader compile)?

@spencer-lunarg
Copy link
Contributor

So the array size is NOT the issue, the core issue is if you have something like

layout(set = 0, binding = 1) uniform sampler2D tex[];
result += texture(tex[index], vec2(0, 0));
result += texture(tex[index], vec2(0.1, 0));
result += texture(tex[index], vec2(0.2, 0));
// ... same thing 100 more time

we wrap every tex[index] with basically

if (IsOOB(index)) {
    result += texture(tex[index], vec2(0, 0));
} else {
    result += 0; // fallback
}

so you don't crash

so we could (and have talked about many times) doing something where we only check the first use of index which would GREATLY reduce the compile time (and probably fix the crash), but it comes at a cost of if you do actually have an invalid index, you might crash and no way to get the error message out to let you know

@Nielsbishere
Copy link
Author

sounds tricky :/ I'll try to get a callstack soon.

As a note; https://github.com/Oxsomi/rt_core/blob/main/res/shaders/indirect_prepare.hlsl the real code indicates to me too that DXC is not generating optimal code here, because from what I know, it has to access RWByteAddressBuffer using a uint every time; that's why you see so many stores being emitted.

I'm not sure if this is preventable, will raise it there as well to see if there's a solution to make this a bit faster.

@spencer-lunarg
Copy link
Contributor

That is a SPIR-V limitation, you need to have the access pointed, there is no way to get a "reference of the RWByteAddressBuffer"

If you are using Buffer Device Address, you can actually have a pointer, then it is not having to re-reference things each time

For the record, the pattern you have is known, we have a stress test for it even, so I am still trying to understand why your version is so much more slower then our stress test... regardless thanks for raising this, the whole shader instrumentation is an on-going challenge

if you go export VK_LAYER_GPUAV_DESCRIPTOR_CHECKS=0 (or on Android it should be adb setprop debug.vulkan.khronos_validation.gpuav_descriptor_checks 0) it will turn this off for you

@spencer-lunarg spencer-lunarg self-assigned this Jan 27, 2025
@spencer-lunarg spencer-lunarg added the GPU-AV GPU Assisted Validation label Jan 27, 2025
@Nielsbishere
Copy link
Author

Hmmm tricky, DXC also can't just randomly assume you have BDA enabled and even if it did have a fast path there, you'd somehow have to pass it maybe as a root constant (which is impossible because then the type of the descriptor wouldn't be compatible).
Thanks for the workaround.

@Nielsbishere
Copy link
Author

Nielsbishere commented Jan 27, 2025

Update: I can confirm that I'm receiving no signals on terminate, so it's not really possible for me to find a stacktrace. I have tested the capture callstack and print call stack and they work fine and also segfault and other signals go through the same handler fine.

I think Android just terminates the app without notifying it? Instead of signalling something like SIGTERM which would give me the option to print a stacktrace. Seems like logcat is also not of any use here, it just seems like the app is randomly terminated without a log message.

(Can also confirm that the workaround fixes it)

@spencer-lunarg
Copy link
Contributor

(Can also confirm that the workaround fixes it)

Ok, then it is probably 95% what I am expecting it to be... will have time later this week to look back into GPU-AV SPIR-V stuff and will try to find a clever way to prevent this for people with similar shaders

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GPU-AV GPU Assisted Validation
Projects
None yet
Development

No branches or pull requests

2 participants