Skip to content

tests: Make descriptor heap and CoopMat2 tests portable - #13217

Merged
spencer-lunarg merged 1 commit into
KhronosGroup:mainfrom
apollo-2006:vl-test-portability
Sep 24, 2026
Merged

spencer-lunarg merged 1 commit into
KhronosGroup:mainfrom
apollo-2006:vl-test-portability

Conversation

@apollo-2006

@apollo-2006 apollo-2006 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Here are the remaining test fixes from running the suite on lavapipe, squashed into one commit like you suggested (the first was #13209). The UntypedPointersOffsetIdNonArray change is left out while the spec question is settled. None of these are big: each test either leaned on one implementation's limits or had a small bug that another driver happened to hide. Thanks for being open to these.

  • NegativeDebugPrintf.CoopMat2* (4 tests): these use 16x16 float16 subgroup matrices without checking for them first. lavapipe only lists 8x8 in VkCooperativeMatrixPropertiesKHR, so pipeline creation reports VUID-RuntimeSpirv-OpTypeCooperativeMatrixKHR-10163. It does support cooperativeMatrixFlexibleDimensions, which covers 16x16, so the tests now enable that when it's available and skip when neither covers the matrix. While I was there, CoopMat2PerElementOp was printing once per subgroup (4 times with lavapipe's subgroup size of 8), so it now uses a shared flag the same way CoopMat2Reduce does.
  • NegativeDescriptorHeapEXT.NotEnabled: imageCaptureReplayOpaqueDataSize is 0 on lavapipe, which doesn't support descriptorHeapCaptureReplay. The test then passed a zero-size VkHostAddressRangeEXT and picked up VUID-VkHostAddressRangeEXT-size-arraylength on top of the two errors it expects. Since size-11283 wants the size to equal the property, I couldn't find a valid range to pass there, so that part now only runs when the size is non-zero (RADV reports 8 and still runs it). Happy to handle it differently if you'd prefer.
  • NegativeDescriptorHeapUntypedEXT.GlslStructuredBadSize: descriptor_size = 4 put buf_b inside buf_a, so with a bufferDescriptorAlignment of 4 (lavapipe and RADV) spirv-val reported the overlap as 06849 instead of 11478. Both members are now sized bufferDescriptorSize + 2: since the size is a power of two no smaller than the alignment, buf_b never overlaps buf_a but is misaligned whenever the alignment is above 2, and the test skips below that. It now reports only 11478 on lavapipe, RADV and the mock ICD, and across a sweep of profile sizes and alignments from 4/4 to 256/256.
  • NegativeGpuDump.DescriptorHeapWrongDescriptorDebugNames: the UBO descriptor was written at offset bufferDescriptorSize, right after the sampler. With lavapipe's samplerDescriptorSize of 32 and bufferDescriptorSize of 16, it overwrote the second half of the sampler, and the dump showed "NO DESCRIPTOR" instead of [My Sampler]. The UBO now goes after both sizes, aligned with DescriptorHeapEXT::AlignResource.

Tested:

before after
lavapipe (Mesa main 516c078) 7 fail all pass
RADV (RX 9070 XT) GlslStructuredBadSize fails all pass or skip as before
mock ICD + max_profile.json full suite, no failures

@ci-tester-lunarg

Copy link
Copy Markdown
Collaborator

Author apollo-2006 not on autobuild list. Waiting for curator authorization before starting CI build.

@apollo-2006
apollo-2006 requested a review from a team as a code owner September 24, 2026 16:48
%5 = OpLabel

%heap_index_0 = OpUntypedAccessChainKHR %_ptr_UniformConstant %heap_layout %resource_heap
%heap_index_0 = OpUntypedAccessChainKHR %_ptr_UniformConstant %heap_layout %resource_heap %int_0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the link. I agree the original is valid SPIR-V. I think it just points somewhere different here: the guide's example has member 0 at Offset 0, but in these tests member 0 of %heap_layout is OffsetIdEXT %buf_size2. So as I read it, dropping the index gives a pointer to the start of the struct (heap offset 0) rather than to member 0 at buf_size * 2, where buffer_0's descriptor is written.

I checked by having the positive test read the buffers back:

RADV lavapipe
with %int_0 buffer_0 = 42, buffer_1 = 43 buffer_0 = 42, buffer_1 = 43
without buffer_0 = 0, buffer_1 = 43 segfault

If I've got the OffsetIdEXT semantics wrong, then both drivers would have the same bug and I'm happy to file it on Mesa instead.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a spec question, https://gitlab.khronos.org/spirv/SPIR-V/-/work_items/965

