Skip to content

Commit da7711a

Browse files
gpu: Add descriptor set and binding numbers to GPU-AV errors
The descriptor set and binding numbers are now part of the error record produced by the GPU-AV SPIR-V instrumentation. Add it to the error messages so that it is easier to find which descriptor needs to be fixed. Fixes #5495 NOTE: This change requires SPIRV-Tools to be updated.
1 parent 314e538 commit da7711a

File tree

5 files changed

+23
-18
lines changed

5 files changed

+23
-18
lines changed

build-android/known_good.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"name": "SPIRV-Tools",
2323
"url": "https://github.com/KhronosGroup/SPIRV-Tools.git",
2424
"sub_dir": "shaderc/third_party/spirv-tools",
25-
"commit": "d4c0abdcad60325a2ab3c00a81847e2dbdc927a2"
25+
"commit": "0ce36ad7856e15b545bc7b9fc9a7c49671b40f96"
2626
},
2727
{
2828
"name": "SPIRV-Headers",

layers/generated/spirv_tools_commit_id.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
****************************************************************************/
2323
#pragma once
2424

25-
#define SPIRV_TOOLS_COMMIT_ID "d4c0abdcad60325a2ab3c00a81847e2dbdc927a2"
25+
#define SPIRV_TOOLS_COMMIT_ID "0ce36ad7856e15b545bc7b9fc9a7c49671b40f96"

layers/gpu_validation/gpu_validation.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,12 +1011,13 @@ bool GenerateValidationMessage(const uint32_t *debug_record, std::string &msg, s
10111011
oob_access = false;
10121012
switch (debug_record[kInstValidationOutError]) {
10131013
case kInstErrorBindlessBounds: {
1014-
strm << "Index of " << debug_record[kInstBindlessBoundsOutDescIndex] << " used to index descriptor array of length "
1015-
<< debug_record[kInstBindlessBoundsOutDescBound] << ". ";
1014+
strm << "(set = " << debug_record[kInstBindlessBoundsOutDescSet] << ", binding = " << debug_record[kInstBindlessBoundsOutDescBinding] << ") Index of "
1015+
<< debug_record[kInstBindlessBoundsOutDescIndex] << " used to index descriptor array of length " << debug_record[kInstBindlessBoundsOutDescBound] << ". ";
10161016
vuid_msg = "UNASSIGNED-Descriptor index out of bounds";
10171017
} break;
10181018
case kInstErrorBindlessUninit: {
1019-
strm << "Descriptor index " << debug_record[kInstBindlessUninitOutDescIndex] << " is uninitialized.";
1019+
strm << "(set = " << debug_record[kInstBindlessUninitOutDescSet] << ", binding = " << debug_record[kInstBindlessUninitOutBinding] << ") Descriptor index "
1020+
<< debug_record[kInstBindlessUninitOutDescIndex] << " is uninitialized.";
10201021
vuid_msg = "UNASSIGNED-Descriptor uninitialized";
10211022
} break;
10221023
case kInstErrorBuffAddrUnallocRef: {
@@ -1029,11 +1030,13 @@ bool GenerateValidationMessage(const uint32_t *debug_record, std::string &msg, s
10291030
case kInstErrorBuffOOBStorage: {
10301031
auto size = debug_record[kInstBindlessBuffOOBOutBuffSize];
10311032
if (size == 0) {
1032-
strm << "Descriptor index " << debug_record[kInstBindlessBuffOOBOutDescIndex] << " is uninitialized.";
1033+
strm << "(set = " << debug_record[kInstBindlessBuffOOBOutDescSet] << ", binding = " << debug_record[kInstBindlessBuffOOBOutDescBinding]
1034+
<< ") Descriptor index " << debug_record[kInstBindlessBuffOOBOutDescIndex] << " is uninitialized.";
10331035
vuid_msg = "UNASSIGNED-Descriptor uninitialized";
10341036
} else {
10351037
oob_access = true;
1036-
strm << "Descriptor index " << debug_record[kInstBindlessBuffOOBOutDescIndex]
1038+
strm << "(set = " << debug_record[kInstBindlessBuffOOBOutDescSet] << ", binding = " << debug_record[kInstBindlessBuffOOBOutDescBinding]
1039+
<< ") Descriptor index " << debug_record[kInstBindlessBuffOOBOutDescIndex]
10371040
<< " access out of bounds. Descriptor size is " << debug_record[kInstBindlessBuffOOBOutBuffSize]
10381041
<< " and highest byte accessed was " << debug_record[kInstBindlessBuffOOBOutBuffOff];
10391042
if (debug_record[kInstValidationOutError] == kInstErrorBuffOOBUniform)
@@ -1046,11 +1049,13 @@ bool GenerateValidationMessage(const uint32_t *debug_record, std::string &msg, s
10461049
case kInstErrorBuffOOBStorageTexel: {
10471050
auto size = debug_record[kInstBindlessBuffOOBOutBuffSize];
10481051
if (size == 0) {
1049-
strm << "Descriptor index " << debug_record[kInstBindlessBuffOOBOutDescIndex] << " is uninitialized.";
1052+
strm << "(set = " << debug_record[kInstBindlessBuffOOBOutDescSet] << ", binding = " << debug_record[kInstBindlessBuffOOBOutDescBinding]
1053+
<< ") Descriptor index " << debug_record[kInstBindlessBuffOOBOutDescIndex] << " is uninitialized.";
10501054
vuid_msg = "UNASSIGNED-Descriptor uninitialized";
10511055
} else {
10521056
oob_access = true;
1053-
strm << "Descriptor index " << debug_record[kInstBindlessBuffOOBOutDescIndex]
1057+
strm << "(set = " << debug_record[kInstBindlessBuffOOBOutDescSet] << ", binding = " << debug_record[kInstBindlessBuffOOBOutDescBinding]
1058+
<< ") Descriptor index " << debug_record[kInstBindlessBuffOOBOutDescIndex]
10541059
<< " access out of bounds. Descriptor size is " << debug_record[kInstBindlessBuffOOBOutBuffSize]
10551060
<< " texels and highest texel accessed was " << debug_record[kInstBindlessBuffOOBOutBuffOff];
10561061
if (debug_record[kInstValidationOutError] == kInstErrorBuffOOBUniformTexel)

scripts/known_good.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"-DSPIRV-Headers_SOURCE_DIR={repo_dir}/../SPIRV-Headers",
3838
"-DSPIRV_WERROR=OFF"
3939
],
40-
"commit": "d4c0abdcad60325a2ab3c00a81847e2dbdc927a2"
40+
"commit": "0ce36ad7856e15b545bc7b9fc9a7c49671b40f96"
4141
},
4242
{
4343
"name": "robin-hood-hashing",

tests/negative/gpu_av.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,9 @@ TEST_F(VkGpuAssistedLayerTest, GpuValidationArrayOOBGraphicsShaders) {
355355

356356
std::vector<TestCase> tests;
357357
tests.push_back({vsSource_vert, fsSource_vert, nullptr, nullptr, nullptr, false, &pipeline_layout, &descriptor_set, 25,
358-
"Index of 25 used to index descriptor array of length 6."});
358+
"(set = 0, binding = 1) Index of 25 used to index descriptor array of length 6."});
359359
tests.push_back({vsSource_frag, fsSource_frag, nullptr, nullptr, nullptr, false, &pipeline_layout, &descriptor_set, 25,
360-
"Index of 25 used to index descriptor array of length 6."});
360+
"(set = 0, binding = 1) Index of 25 used to index descriptor array of length 6."});
361361
#if !defined(VK_USE_PLATFORM_ANDROID_KHR)
362362
// The Android test framework uses shaderc for online compilations. Even when configured to compile with debug info,
363363
// shaderc seems to drop the OpLine instructions from the shader binary. This causes the following two tests to fail
@@ -369,18 +369,18 @@ TEST_F(VkGpuAssistedLayerTest, GpuValidationArrayOOBGraphicsShaders) {
369369
#endif
370370
if (descriptor_indexing) {
371371
tests.push_back({vsSource_frag, fsSource_frag_runtime, nullptr, nullptr, nullptr, false, &pipeline_layout, &descriptor_set,
372-
25, "Index of 25 used to index descriptor array of length 6."});
372+
25, "(set = 0, binding = 1) Index of 25 used to index descriptor array of length 6."});
373373
tests.push_back({vsSource_frag, fsSource_frag_runtime, nullptr, nullptr, nullptr, false, &pipeline_layout, &descriptor_set,
374-
5, "Descriptor index 5 is uninitialized"});
374+
5, "(set = 0, binding = 1) Descriptor index 5 is uninitialized"});
375375
// Pick 6 below because it is less than the maximum specified, but more than the actual specified
376376
tests.push_back({vsSource_frag, fsSource_frag_runtime, nullptr, nullptr, nullptr, false, &pipeline_layout_variable,
377-
&descriptor_set_variable, 6, "Index of 6 used to index descriptor array of length 6."});
377+
&descriptor_set_variable, 6, "(set = 0, binding = 1) Index of 6 used to index descriptor array of length 6."});
378378
tests.push_back({vsSource_frag, fsSource_frag_runtime, nullptr, nullptr, nullptr, false, &pipeline_layout_variable,
379-
&descriptor_set_variable, 5, "Descriptor index 5 is uninitialized"});
379+
&descriptor_set_variable, 5, "(set = 0, binding = 1) Descriptor index 5 is uninitialized"});
380380
tests.push_back({vsSource_frag, fsSource_buffer, nullptr, nullptr, nullptr, false, &pipeline_layout_buffer,
381-
&descriptor_set_buffer, 25, "Index of 25 used to index descriptor array of length 6."});
381+
&descriptor_set_buffer, 25, "(set = 0, binding = 1) Index of 25 used to index descriptor array of length 6."});
382382
tests.push_back({vsSource_frag, fsSource_buffer, nullptr, nullptr, nullptr, false, &pipeline_layout_buffer,
383-
&descriptor_set_buffer, 5, "Descriptor index 5 is uninitialized"});
383+
&descriptor_set_buffer, 5, "(set = 0, binding = 1) Descriptor index 5 is uninitialized"});
384384
if (m_device->phy().features().geometryShader) {
385385
// OOB Geometry
386386
tests.push_back({vsSourceForGS, bindStateFragShaderText, gsSource, nullptr, nullptr, false,

0 commit comments

Comments
 (0)