vkback: the one-mutable-binding descriptor-heap probe; learning (issue #57) #80

Manually merged
github merged 2 commits from github-bot/gh-80 into gh-pr/80/base 2026-12-01 12:16:44 +00:00 AGit
Owner

@⁠NotBalkanus on GitHub · 2026-12-01 11:58 UTC · original
NotBalkanus:descriptor-heap-probe → main · +903 −0 · 4 files · 2 commits · merged 2026-12-01 12:12 UTC

What

An evidence pull request for the direction decision on #57 ("Descriptor heap as one array"), as asked (comment #57). It commits to no direction:

  • greenfield/vkback/src/bin/vk-mutprobe.rs — a self-contained offline probe of the one-VK_DESCRIPTOR_TYPE_MUTABLE_EXT-binding descriptor heap. It builds its own device (mutable feature enabled), makes one-binding candidate layouts beside today's layout::make, allocates the real full-size buffer, and dispatches a test shader (assembled with spirv-as from the SPIR-V text in the file) that reads and writes one slot through every access kind. Catalogued in docs/tools.md (rule 21).
  • docs/learnings/descriptor-heap-array.md — the findings, indexed in the learnings README.

No other code changes: the translator and the write path are untouched, and the two-family backend half I had locally is kept out of this PR, in my branch, until the decision.

What the probe answered (reference card: RX 9070 XT / RADV GFX1201, Mesa 26.3.1)

ext mutable_descriptor_type: true        ext descriptor_heap: false
descriptor sizes: sampled 32 storage_image 32 uniform_texel 16 storage_texel 16
                  uniform_buffer 16 storage_buffer 16 offset_align 4
today's seven typed bindings (heap_slots 1245184): set 0 layout 235 MiB,
    per-stage descriptors 12910592
one mutable binding [six], count 3342336: layout 102 MiB, per-slot 32 bytes,
    per-stage descriptors 3344393
  allocate device-local: OK (102 MiB)     allocate BAR-mapped: OK (102 MiB)
--- payload matrix: all cells true within each family ---
image:     one descriptor serves sampled fetch, storage read AND store
buffer:    one descriptor serves uniform-texel fetch, storage-texel read,
           raw SSBO load AND store, and UBO
null slots: all forms read zero through every kind, no fault

The two facts the decision needs beyond the pipeline-level aliasing proof in the task:

  1. One mutable slot holds ONE descriptor, at the slot start. The ACO assembly shows every access kind loading the whole 32-byte slot (s_load_b256 at binding_offset + index * 32) and running on those bytes — no per-type sub-offsets — and vkGetDescriptorEXT for MUTABLE_EXT does not compose a slot (a 6-byte header only).
  2. A descriptor read through the other family's op faults the GPU (GPUVM fault twice; a half-written slot faults too). On the console a cross-read reads garbage; on RADV it is a device loss. That is what a strict one array (slot i holding one descriptor for image AND buffer kinds) would run into, and why per-family nulls matter in any port.

Under VK_LAYER_KHRONOS_validation the whole usage (six shader variables sharing one mutable binding, the dispatches, the writes and nulls) reports no VUIDs on RADV.

Verification

  • The probe runs clean (cargo run -p vkback --bin vk-mutprobe, seconds; needs spirv-as on PATH; --asm <file> writes the test shader's ACO assembly), output above from the reference card.
  • No game run and no direction: the PR changes no translated shader, no Vulkan call of a run, and no layout the game builds — so no validation run is needed (rule 30); the probe's own usage was run under the validation layer and is clean.
  • cargo build -p vkback, cargo test -p vkback (150 lib tests + policy 6/6), cargo clippy -p vkback clean for the added file (the 233 warnings cargo clippy --workspace shows on this branch are pre-existing on main: the same count on a pristine origin/main checkout, none in the touched files).

Notes

  • The slot payload layout is the driver's own: re-probe after a Mesa bump (the tool re-answers in seconds).
  • Open before any port: 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 (named in the learning).
  • The backend half of a two-family shape is measured in my local branch (per-stage 4,589,577, set 0 89 MiB, write path 9 positions to 3) and is held until the maintainer's direction call.
**@⁠NotBalkanus** on GitHub · 2026-12-01 11:58 UTC · [original](https://github.com/vktory6/VKtory/pull/80) `NotBalkanus:descriptor-heap-probe` → `main` · +903 −0 · 4 files · 2 commits · merged 2026-12-01 12:12 UTC ## What An evidence pull request for the direction decision on #57 ("Descriptor heap as one array"), as asked (comment https://git.gtahub.st/github/vktory6--VKtory/issues/57). It commits to no direction: - `greenfield/vkback/src/bin/vk-mutprobe.rs` — a self-contained offline probe of the one-`VK_DESCRIPTOR_TYPE_MUTABLE_EXT`-binding descriptor heap. It builds its own device (mutable feature enabled), makes one-binding candidate layouts beside today's `layout::make`, allocates the real full-size buffer, and dispatches a test shader (assembled with `spirv-as` from the SPIR-V text in the file) that reads and writes one slot through every access kind. Catalogued in `docs/tools.md` (rule 21). - `docs/learnings/descriptor-heap-array.md` — the findings, indexed in the learnings README. No other code changes: the translator and the write path are untouched, and the two-family backend half I had locally is kept out of this PR, in my branch, until the decision. ## What the probe answered (reference card: RX 9070 XT / RADV GFX1201, Mesa 26.3.1) ``` ext mutable_descriptor_type: true ext descriptor_heap: false descriptor sizes: sampled 32 storage_image 32 uniform_texel 16 storage_texel 16 uniform_buffer 16 storage_buffer 16 offset_align 4 today's seven typed bindings (heap_slots 1245184): set 0 layout 235 MiB, per-stage descriptors 12910592 one mutable binding [six], count 3342336: layout 102 MiB, per-slot 32 bytes, per-stage descriptors 3344393 allocate device-local: OK (102 MiB) allocate BAR-mapped: OK (102 MiB) --- payload matrix: all cells true within each family --- image: one descriptor serves sampled fetch, storage read AND store buffer: one descriptor serves uniform-texel fetch, storage-texel read, raw SSBO load AND store, and UBO null slots: all forms read zero through every kind, no fault ``` The two facts the decision needs beyond the pipeline-level aliasing proof in the task: 1. **One mutable slot holds ONE descriptor, at the slot start.** The ACO assembly shows every access kind loading the whole 32-byte slot (`s_load_b256` at `binding_offset + index * 32`) and running on those bytes — no per-type sub-offsets — and `vkGetDescriptorEXT` for `MUTABLE_EXT` does not compose a slot (a 6-byte header only). 2. **A descriptor read through the other family's op faults the GPU** (GPUVM fault twice; a half-written slot faults too). On the console a cross-read reads garbage; on RADV it is a device loss. That is what a strict one array (slot i holding one descriptor for image AND buffer kinds) would run into, and why per-family nulls matter in any port. Under `VK_LAYER_KHRONOS_validation` the whole usage (six shader variables sharing one mutable binding, the dispatches, the writes and nulls) reports no VUIDs on RADV. ## Verification - The probe runs clean (`cargo run -p vkback --bin vk-mutprobe`, seconds; needs `spirv-as` on PATH; `--asm <file>` writes the test shader's ACO assembly), output above from the reference card. - No game run and no direction: the PR changes no translated shader, no Vulkan call of a run, and no layout the game builds — so no validation run is needed (rule 30); the probe's own usage was run under the validation layer and is clean. - `cargo build -p vkback`, `cargo test -p vkback` (150 lib tests + policy 6/6), `cargo clippy -p vkback` clean for the added file (the 233 warnings `cargo clippy --workspace` shows on this branch are pre-existing on main: the same count on a pristine `origin/main` checkout, none in the touched files). ## Notes - The slot payload layout is the driver's own: re-probe after a Mesa bump (the tool re-answers in seconds). - Open before any port: 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 (named in the learning). - The backend half of a two-family shape is measured in my local branch (per-stage 4,589,577, set 0 89 MiB, write path 9 positions to 3) and is held until the maintainer's direction call.
vk-mutprobe (greenfield/vkback/src/bin/vk-mutprobe.rs) answers offline what a
one-VK_DESCRIPTOR_TYPE_MUTABLE_EXT-binding set 0 needs, for the direction
decision on issue #57 (the maintainer holds it). On the reference card
(RX 9070 XT, RADV GFX1201, Mesa 26.3.1): the extension and feature are offered
(VK_EXT_descriptor_heap is not); today's seven typed bindings measure 235 MiB
of set-0 layout and 12,910,592 per-stage descriptors, one mutable binding with
the six allowed types 102 MiB and 3,344,393 (per-slot 32 B, the largest of the
types), and the full 3,342,336-slot buffer allocates device local and
BAR-mapped. By dispatching a test shader: one mutable slot holds ONE descriptor
at the slot start (the ACO assembly shows every access kind loading the whole
slot; no per-type sub-offsets); the payload matrix is all-true within each
family (one image descriptor serves sampled fetch, storage read and write; one
buffer descriptor serves texel fetch, structured and raw loads and stores, and
UBO); a descriptor read through the other family's op faults the GPU
(GPUVM fault twice) where the console reads garbage; vkGetDescriptorEXT for
MUTABLE_EXT writes a 6-byte header only; the run's own null forms read zero
through every kind; the whole usage passes the Khronos validation layer with no
VUIDs on RADV.

The probe assembles its test shader with spirv-as (PATH; --asm writes the ACO
assembly out) and keeps exactly one valid descriptor per slot: cross-family
reads and half-written slots fault, so it dispatches same-family reads only.
Kept and catalogued in docs/tools.md (rule 21); the findings are written up in
docs/learnings/descriptor-heap-array.md. No game run; nothing here commits to
a direction.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 12:00:51 +00:00
github-bot changed target branch from main to gh-pr/80/base 2026-12-01 12:16:43 +00:00
github manually merged commit 6e09d404fc into gh-pr/80/base 2026-12-01 12:16:44 +00:00
Author
Owner

@⁠vktory6 on GitHub · 2026-12-01 12:16 UTC · original

Merged, thanks! It commits to no direction, as intended: the probe and the learning are now in the tree for the decision on #57.

Before it ran anywhere, I read what it executes (temporary SPIR-V files, spirv-as, an optional --asm output; the faulting cross-family case isn't run). I pushed one commit (6e09d40): // SAFETY: comments on its two unsafe blocks and the two mapped slices, which the new rule 36 asks for. The reasoning holds because Dev::one_shot waits for the queue before results are read. The check and clippy pass on main.

**@⁠vktory6** on GitHub · 2026-12-01 12:16 UTC · [original](https://github.com/vktory6/VKtory/pull/80#issuecomment-7310899779) Merged, thanks! It commits to no direction, as intended: the probe and the learning are now in the tree for the decision on #57. Before it ran anywhere, I read what it executes (temporary SPIR-V files, `spirv-as`, an optional `--asm` output; the faulting cross-family case isn't run). I pushed one commit (6e09d40): `// SAFETY:` comments on its two `unsafe` blocks and the two mapped slices, which the new rule 36 asks for. The reasoning holds because `Dev::one_shot` waits for the queue before results are read. The check and clippy pass on main.
This discussion has been locked. Commenting is limited to contributors.
No description provided.