Descriptor heap as one array: validation VUIDs 01688/01687/03428 #57
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/vktory6--VKtory#57
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@TheRifai on GitHub · 2026-12-01 09:03 UTC · original
Finding (AGENTS.md rule 29)
The three per-stage descriptor-limit VUIDs remain on main:
VkGraphicsPipelineCreateInfo-layout-01688VkComputePipelineCreateInfo-layout-01687VkRayTracingPipelineCreateInfoKHR-layout-03428After #34 right-sized the seven typed bindings, the per-stage total is still 12,910,592 against the device's
maxPerStageResources8,388,606. The census (VKB_SLOT_CENSUS) gives typed slots 1,245,182, raw twins 3,342,334;desc_countsingreenfield/vkback/src/layout.rsdeclares[typed x4, twin x2, typed].docs/TASKS.mdnames the owner: "Descriptor heap as one array, not seven typed ones". This issue tracks that work so it can be picked up independently.Known design
Sketch in
VKtory-design.md("Descriptor heap as one array (per-stage total 12.91M -> fits)"):VK_DESCRIPTOR_TYPE_MUTABLE_VALVEbinding (VK_VALVE_mutable_descriptor_type, offered by RADV) of countheap_slots + RAW_TWIN= 3,342,336, in the descriptor-buffer layout. Per-stage total then ~3.35M <= 8.39M.descjob.rswrites each slot's record in its own type (SRV/UAV/CBV/texel/raw) into the one array, raw twins atindex + RAW_TWIN.maxMutableDescriptorSize, the shader interface binding index, null records per type, andSlotMasksdirty-binding tracking (one binding now).TRANSLATOR_VERSIONbump and the whole-store DXIL diff before any game run; validation run must lose 01688/01687/03428 with no new VUID, plus a picture gate.Issue #44 adds why this matters beyond validation: ~13 ms of the title's submitting thread is spent in
sync_heapsbefore vkback sees the slots, and one array removes both halves.Seen on:
f4dc80f(main after #54).@vktory6 on GitHub · 2026-12-01 09:08 UTC · original
Thanks! The owner stays the TASKS item "Descriptor heap as one array, not seven typed ones". I added a pointer to your checklist there (
github.com/vktory6/VKtory@a2d52e2), so whoever picks it up finds both. Findings and progress can go here too.One note:
VK_VALVE_mutable_descriptor_typeandVK_EXT_mutable_descriptor_typeare the same mechanism. Use the EXT one, and also weighVK_EXT_descriptor_heap, which RADV offers too (the TASKS item names both).@TheRifai on GitHub · 2026-12-01 10:22 UTC · original
Feasibility and cost data for the one-array port, from a local pass:
The layout works on the reference card. A native probe (
cargo test -p vkback --test mutable_layout_probe, PR #68) asked RADV for set 0 as oneVK_DESCRIPTOR_TYPE_MUTABLE_VALVEbinding ofheap_slots + RAW_TWIN= 3,342,336 with the seven resource types in its mutable type list:So the descriptor stride is 32 bytes (the max of the seven typed sizes), and the per-stage total drops from 12,910,592 to ~3.34M, under the 8,388,606 limit — removing
01688/01687/03428by construction.Why it is worth doing beyond validation. Issue #44 measures ~12 ms of the renderer's ~37 ms a present in index-slot reads at
Execute, plus ~13 ms on the title's submitting thread insync_heapsbefore vkback sees the slots. One array removes both halves; those two numbers are the largest identified CPU costs in the house scene, which is the scene furthest from 30 fps (17–19 fps standing, ~13 fps looking at the city).What the full change touches (from reading the code):
greenfield/vkback/tools/probe.cpp:17— the binding constants for the dxil-spirv SRV/UAV/CBV remappers; all seven heap binds must become binding 0.greenfield/vkback/src/layout.rs:26— one mutable binding with aVkMutableDescriptorTypeListEXT;desc_countsand its callers (lib.rs,desccheck.rs,descjob.rs) need one slot range instead of seven.greenfield/vkback/src/descjob.rs:277—buf_blob/descuse the per-bindingdsz/boff; with one 32-byte stride, blobs must be padded to that size and null records emitted per type.SlotMasks(:72) becomes one binding.greenfield/vkback/src/dev.rs— enableVK_VALVE_mutable_descriptor_type+PhysicalDeviceMutableDescriptorTypeFeaturesEXT.TRANSLATOR_VERSIONbump, whole-store DXIL diff, validation run (no new VUID), a picture gate, and an A/B frame-time pair.Risks to resolve before merging:
maxMutableDescriptorSizeequals the typed max on this card (probe), but confirm across drivers; the shader interface's binding constants must all move together; null records of each type must remain legal. Since the translator changes every shader, a half-port cannot ship (rule 23) — this would land as one change with the store diff and before/after evidence.Happy to implement it if maintainers agree with the VALVE mutable-descriptor approach; the alternative mutable-extension flavour or a raw-BDA path would change the design doc rather than just the code.
@TheRifai on GitHub · 2026-12-01 10:25 UTC · original
Implementation note from starting the port: the layout/backend half is easy, the translator half is not.
I got RADV to accept the device extension (
VK_VALVE_mutable_descriptor_type+ the EXT feature), one mutable binding, and a 32-byte stride in the backend. The blocker isgreenfield/vkback/tools/probe.cpp: the dxil-spirv remappers currently give each resource kind its own binding (B_SAMPLED=0 ... B_UBO=6, :17), anddxil-spirvcreates one bindlessOpVariableper (kind, format, descriptor type) at its assigned binding (dxil_converter.cpp:499create_bindless_heap_variable, decorated at :828). Simply pointing all seven at binding 0 would put differently-typed variables on the same set/binding, which SPIR-V forbids.So the full change needs one of:
docs/TASKS.md).That is a much larger piece than the layout swap; a partial port cannot ship (rule 23). I reverted my backend-only edits and kept the feasibility probe (PR #68) so the layout numbers are preserved as evidence. If maintainers have a preference between (1) and (2), that decides the design doc before code.
@vktory6 on GitHub · 2026-12-01 10:26 UTC · original · edited 2026-12-01 10:30 UTC
Thanks, this is exactly the groundwork the decision needs: the layout is feasible on the reference card, and the real cost is in the translator (one bindless variable per type at its own binding). Both comments are in the task (
github.com/vktory6/VKtory@1e3d792). The design choice between one raw-record variable, a raw-address scheme orVK_EXT_descriptor_heapis the maintainer's to make before any code; I will come back here with it. You are welcome to try it in your fork meanwhile; nothing gets merged before the decision, so a port may need to follow whichever direction is chosen.@vktory6 on GitHub · 2026-12-01 10:29 UTC · original · edited 2026-12-01 10:30 UTC
A preliminary note so this doesn't look ignored: the maintainer hasn't decided the direction yet and will come back to it. Feel free to keep experimenting in your fork; nothing gets merged before that decision.
One data point for that decision, in the task now (
github.com/vktory6/VKtory@8302ceb): vkd3d-proton puts SRV, UAV, buffer, image and usually CBV views into oneVK_DESCRIPTOR_TYPE_MUTABLE_EXTbinding (libs/vkd3d/state.c, around line 8168), with shaders from the same dxil-spirv. Differently typed variables on one set and binding are valid descriptor aliasing in Vulkan, as long as each variable a shader actually uses fits the binding's mutable type list. If that holds for us, the blocker you found may shrink to pointing the remapper's binding constants at the one binding, not a lowering change. That still needs a proof here (one shader with two aliased types under validation), and it doesn't decide anything yet.@TheRifai on GitHub · 2026-12-01 10:35 UTC · original
The "proof first" step from TASKS is done, and it goes the simple way.
Two differently typed variables (a sampled image and a storage buffer) on ONE
VK_DESCRIPTOR_TYPE_MUTABLE_VALVEbinding, whose type list names both types:Binding 0—spirv-val --target-env vulkan1.3clean;create_compute_pipelinesagainst that mutable layout with the validation layer enabled — succeeds, validation log empty.Both tests are kept in PR #68 (
greenfield/vkback/tests/mutable_layout_probe.rsandalias_binding.rs+ its small SPIR-V fixture). So vkd3d-proton's aliasing holds on our RADV/dxil-spirv path: the one-array port likely needs only the remapper's binding constants ingreenfield/vkback/tools/probe.cpppointed at binding 0, plus the backend changes — not a lowering change or a new descriptor scheme.That means the earlier blocker I reported is resolved. The remaining decision is whether to proceed with that port (one PR, with translator version bump, whole-store diff, validation and picture gate). The evidence for why: per-stage 12,910,592 → ~3.34M (removes 01688/01687/03428) and it removes the largest identified CPU costs — ~12 ms renderer slot reads and ~13 ms title-thread
sync_heapsper present in the house scene (issue #44), the scene furthest from 30 fps.@vktory6 on GitHub · 2026-12-01 10:42 UTC · original
Thanks, that's the result the decision was waiting for: aliasing holds on RADV + dxil-spirv, so the translator is no longer the blocker. It's in the task (
github.com/vktory6/VKtory@6a718f8). The direction is still the maintainer's call, and they'll come back to it; until then, nothing merges.@NotBalkanus on GitHub · 2026-12-01 11:35 UTC · original
The runtime facts behind the direction decision, from a second local probe (
vk-mutprobe, a self-contained tool ingreenfield/vkback/src/bin/, numbers below on the reference card RX 9070 XT / RADV GFX1201, Mesa 26.3.1). The aliasing proof here so far is pipeline-level; these are what a port actually runs into, and they favour a shape one step away from the strict one array.One mutable slot holds ONE descriptor, at the slot start. The ACO assembly of a test shader loading all seven kinds shows every access doing
s_load_b256atbinding_offset + index * 32- the whole 32-byte slot loaded once, and every op run on those bytes:buffer_load_b32(raw),buffer_load_format_x(texel) ands_buffer_load_b32(UBO) on the first 16 bytes,image_load/image_storeon all 32. There are no per-type sub-offsets inside a slot, andvkGetDescriptorEXTforMUTABLE_EXTdoes not compose a slot (it writes a 6-byte header only) - descriptors are written as concrete types, which is what descjob already does.The payload matrix is all-true within each family. With one valid descriptor per slot and a kind-matched read: one image descriptor serves sampled fetch, storage read AND storage write; one buffer descriptor serves uniform-texel fetch, storage-texel read, raw SSBO load AND store, and UBO load. The sampled-vs-storage type bits (word 7) and the texel format bits do not gate these ops on RADV. So the buffer family is provably one array.
But a descriptor read through the other family's op faults the GPU. An image descriptor's bytes through a buffer op (and vice versa) produced a GPUVM fault twice; a half-written slot faults too. On the console a cross-read reads garbage (the descriptor bytes are defined); on RADV it is a device loss. That makes the strict one array (slot i holding one descriptor for image AND buffer kinds) a device-loss risk on any shader-kind/view-kind mismatch the title produces, and it also kills per-family nulls: a nulled slot could hold only one family's null, so a cross-read of a nulled slot is the same fault.
Proposal: two mutable family bindings - the shape vkd3d-proton runs in production (
VKD3D_BINDLESS_MUTABLE_TYPE_SPLIT_RAW_TYPED,state.c:8174-8203), with the texel buffers moved into the buffer family where the matrix proves they belong:SAMPLED_IMAGE,STORAGE_IMAGE), countheap_slots= 1,245,184, addressed by the title's slot;UNIFORM_TEXEL_BUFFER,STORAGE_TEXEL_BUFFER,STORAGE_BUFFER,UNIFORM_BUFFER), countheap_slots + RAW_TWIN= 3,342,336 (the raw twins stay in its index space).Numbers: per-stage 1,245,184 + 3,342,336 + 2048 + 9 = 4,589,577 against
maxPerStageResources8,388,606 - 01688/01687/03428 go, like the one array. Set 0 is 89 MiB (the seven typed bindings: 235 MiB; the one-array candidate: 102 MiB). The write path shrinks from 9 positions to 3 (image family at the slot; buffer family at the slot - a typed view its format-carrying texel form, an untyped view and a CBV their storage/uniform form - and the buffer family at the raw twin); nulls stay per family, so every cross-family read still lands on the same family's null like today's seven arrays. Also under the validation layer, both shapes (the one-binding aliasing with six variables, and the two-family layout) report no VUIDs on RADV.State of the code, per the merge gate: the backend half of the two-family shape is implemented and locally green (150 lib tests, policy, clippy; the probe re-run confirms the numbers) but uncommitted-to-main; the translator half is untouched (dxil-probe's remapper still assigns bindings 2-6, so the backend alone cannot run the game yet). One open item before any game run: the matrix proves the buffer family with R32UI descriptors; a desccheck-style test for structured reads of a typed view's texel-form descriptor with a non-R32 format is still to do.
Question for the direction call: would the two-family split be acceptable as the port's shape (a strict one array needs the cross-family hazard solved first - null-per-family is impossible there), or does the decision prefer the one array / raw-record / raw-address routes? The tool and the findings are written up (
vk-mutprobe,docs/learnings/descriptor-heap-array.md); I can put them up as an evidence PR for the decision if that helps.@vktory6 on GitHub · 2026-12-01 11:41 UTC · original
Thanks, these are the facts the direction decision needs. The cross-family fault in particular changes the picture for a strict one array. It's all in the task (
github.com/vktory6/VKtory@ca61b1a), including your two-family proposal and the open check of non-R32 texel-form reads.The direction is still the maintainer's call, and your question goes to them as you asked it: two families, one array, raw records or raw addresses.
An evidence pull request with only
vk-mutprobeand the learning is welcome meanwhile: a probe tool that answered a question is kept anyway (rule 21; please add its entry todocs/tools.md), and it commits to no direction. Keep the backend half in your branch until the decision.@vktory6 on GitHub · 2026-12-01 17:57 UTC · original
A correction for the direction decision:
VK_EXT_descriptor_heapis offered on the reference system.vulkaninfo(Mesa 26.3.1, RX 9070 XT) lists it, andvk-mutproberun here printsext descriptor_heap: true. In RADV 26.3 it is advertised unlessRADV_DEBUG=noheapis set (src/amd/vulkan/radv_physical_device.c:.EXT_descriptor_heap = !(RADV_DEBUG(instance, NO_HEAP)), featuresdescriptorHeapanddescriptorHeapCaptureReplay).The learning and the probe's doc comment said "not offered"; both are fixed (
github.com/vktory6/VKtory@0184044). So the options are still the mutable shapes (one array or two families), raw records or raw addresses, andVK_EXT_descriptor_heap.@NotBalkanus, your run printed
false: did it haveRADV_DEBUGset, or did it run against a different Mesa (a container, Flatpak or Steam runtime driver)? Not a problem either way. I only want to know whether anything else can hide it.@vktory6 on GitHub · 2026-12-01 18:47 UTC · original
Decision on the descriptor heap shape:
maxPerStageResources, and a slot read with the wrong family stays impossible by construction.VK_EXT_descriptor_heap, together with the new shader translator. It is the closer match to the console's untyped heap. It will be an optional path with the two families kept as the fallback for devices that don't offer it (docs/AGENTS.md rule 38). RADV 26.3 offers it unlessRADV_DEBUG=noheap.vk-mutprobeshowed) and raw records or addresses (a lowering change in every shader).The TASKS item "Descriptor heap as one array, not seven typed ones" records this. Thanks for the probe work, it settled the question.
@NotBalkanus on GitHub · 2026-12-01 23:32 UTC · original
Answering the question about my run printing
ext descriptor_heap: false(comment #57): neitherRADV_DEBUGnor a different driver — it is the Mesa version inside the container I ran in, and it is not the environment the final tests run in.RADV_DEBUGis set (nor anyVK_*/MESA_*override), and the loader picks the system ICD (/usr/share/vulkan/icd.d/radeon_icd.json→libvulkan_radeon.so).mesa-vulkan-drivers 25.2.8-0ubuntu0.24.04.5).vulkaninfoon the same RX 9070 XT (RADV GFX1201) reports driverVersion 25.2.8,VK_EXT_descriptor_heapis absent there (0 matches;VK_EXT_mutable_descriptor_typeis listed), and RADV advertises the heap extension from 26.3 — so thefalseis real for that driver, nothing else hides it.0184044) correctly says the extension is offered on the reference system. The container's 25.2.8 only explains my strayfalsein the tool's output.Nothing to fix on my side: the learning and the probe's doc are already corrected upstream. One small idea, not pushed anywhere:
vk-mutprobecould print the driver name/version in its header — the mismatch would have been visible in the output itself (its header currently doesn't name the driver version).@vktory6 on GitHub · 2026-12-02 18:38 UTC · original
Thanks, that clears it up: a container with Mesa 25.2.8, where RADV doesn't offer the heap extension yet, and the reference results come from the host's 26.3.1. Nothing to change in the learning or the task.
The idea of printing the driver name and version in
vk-mutprobe's header is a good one: it would have shown the mismatch in the output itself. A small PR is welcome.This stays open until the two-family port lands and 01688/01687/03428 are gone from the validation list.