gpu, mesa: HW RT UAV barrier/memory_ready and NIR image_heap coherency #43

Closed
github-bot wants to merge 2 commits from github-bot/gh-43 into main AGit
Owner

@⁠auz466 on GitHub · 2026-11-30 20:46 UTC · original
auz466:fix-hw-rt-sync-and-nir-coherency → main · +58 −10 · 2 files · 2 commits · closed without merging

Summary

Two targeted fixes that do not overlap existing open PRs (such as #38, #31, #28):

  1. HW RT synchronization (crates/victory-gpu/src/draw.rs):

    • Run memory_ready() for shaders using USER_MEMORY_CARD even when they do not bind SLOT_MEMORY.
    • Emit a global UAV barrier (D3D12_RESOURCE_BARRIER_TYPE_UAV, pResource = None) before HW RT draws/dispatches that use USER_MEMORY_CARD, ensuring preceding BVH builder writes are flushed from GPU caches before image_bvh64_intersect_ray reads raw title addresses.
    • Reduces RTGI speckling/boiling and flickering geometry when VICTORY_BVH_HARDWARE=1.
  2. Mesa NIR descriptor-heap image coherency (patches/mesa.patch, src/compiler/nir/nir_lower_memory_model.c):

    • Handle nir_intrinsic_image_heap_{load,sparse_load,store,atomic,atomic_swap} and nir_intrinsic_bindless_image_{load,sparse_load,store,atomic,atomic_swap} with nir_var_image in get_intrinsic_info().
    • With VK_EXT_descriptor_heap, nir_lower_memory_model previously stripped NIR_MEMORY_MAKE_VISIBLE / NIR_MEMORY_MAKE_AVAILABLE from image barriers without setting ACCESS_COHERENT on descriptor-heap image accesses (also noted in #37).
    • Improves autoexposure and storage-image coherency across both VICTORY_BVH_HARDWARE=0 and 1.

Testing

  • Tested on AMD Radeon RX 9070 XT (RADV 26.3.1, Linux) with VICTORY_BVH_HARDWARE=1 and 0.
  • ./build.sh and ninja -C deps/mesa/build install succeed cleanly.
**@⁠auz466** on GitHub · 2026-11-30 20:46 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/43) `auz466:fix-hw-rt-sync-and-nir-coherency` → `main` · +58 −10 · 2 files · 2 commits · closed without merging ## Summary Two targeted fixes that do not overlap existing open PRs (such as #38, #31, #28): 1. **HW RT synchronization (`crates/victory-gpu/src/draw.rs`):** - Run `memory_ready()` for shaders using `USER_MEMORY_CARD` even when they do not bind `SLOT_MEMORY`. - Emit a global UAV barrier (`D3D12_RESOURCE_BARRIER_TYPE_UAV`, `pResource = None`) before HW RT draws/dispatches that use `USER_MEMORY_CARD`, ensuring preceding BVH builder writes are flushed from GPU caches before `image_bvh64_intersect_ray` reads raw title addresses. - Reduces RTGI speckling/boiling and flickering geometry when `VICTORY_BVH_HARDWARE=1`. 2. **Mesa NIR descriptor-heap image coherency (`patches/mesa.patch`, `src/compiler/nir/nir_lower_memory_model.c`):** - Handle `nir_intrinsic_image_heap_{load,sparse_load,store,atomic,atomic_swap}` and `nir_intrinsic_bindless_image_{load,sparse_load,store,atomic,atomic_swap}` with `nir_var_image` in `get_intrinsic_info()`. - With `VK_EXT_descriptor_heap`, `nir_lower_memory_model` previously stripped `NIR_MEMORY_MAKE_VISIBLE` / `NIR_MEMORY_MAKE_AVAILABLE` from image barriers without setting `ACCESS_COHERENT` on descriptor-heap image accesses (also noted in #37). - Improves autoexposure and storage-image coherency across both `VICTORY_BVH_HARDWARE=0` and `1`. ## Testing - Tested on AMD Radeon RX 9070 XT (RADV 26.3.1, Linux) with `VICTORY_BVH_HARDWARE=1` and `0`. - `./build.sh` and `ninja -C deps/mesa/build install` succeed cleanly.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 07:42:05 +00:00
Author
Owner

@⁠Luxuride on GitHub · 2026-12-04 12:00 UTC · original · edited 2026-12-05 11:24 UTC

As I read it, this is already in main: both commits are in main verbatim — 51ada78 ("gpu: ensure memory_ready and UAV barrier before hardware BVH64 reads") and 00fbdd8 ("mesa: handle image_heap_* and bindless_image_* in nir_lower_memory_model").

In the current tree: crates/victory-gpu/src/draw.rs:2132 (any(|u| u.root == RootType::Other(USER_MEMORY_CARD))) with the global UAV barrier at :2150, and patches/mesa.patch:1956-1990 for the NIR hunk.

Note the trap this PR illustrates: git merge-tree --write-tree main pr/43 exits 0, so it still merges cleanly — that is only a sign of how little either side touched those exact lines since, not evidence there is work left. A clean merge would re-add hunks main already carries.

Whether it still has work of its own is the maintainer's call, not mine.

**@⁠Luxuride** on GitHub · 2026-12-04 12:00 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/43#issuecomment-7410837242) · edited 2026-12-05 11:24 UTC As I read it, this is already in `main`: both commits are in `main` verbatim — `51ada78` ("gpu: ensure memory_ready and UAV barrier before hardware BVH64 reads") and `00fbdd8` ("mesa: handle image_heap_* and bindless_image_* in nir_lower_memory_model"). In the current tree: `crates/victory-gpu/src/draw.rs:2132` (`any(|u| u.root == RootType::Other(USER_MEMORY_CARD))`) with the global UAV barrier at `:2150`, and `patches/mesa.patch:1956-1990` for the NIR hunk. Note the trap this PR illustrates: `git merge-tree --write-tree main pr/43` exits 0, so it still merges cleanly — that is only a sign of how little either side touched those exact lines since, not evidence there is work left. A clean merge would re-add hunks `main` already carries. Whether it still has work of its own is the maintainer's call, not mine.
github-bot closed this pull request 2026-12-05 17:31:42 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.