to help speed up getting this in, just revert these two, I will handle them after

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted both, thanks for taking these on. Curious to see how the spec question lands.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RETURN_IF_SKIP(InitUntypedDescriptorHeap());
if (heap_props.bufferDescriptorSize <= 4) {
GTEST_SKIP() << "bufferDescriptorSize too small";
// buf_b ends up at offset 4, which must not be a multiple of bufferDescriptorAlignment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... the test is testing for 11478 which is this? not sure why this needed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should have explained this one in the description. The check itself is the same, it's only the skip that changed. As I understand 11478, it fires when buf_b's offset of 4 isn't a multiple of bufferDescriptorAlignment, but the old skip was looking at bufferDescriptorSize. RADV and lavapipe both report an alignment of 4, so offset 4 ends up aligned and 11478 can't fire there. spirv-val catches the overlap as 06849 instead ("Structure member 1 at offset 4 overlaps previous member ending at offset 15"), and the test fails. With the skip checking alignment, it skips on those drivers and still runs with max_profile.json. If you'd prefer it to keep running on every driver, I'm happy to rework it that way instead.

@spencer-lunarg spencer-lunarg Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its non of this, its more subtle (or maybe just what you said)

VUID-RuntimeSpirv-bufferDescriptorAlignment-11478 can be caught inside spirv-val now but passing in

--buffer-descriptor-layout 64:64

but for lavapipe, it is hitting it a different error

Structure member 1 at offset 4 overlaps previous member ending at offset 15. Instantiated via '21[%21]' in the UniformConstant storage class using standard layout rules.

just revert this one, I'll take this one, I can just rewrite the test to be smarter

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unless you can re-write the test to hit it the same error on both

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing me at the real cause, that made it much easier. I gave the rewrite a shot: both members are now sized bufferDescriptorSize + 2, so buf_b sits just past buf_a without overlapping it, but is still misaligned. Since the spec keeps the size a power of two no smaller than the alignment, that holds on any driver with an alignment above 2. It now hits 11478 and nothing else on lavapipe, RADV and the mock ICD with max_profile.json.

Comment thread tests/unit/gpu_dump.cpp Outdated

// The UBO goes after the sampler, which can be bigger than a buffer descriptor
const uint32_t ubo_offset = static_cast<uint32_t>(
Align(std::max(heap_props.samplerDescriptorSize, heap_props.bufferDescriptorSize), heap_props.bufferDescriptorAlignment));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the align helpers in vkt::DescriptorHeapEXT, dont want yet-another one

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, switched it to desc_heap.AlignResource().

@ci-tester-lunarg

Copy link
Copy Markdown
Collaborator

Author apollo-2006 not on autobuild list. Waiting for curator authorization before starting CI build.

@ci-tester-lunarg

Copy link
Copy Markdown
Collaborator

Author apollo-2006 not on autobuild list. Waiting for curator authorization before starting CI build.

@ci-tester-lunarg

Copy link
Copy Markdown
Collaborator

Author apollo-2006 not on autobuild list. Waiting for curator authorization before starting CI build.

Found running the suite on lavapipe; each relied on one implementation's
limits or had a bug that other drivers hid.

CoopMat2 DebugPrintf tests: they used 16x16 float16 matrices without
checking for them. Enable cooperativeMatrixFlexibleDimensions when
available and skip when neither covers the matrix. CoopMat2PerElementOp
also printed once per subgroup; guard it like CoopMat2Reduce.

NegativeDescriptorHeapEXT.NotEnabled: imageCaptureReplayOpaqueDataSize
can be 0, and then no valid range can be passed. Only run that part when
it is non-zero.

GlslStructuredBadSize: descriptor_size = 4 put buf_b inside buf_a, so
with a bufferDescriptorAlignment of 4 the overlap (06849) was reported
instead of 11478. Size both members bufferDescriptorSize + 2, so buf_b
does not overlap but is misaligned whenever the alignment is above 2.

DescriptorHeapWrongDescriptorDebugNames: the UBO descriptor overlapped the
sampler when samplerDescriptorSize > bufferDescriptorSize. Place it after
both, aligned with DescriptorHeapEXT::AlignResource.
@ci-tester-lunarg

Copy link
Copy Markdown
Collaborator

Author apollo-2006 not on autobuild list. Waiting for curator authorization before starting CI build.

@ci-tester-lunarg

Copy link
Copy Markdown
Collaborator

CI Vulkan-ValidationLayers build queued with queue ID 132047.

@ci-tester-lunarg

Copy link
Copy Markdown
Collaborator

CI Vulkan-ValidationLayers build # 24641 running.

@ci-tester-lunarg

Copy link
Copy Markdown
Collaborator

CI Vulkan-ValidationLayers build # 24641 passed.

@spencer-lunarg
spencer-lunarg merged commit 05bc3b2 into KhronosGroup:main Sep 24, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants