Repository navigation
tests: Make descriptor heap and CoopMat2 tests portable - #13217
Conversation
|
Author apollo-2006 not on autobuild list. Waiting for curator authorization before starting CI build. |
| %5 = OpLabel | ||
|
|
||
| %heap_index_0 = OpUntypedAccessChainKHR %_ptr_UniformConstant %heap_layout %resource_heap | ||
| %heap_index_0 = OpUntypedAccessChainKHR %_ptr_UniformConstant %heap_layout %resource_heap %int_0 |
There was a problem hiding this comment.
this is not needed https://github.com/KhronosGroup/SPIRV-Guide/blob/main/chapters/untyped_pointers.md#indexing-at-zero
remove these, this is valid SPIR-V
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Reverted both, thanks for taking these on. Curious to see how the spec question lands.
| 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 |
There was a problem hiding this comment.
... the test is testing for 11478 which is this? not sure why this needed
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
unless you can re-write the test to hit it the same error on both
There was a problem hiding this comment.
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.
|
|
||
| // 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)); |
There was a problem hiding this comment.
use the align helpers in vkt::DescriptorHeapEXT, dont want yet-another one
There was a problem hiding this comment.
Good call, switched it to desc_heap.AlignResource().
810e54b to
151820c
Compare
|
Author apollo-2006 not on autobuild list. Waiting for curator authorization before starting CI build. |
151820c to
fe9dcb3
Compare
|
Author apollo-2006 not on autobuild list. Waiting for curator authorization before starting CI build. |
fe9dcb3 to
7e8bbf1
Compare
|
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.
7e8bbf1 to
abb77c7
Compare
|
Author apollo-2006 not on autobuild list. Waiting for curator authorization before starting CI build. |
|
CI Vulkan-ValidationLayers build queued with queue ID 132047. |
|
CI Vulkan-ValidationLayers build # 24641 running. |
|
CI Vulkan-ValidationLayers build # 24641 passed. |
Here are the remaining test fixes from running the suite on lavapipe, squashed into one commit like you suggested (the first was #13209). The
UntypedPointersOffsetIdNonArraychange 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 inVkCooperativeMatrixPropertiesKHR, so pipeline creation reportsVUID-RuntimeSpirv-OpTypeCooperativeMatrixKHR-10163. It does supportcooperativeMatrixFlexibleDimensions, which covers 16x16, so the tests now enable that when it's available and skip when neither covers the matrix. While I was there,CoopMat2PerElementOpwas printing once per subgroup (4 times with lavapipe's subgroup size of 8), so it now uses a shared flag the same wayCoopMat2Reducedoes.NegativeDescriptorHeapEXT.NotEnabled:imageCaptureReplayOpaqueDataSizeis 0 on lavapipe, which doesn't supportdescriptorHeapCaptureReplay. The test then passed a zero-sizeVkHostAddressRangeEXTand picked upVUID-VkHostAddressRangeEXT-size-arraylengthon 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 = 4putbuf_binsidebuf_a, so with abufferDescriptorAlignmentof 4 (lavapipe and RADV) spirv-val reported the overlap as 06849 instead of 11478. Both members are now sizedbufferDescriptorSize + 2: since the size is a power of two no smaller than the alignment,buf_bnever overlapsbuf_abut 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 offsetbufferDescriptorSize, right after the sampler. With lavapipe'ssamplerDescriptorSizeof 32 andbufferDescriptorSizeof 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 withDescriptorHeapEXT::AlignResource.Tested:
GlslStructuredBadSizefails