WIP: perf(vk): a dispatch after only the game's dispatches waits in the compute stage, or not at all when they share no memory (RX_VK_DISPATCH_BARRIER) #2072

Draft
GummiNaomi wants to merge 3 commits from GummiNaomi/Longshot:perf/narrow-barriers into main
Member

Summary

A compute dispatch that follows only the game's own dispatches no longer waits behind a full barrier. Until now every
dispatch recorded after other work got a full barrier (every stage, every access): about 70-90 a frame in the Market and
Hyrule Field, between the game's compute chains. The console's GPU runs one dispatch after the other, so the order matters
where a dispatch reads what the one before wrote; a full barrier also waits for the graphics stages, and on RADV flushes
and invalidates the colour and depth caches with their metadata every time.

Now such a dispatch waits for the ones before it in the compute stage only, and, by default, not at all when its bindings
and theirs share no memory that one of them writes and neither reaches memory its bindings don't show (global memory,
storage buffer tables, texel buffers). The first command after them that is not one of them (a pass, a copy, the
renderer's own dispatch, an upscaler library's work) gets the full barrier first, so everything after them waits for
them, and for what came before them, as it did.

On an RTX 4070 SUPER the GPU time a frame drops by 0.03-0.04 ms (about 0.4 %); the frame rate doesn't move on this
CPU-bound PC. The reason to take it is mainly AMD (RADV, the Steam Deck), where each full barrier between dispatches costs
more; that is still to be measured (Still to test).

Read first: gpu/vk/vk_draw.cpp dispatch() (the decision, above it footprint_conflict and RX_VK_DISPATCH_BARRIER's
comment), gpu/vk/vk_work.h (dispatch_order_owed), gpu/vk/vk_texture.cpp (full_barrier, dispatch_order_pay).

Testing

Tested: Windows 11, RTX 4070 SUPER (NVIDIA 617.42), Ryzen 9 9950X3D (SMT off), 32 GB, in the game (output 2560x1440,
presented off-screen at 1920x1080: the control tool's test profile):

  • the six-area screenshot tour (Kokiri Forest, the Market, Hyrule Field, Kakariko, the Lost Woods, Zora's River) on main
    and on this PR: the same things drawn (lighting, shadows, grass, fog, fireflies, the people); only Link's pose and the
    time of day differ;
  • standing in the Market and Hyrule Field: one run each with the switch alternating within it (0, 2, 0, 1), and 8 runs of
    main against this PR (2 a side a scene); 0 errors in every log;
  • the log's counts, a frame: in the Market about 30 dispatches with no barrier and 30 with the compute-stage one (all of
    those for programs that reach memory their bindings don't show, none for memory in common); in Hyrule Field 27 and 63;
    no owed full barrier ever needed, since every stretch of the game's dispatches ended at a full barrier of its own;
  • this head, rebased onto 9dd41326: the six checks above pass, it builds, and a 60 s run standing in the Market has 0 errors and the same counts (29.8 dispatches a frame with no barrier, 32.1 in the compute stage, 14.8 full barriers recorded, 0 owed); its frame rate is not comparable (the PC's own game started beside it);
  • tests/test_dispatch_barrier.py (new) passes (LLVM clang 22.1, Windows). Of the game-free checks that read a changed
    file, three compiled full_barrier, texture_begin_recording or vk_work.h's counts with fixtures that lacked the new
    state (test_astc_upload_chunking, test_dump_readback, test_inline_write_order): updated here, they pass, with
    test_hos_ab and test_switch_table. The other checks that fail on this PC fail the same way on main (112, among them
    tests/test_pass_barrier.py, whose macro shapes predate the recorder).

Still to test:

  • steamdeck: the A/B standing in Castle Town's market at handheld settings, expecting side 1 (main's full barriers)
    slower, since the Deck's frame waits on its GPU (Test Farm: @Beanstalk steamdeck, stand in Castle Town's market 3
    minutes with HOS_AB=RX_VK_DISPATCH_BARRIER=0,3,60 and RX_VK_FRAME_TRACE=1, then scripts/perf.py ab on the trace)
  • linux, AMD (RADV): the same A/B, expecting side 1 no faster, and no flicker in its screenshots (Test Farm: @Beanstalk
    linux amd, the same A/B)
  • windows, AMD: the same A/B, expecting side 1 no faster (Test Farm: @Beanstalk windows amd, the same A/B)
  • Intel (ANV or Arc): the six-area tour, expecting the same picture as main (Test Farm: @Beanstalk intel, the six-area
    screenshot tour on main and on this PR)
  • Linux build: by someone with a Linux toolchain (by hand)

Measurements

Verdict: GPU time a frame 0.03-0.06 ms lower (0.4-0.7 %) on an RTX 4070 SUPER, in two scenes and by two methods; the frame rate is within the spread (this PC is CPU-bound there). The compute-stage barrier alone (=1) shows nothing on NVIDIA; leaving barriers out (=2) is what moves it. The gain this is for is on RADV (the Steam Deck, AMD), still to be measured.

Setup: Windows 11, RTX 4070 SUPER (NVIDIA 617.42), Ryzen 9 9950X3D SMT off; headless, output 2560x1440 (the control
tool's test profile, presented off-screen at 1920x1080), uncapped
(HOS_FPS_MAX=1000), RX_VK_TEX_AHEAD=1 RX_VK_ASTC_BC_ALL=1 RX_VK_IMAGE_BLOCK_MB=32 RX_VK_LOAD=create RX_VK_BC_LAYERS=8;
the repository's kokiri-start save, the debug teleport, standing. GPU time: each recording's begin/end timestamps
(vk: GPU time X ms a frame, pass timing off).

Main against this PR, interleaved (main, PR, main, PR), the same exe with only the renderer swapped, standing
150 s; the log's lines every 120 presents from the 16th after the scene's draws are reached:

Before: main @ f1f2dc5b After: this PR @ 48d91d2a (before its rebase) Δ
Market entrance: GPU time a frame 8.046 ms (8.026, 8.067) 7.988 ms (7.960, 8.016) -0.058 ms (-0.7 %)
Market entrance: fps 88.3 (88.4, 88.2) 89.0 (88.1, 90.0) +0.8 %, within the spread
Hyrule Field: GPU time a frame 8.097 ms (8.095, 8.099) 8.070 ms (8.099, 8.041) -0.027 ms (-0.3 %), within the spread
Hyrule Field: fps 102.8 (102.7, 103.0) 102.6 (102.3, 102.9) -0.2 %, within the spread

The switch alternated within one run (0, 2, 0, 1, 3 s each after 100 s, about 20 rounds; GPU time summed by the value
each recording was made with), each value against the two 0s around it, 95 % interval by a bootstrap of rounds:

GPU time a frame against =0 (main's full barriers) Market entrance (8.15 ms) Hyrule Field (8.25 ms)
=2 (the default) -0.056 ms (-0.123 to +0.005) -0.036 ms (-0.080 to +0.013)
=1 -0.018 ms (-0.058 to +0.022) -0.005 ms (-0.054 to +0.043)
=0 against =0 -0.028 ms (-0.133 to +0.041) -0.034 ms (-0.077 to +0.008)

An earlier version leaving out the same barriers measured -0.044 ms (-0.057 to -0.031) in the Market and -0.034 ms
(-0.053 to -0.014) in Hyrule Field, where leaving out every barrier between dispatches would be worth -0.05 and -0.14 ms:
about half of them stay, for programs whose memory the bindings don't show. 48d91d2a is this PR but for the log line's
count (the head changes only that count). Rebased since onto 9dd41326: main's 14 commits in between (input, the
website, the camera, the BC encoder's copy, a spin switch, saves, the working-set floor, the FPS counter's footer, the
output-resolution preview, the mesh-draw scan's table, the lift's float bodies, pipeline lists) touch nothing this changes
or measures; the head was built and run again on it (Tested).

Flags and settings

Flag What it is Before this PR After this PR Effect Helps / doesn't help / untested Recommendation
RX_VK_DISPATCH_BARRIER how a dispatch after only the game's dispatches waits (no switch: a full barrier) 2: compute stage, or none where nothing is in common 0 gives the full barriers back; 1 the compute stage, never none helps a little on NVIDIA (-0.03 to -0.06 ms of GPU time); untested on AMD, the Deck, Intel on for everyone (unset)

Risks

What could break: a dispatch that reads or writes memory its bindings don't show while being marked as known would race
with a neighbour: a flicker or a wrong value in a compute result (shadows, the people's animation, the culling lists).
The footprint is unknown for every way a program reaches memory past its bindings that the shader translator reports
(global memory, storage buffer tables, texel buffers, networks), and indirect grids always wait. RX_VK_DISPATCH_BARRIER=1
keeps the order between all dispatches (compute stage only); =0 is main's behaviour. Nothing changes in saves, options
or caches.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A switch added or changed: it ships at the default the measurements chose, with its row in gpu/vk/switches.def.
  • A check under tests/ that reads changed source is updated, not weakened.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths.
  • Screenshots of the same spot on main and here, for a change that shows on screen.
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary A compute dispatch that follows only the game's own dispatches no longer waits behind a full barrier. Until now every dispatch recorded after other work got a full barrier (every stage, every access): about 70-90 a frame in the Market and Hyrule Field, between the game's compute chains. The console's GPU runs one dispatch after the other, so the order matters where a dispatch reads what the one before wrote; a full barrier also waits for the graphics stages, and on RADV flushes and invalidates the colour and depth caches with their metadata every time. Now such a dispatch waits for the ones before it in the compute stage only, and, by default, not at all when its bindings and theirs share no memory that one of them writes and neither reaches memory its bindings don't show (global memory, storage buffer tables, texel buffers). The first command after them that is not one of them (a pass, a copy, the renderer's own dispatch, an upscaler library's work) gets the full barrier first, so everything after them waits for them, and for what came before them, as it did. On an RTX 4070 SUPER the GPU time a frame drops by 0.03-0.04 ms (about 0.4 %); the frame rate doesn't move on this CPU-bound PC. The reason to take it is mainly AMD (RADV, the Steam Deck), where each full barrier between dispatches costs more; that is still to be measured (Still to test). Read first: `gpu/vk/vk_draw.cpp` `dispatch()` (the decision, above it `footprint_conflict` and `RX_VK_DISPATCH_BARRIER`'s comment), `gpu/vk/vk_work.h` (`dispatch_order_owed`), `gpu/vk/vk_texture.cpp` (`full_barrier`, `dispatch_order_pay`). ## Testing **Tested:** Windows 11, RTX 4070 SUPER (NVIDIA 617.42), Ryzen 9 9950X3D (SMT off), 32 GB, in the game (output 2560x1440, presented off-screen at 1920x1080: the control tool's test profile): - the six-area screenshot tour (Kokiri Forest, the Market, Hyrule Field, Kakariko, the Lost Woods, Zora's River) on main and on this PR: the same things drawn (lighting, shadows, grass, fog, fireflies, the people); only Link's pose and the time of day differ; - standing in the Market and Hyrule Field: one run each with the switch alternating within it (0, 2, 0, 1), and 8 runs of main against this PR (2 a side a scene); 0 errors in every log; - the log's counts, a frame: in the Market about 30 dispatches with no barrier and 30 with the compute-stage one (all of those for programs that reach memory their bindings don't show, none for memory in common); in Hyrule Field 27 and 63; no owed full barrier ever needed, since every stretch of the game's dispatches ended at a full barrier of its own; - this head, rebased onto 9dd41326: the six checks above pass, it builds, and a 60 s run standing in the Market has 0 errors and the same counts (29.8 dispatches a frame with no barrier, 32.1 in the compute stage, 14.8 full barriers recorded, 0 owed); its frame rate is not comparable (the PC's own game started beside it); - `tests/test_dispatch_barrier.py` (new) passes (LLVM clang 22.1, Windows). Of the game-free checks that read a changed file, three compiled `full_barrier`, `texture_begin_recording` or `vk_work.h`'s counts with fixtures that lacked the new state (`test_astc_upload_chunking`, `test_dump_readback`, `test_inline_write_order`): updated here, they pass, with `test_hos_ab` and `test_switch_table`. The other checks that fail on this PC fail the same way on main (112, among them `tests/test_pass_barrier.py`, whose macro shapes predate the recorder). **Still to test:** - steamdeck: the A/B standing in Castle Town's market at handheld settings, expecting side 1 (main's full barriers) slower, since the Deck's frame waits on its GPU (Test Farm: @Beanstalk steamdeck, stand in Castle Town's market 3 minutes with HOS_AB=RX_VK_DISPATCH_BARRIER=0,3,60 and RX_VK_FRAME_TRACE=1, then scripts/perf.py ab on the trace) - linux, AMD (RADV): the same A/B, expecting side 1 no faster, and no flicker in its screenshots (Test Farm: @Beanstalk linux amd, the same A/B) - windows, AMD: the same A/B, expecting side 1 no faster (Test Farm: @Beanstalk windows amd, the same A/B) - Intel (ANV or Arc): the six-area tour, expecting the same picture as main (Test Farm: @Beanstalk intel, the six-area screenshot tour on main and on this PR) - Linux build: by someone with a Linux toolchain (by hand) ## Measurements **Verdict:** GPU time a frame 0.03-0.06 ms lower (0.4-0.7 %) on an RTX 4070 SUPER, in two scenes and by two methods; the frame rate is within the spread (this PC is CPU-bound there). The compute-stage barrier alone (`=1`) shows nothing on NVIDIA; leaving barriers out (`=2`) is what moves it. The gain this is for is on RADV (the Steam Deck, AMD), still to be measured. Setup: Windows 11, RTX 4070 SUPER (NVIDIA 617.42), Ryzen 9 9950X3D SMT off; headless, output 2560x1440 (the control tool's test profile, presented off-screen at 1920x1080), uncapped (`HOS_FPS_MAX=1000`), `RX_VK_TEX_AHEAD=1 RX_VK_ASTC_BC_ALL=1 RX_VK_IMAGE_BLOCK_MB=32 RX_VK_LOAD=create RX_VK_BC_LAYERS=8`; the repository's kokiri-start save, the debug teleport, standing. GPU time: each recording's begin/end timestamps (`vk: GPU time X ms a frame`, pass timing off). Main against this PR, interleaved (main, PR, main, PR), the same exe with only the renderer swapped, standing 150 s; the log's lines every 120 presents from the 16th after the scene's draws are reached: | | Before: main @ f1f2dc5b | After: this PR @ 48d91d2a (before its rebase) | Δ | |---|---|---|---| | Market entrance: GPU time a frame | 8.046 ms (8.026, 8.067) | 7.988 ms (7.960, 8.016) | -0.058 ms (-0.7 %) | | Market entrance: fps | 88.3 (88.4, 88.2) | 89.0 (88.1, 90.0) | +0.8 %, within the spread | | Hyrule Field: GPU time a frame | 8.097 ms (8.095, 8.099) | 8.070 ms (8.099, 8.041) | -0.027 ms (-0.3 %), within the spread | | Hyrule Field: fps | 102.8 (102.7, 103.0) | 102.6 (102.3, 102.9) | -0.2 %, within the spread | The switch alternated within one run (0, 2, 0, 1, 3 s each after 100 s, about 20 rounds; GPU time summed by the value each recording was made with), each value against the two 0s around it, 95 % interval by a bootstrap of rounds: | GPU time a frame against `=0` (main's full barriers) | Market entrance (8.15 ms) | Hyrule Field (8.25 ms) | |---|---|---| | `=2` (the default) | -0.056 ms (-0.123 to +0.005) | -0.036 ms (-0.080 to +0.013) | | `=1` | -0.018 ms (-0.058 to +0.022) | -0.005 ms (-0.054 to +0.043) | | `=0` against `=0` | -0.028 ms (-0.133 to +0.041) | -0.034 ms (-0.077 to +0.008) | An earlier version leaving out the same barriers measured -0.044 ms (-0.057 to -0.031) in the Market and -0.034 ms (-0.053 to -0.014) in Hyrule Field, where leaving out every barrier between dispatches would be worth -0.05 and -0.14 ms: about half of them stay, for programs whose memory the bindings don't show. 48d91d2a is this PR but for the log line's count (the head changes only that count). Rebased since onto 9dd41326: main's 14 commits in between (input, the website, the camera, the BC encoder's copy, a spin switch, saves, the working-set floor, the FPS counter's footer, the output-resolution preview, the mesh-draw scan's table, the lift's float bodies, pipeline lists) touch nothing this changes or measures; the head was built and run again on it (Tested). ### Flags and settings | Flag | What it is | Before this PR | After this PR | Effect | Helps / doesn't help / untested | Recommendation | |---|---|---|---|---|---|---| | `RX_VK_DISPATCH_BARRIER` | how a dispatch after only the game's dispatches waits | (no switch: a full barrier) | 2: compute stage, or none where nothing is in common | 0 gives the full barriers back; 1 the compute stage, never none | helps a little on NVIDIA (-0.03 to -0.06 ms of GPU time); untested on AMD, the Deck, Intel | on for everyone (unset) | ## Risks What could break: a dispatch that reads or writes memory its bindings don't show while being marked as known would race with a neighbour: a flicker or a wrong value in a compute result (shadows, the people's animation, the culling lists). The footprint is unknown for every way a program reaches memory past its bindings that the shader translator reports (global memory, storage buffer tables, texel buffers, networks), and indirect grids always wait. `RX_VK_DISPATCH_BARRIER=1` keeps the order between all dispatches (compute stage only); `=0` is main's behaviour. Nothing changes in saves, options or caches. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [ ] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A switch added or changed: it ships at the default the measurements chose, with its row in `gpu/vk/switches.def`. - [ ] A check under `tests/` that reads changed source is updated, not weakened. - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. - [x] Screenshots of the same spot on `main` and here, for a change that shows on screen. - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Every dispatch recorded after other work got a full barrier (every stage, every access), about 70-90 a frame between the
game's own compute chains in the Market and Hyrule Field. On the console's GPU one dispatch starts after the one before
ends, so the order is needed where a dispatch reads what the last wrote; a full barrier also waits for the graphics stages
and, on RADV, flushes and invalidates the colour and depth caches with their metadata every time.

Now a dispatch that follows only the game's dispatches since the last full barrier on its command buffer:
- waits for them with a compute-to-compute barrier (compute and indirect-grid stages after every compute write);
- by default, with no barrier at all when its bindings and theirs share no memory one of them writes (storage buffer
  ranges, uniform buffers, the indirect grid, sampled textures and storage images, by GPU address) and neither reaches
  memory its bindings do not show (global memory, storage buffer tables, texel buffers, a network's stand-in): those then
  wait in the compute stage. The set compared against starts again after any compute-stage or full barrier.
The first command on that command buffer after such dispatches that is not one of them (a pass, a copy, the renderer's own
dispatch, an upscaler library's recording) gets the full barrier first (vk_work.h dispatch_order_owed, paid in every
counted vkCmd* and before NGX, ffxDispatch and xessVKExecute), so everything after them waits for them and for what came
before them, as it did.

RX_VK_DISPATCH_BARRIER=0 gives the full barriers back, =1 the compute-stage barrier without leaving any out; it is read at
each recording's start, so HOS_AB can alternate it. A log line every 120 presents counts the dispatches by how they waited.

tests/test_dispatch_barrier.py (new) compiles the decision, the footprint's comparison, full_barrier, the payment and
vk_work.h's macros over a driver that records each barrier's kind, with 6 broken copies and 3 broken sources that must
fail; tests/test_hos_ab.py lists the switch as wired.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
test: the checks that compile full_barrier and texture_begin_recording define the dispatches' order state (RX_VK_DISPATCH_BARRIER)
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 6s
PR description / Description follows the template (pull_request_target) Successful in 8s
CI / Workflow lint (actionlint) (pull_request) Successful in 10s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 10s
Website / Website on Cloudflare (pull_request_target) Has been skipped
Third-party parts / As their notes say (pull_request) Successful in 13s
beanstalk/approval can't be tested as asked: see the farm's comment
CI / Website build and checks (pull_request) Successful in 2m53s
49fea38644
tests/test_inline_write_order.py, tests/dump_readback_test.cpp (test_dump_readback.py) and
tests/test_astc_upload_chunking.py cut full_barrier, texture_begin_recording or vk_work.h's counts and define the state they
read; they now define the dispatch order's too (besides_dispatches, the counts, dispatch_order_owed). The inline write order's
broken copy without the work count matches the wrapper whatever comes before the count.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member

Possibly related, for context:

  • PR #1542 fix(vk): ten changes from the renderer rewrite research, one commit per issue — Open renderer work includes Vulkan replay/barrier area but no identical change stated; overlapping changes possible.
Possibly related, for context: - PR #1542 fix(vk): ten changes from the renderer rewrite research, one commit per issue — Open renderer work includes Vulkan replay/barrier area but no identical change stated; overlapping changes possible.
Author
Member

@Beanstalk steamdeck: stand in Castle Town's market 3 minutes at handheld settings with HOS_AB=RX_VK_DISPATCH_BARRIER=0,3,60 and RX_VK_FRAME_TRACE=1, then scripts/perf.py ab on the trace. Side 1 is main's full barriers between dispatches; if this helps the Deck, side 1 is slower. Screenshots from both sides welcome (no flicker expected).

@Beanstalk steamdeck: stand in Castle Town's market 3 minutes at handheld settings with HOS_AB=RX_VK_DISPATCH_BARRIER=0,3,60 and RX_VK_FRAME_TRACE=1, then scripts/perf.py ab on the trace. Side 1 is main's full barriers between dispatches; if this helps the Deck, side 1 is slower. Screenshots from both sides welcome (no flicker expected).
Member

Beanstalk test farm · ⛔ can't be tested as asked

Commit 49fea38 · approved by GummiNaomi (untrusted) · dashboard

Not run: the farm can't test this as asked, so nothing is built or run:

The requested in-run HOS_AB trace and scripts/perf.py analysis cannot be run by the farm: the frame-trace switch is forbidden and the plan cannot invoke that script. The alternative compares main and the PR in separate Market runs, but cannot establish the requested within-run A/B result.

⚠️ Note: The alternative uses the handheld profile on both targets because scenarios cannot be restricted to individual targets.
⚠️ Note: Two still screenshots can catch persistent visual differences but cannot rule out intermittent flicker.

What it could test instead: As an alternative, Steam Deck and Linux AMD testers would stand in the Market for three minutes per side, using the handheld profile, while GPU time and frame times are measured. Screenshots would be compared with main and the PR's dispatch-statistics line collected when available. A crash, a GPU-time or frame-time regression over 10%, or a screenshot difference over the threshold would fail the plan; it takes about 17 minutes per tester.

A member of BigBeans can comment @Beanstalk <new words> to ask for something else, or @Beanstalk test it anyway to run the plan regardless.

<!-- beanstalk:sticky --> ### Beanstalk test farm · ⛔ can't be tested as asked Commit `49fea38` · approved by GummiNaomi (untrusted) · [dashboard](https://beanstalk.magicbean.dev/prs/2072) **Not run: the farm can't test this as asked**, so nothing is built or run: > The requested in-run HOS_AB trace and scripts/perf.py analysis cannot be run by the farm: the frame-trace switch is forbidden and the plan cannot invoke that script. The alternative compares main and the PR in separate Market runs, but cannot establish the requested within-run A/B result. ⚠️ **Note:** The alternative uses the handheld profile on both targets because scenarios cannot be restricted to individual targets. ⚠️ **Note:** Two still screenshots can catch persistent visual differences but cannot rule out intermittent flicker. What it could test instead: As an alternative, Steam Deck and Linux AMD testers would stand in the Market for three minutes per side, using the handheld profile, while GPU time and frame times are measured. Screenshots would be compared with main and the PR's dispatch-statistics line collected when available. A crash, a GPU-time or frame-time regression over 10%, or a screenshot difference over the threshold would fail the plan; it takes about 17 minutes per tester. A member of `BigBeans` can comment `@Beanstalk <new words>` to ask for something else, or `@Beanstalk test it anyway` to run the plan regardless.
Author
Member

@Beanstalk linux amd: the same A/B, standing in Castle Town's market 3 minutes with HOS_AB=RX_VK_DISPATCH_BARRIER=0,3,60 and RX_VK_FRAME_TRACE=1, then scripts/perf.py ab on the trace, plus the log's "dispatches after only the game's dispatches" line. Expecting side 1 (main's full barriers) no faster, and no flicker.

@Beanstalk linux amd: the same A/B, standing in Castle Town's market 3 minutes with HOS_AB=RX_VK_DISPATCH_BARRIER=0,3,60 and RX_VK_FRAME_TRACE=1, then scripts/perf.py ab on the trace, plus the log's "dispatches after only the game's dispatches" line. Expecting side 1 (main's full barriers) no faster, and no flicker.
Contributor

Steam Deck result: I ran this PR on a Steam Deck OLED standing in the Market, both with the switch flipped every 3 s inside the same runs and as main against the PR in separate runs. Neither showed a difference the Deck can resolve: the in-run comparison came out at +0.2 % fps with a 95 % interval of -1.6 % to +1.3 %, and main against the PR was within the runs' spread. No errors in any log; the PR's own line shows the barriers being left out as intended (about 27 dispatches a frame with no barrier and 31 waiting only in the compute stage in the Market).

1. In-run, the switch flipped every 3 s (HOS_AB=RX_VK_DISPATCH_BARRIER=0,3,0), 3 runs of 120 s

PR default (RX_VK_DISPATCH_BARRIER unset) RX_VK_DISPATCH_BARRIER=0 Δ
fps 25.8 25.9 +0.20 % (95 % interval of the frame time: -1.63 % to +1.34 %, holds 0)
mean frame time 38.73 ms 38.65 ms -0.08 ms
median frame time 37.16 ms 37.28 ms +0.12 ms
p99 frame time 63.35 ms 62.65 ms -0.70 ms
frames of 50 ms or more per minute 133.1 121.1 -12.0

Per run (side 0 = the PR's default, side 1 = =0): 26.1 / 26.0 fps (-0.40 %), 25.6 / 25.6 (+0.14 %), 25.8 / 26.0 (+0.85 %).
dev.py ab's verdict: no difference shown.

2. Main against the PR, separate runs, 2 interleaved pairs of 60 s

main @ 9dd41326 main + this PR @ 49fea386 Δ
fps (each run) 26.2 / 26.5 (median 26.4) 26.5 / 25.2 (median 25.9) -2.0 %
1% low fps (1000 / p99) 16.3 15.3 -6.3 %
median frame time 36.66 ms 37.02 ms +0.35 ms
p99 frame time 61.57 ms 65.59 ms +4.01 ms
frames of 50 ms or more (each run) 80 / 95 90 / 163

dev.py ab's verdict: no difference shown, -2.0 % within the runs' spread (A 26.2 to 26.5, B 25.2 to 26.5). The 50 ms frames vary this much between starts on this Deck on the same build (a main-only run earlier in the same session ranged 15 to 122), and the in-run comparison above, which is not exposed to that start-to-start variation, had slightly fewer of them with the PR's default, so I read neither the -2.0 % nor the long frames as a regression.

The PR's line (B runs, a frame in the Market): dispatches after only the game's dispatches (RX_VK_DISPATCH_BARRIER=2): 27.4 with no barrier (no written memory in common), 31.1 waited in the compute stage (31.1 reach memory their bindings do not show, 0.0 share written memory), 7.8 a full barrier recorded. No FATAL, device-lost, VK_ERROR or validation line in any of the 7 logs; every run exited normally.

Hardware: Steam Deck OLED, SteamOS 3.9.5, RADV VANGOGH, Mesa 26.2.0-devel, GPU clock manual 1600 MHz, headless.
Settings: Minimum, Render 50 % (640x400), output 1280x800, uncapped, V-Sync and frame generation off.
Game data: complete (the dump, with the three damaged textures replaced).
Built: main @ 9dd41326 and this PR @ 49fea386 (its 3 commits, which sit on main 9dd41326), x86-64-v3, shaders prepared on the Deck; only the renderer differs.
Measured: dev.py ab standing in the Market (the project's tool, with a local change to compare two prebuilt runtimes, since the Deck does not build).

Limits: few runs, one Deck, headless, one standing scene. In the Market on this Deck the frame waits on the replay's CPU work as much as on the GPU (GPU time about 20 ms of a 38 ms frame), so a GPU-side saving may not show in fps here; a GPU-bound scene might. Headless runs can't judge flicker or other visual faults.

Steam Deck result: I ran this PR on a Steam Deck OLED standing in the Market, both with the switch flipped every 3 s inside the same runs and as main against the PR in separate runs. Neither showed a difference the Deck can resolve: the in-run comparison came out at +0.2 % fps with a 95 % interval of -1.6 % to +1.3 %, and main against the PR was within the runs' spread. No errors in any log; the PR's own line shows the barriers being left out as intended (about 27 dispatches a frame with no barrier and 31 waiting only in the compute stage in the Market). **1. In-run, the switch flipped every 3 s (`HOS_AB=RX_VK_DISPATCH_BARRIER=0,3,0`), 3 runs of 120 s** | | PR default (`RX_VK_DISPATCH_BARRIER` unset) | `RX_VK_DISPATCH_BARRIER=0` | Δ | |---|---|---|---| | fps | 25.8 | 25.9 | +0.20 % (95 % interval of the frame time: -1.63 % to +1.34 %, holds 0) | | mean frame time | 38.73 ms | 38.65 ms | -0.08 ms | | median frame time | 37.16 ms | 37.28 ms | +0.12 ms | | p99 frame time | 63.35 ms | 62.65 ms | -0.70 ms | | frames of 50 ms or more per minute | 133.1 | 121.1 | -12.0 | Per run (side 0 = the PR's default, side 1 = `=0`): 26.1 / 26.0 fps (-0.40 %), 25.6 / 25.6 (+0.14 %), 25.8 / 26.0 (+0.85 %). `dev.py ab`'s verdict: **no difference shown**. **2. Main against the PR, separate runs, 2 interleaved pairs of 60 s** | | main @ 9dd41326 | main + this PR @ 49fea386 | Δ | |---|---|---|---| | fps (each run) | 26.2 / 26.5 (median 26.4) | 26.5 / 25.2 (median 25.9) | -2.0 % | | 1% low fps (1000 / p99) | 16.3 | 15.3 | -6.3 % | | median frame time | 36.66 ms | 37.02 ms | +0.35 ms | | p99 frame time | 61.57 ms | 65.59 ms | +4.01 ms | | frames of 50 ms or more (each run) | 80 / 95 | 90 / 163 | | `dev.py ab`'s verdict: **no difference shown**, -2.0 % within the runs' spread (A 26.2 to 26.5, B 25.2 to 26.5). The 50 ms frames vary this much between starts on this Deck on the same build (a main-only run earlier in the same session ranged 15 to 122), and the in-run comparison above, which is not exposed to that start-to-start variation, had slightly fewer of them with the PR's default, so I read neither the -2.0 % nor the long frames as a regression. The PR's line (B runs, a frame in the Market): `dispatches after only the game's dispatches (RX_VK_DISPATCH_BARRIER=2): 27.4 with no barrier (no written memory in common), 31.1 waited in the compute stage (31.1 reach memory their bindings do not show, 0.0 share written memory), 7.8 a full barrier recorded`. No `FATAL`, device-lost, `VK_ERROR` or validation line in any of the 7 logs; every run exited normally. Hardware: Steam Deck OLED, SteamOS 3.9.5, RADV VANGOGH, Mesa 26.2.0-devel, GPU clock manual 1600 MHz, headless. Settings: Minimum, Render 50 % (640x400), output 1280x800, uncapped, V-Sync and frame generation off. Game data: complete (the dump, with the three damaged textures replaced). Built: main @ 9dd41326 and this PR @ 49fea386 (its 3 commits, which sit on main 9dd41326), x86-64-v3, shaders prepared on the Deck; only the renderer differs. Measured: `dev.py ab` standing in the Market (the project's tool, with a local change to compare two prebuilt runtimes, since the Deck does not build). Limits: few runs, one Deck, headless, one standing scene. In the Market on this Deck the frame waits on the replay's CPU work as much as on the GPU (GPU time about 20 ms of a 38 ms frame), so a GPU-side saving may not show in fps here; a GPU-bound scene might. Headless runs can't judge flicker or other visual faults.
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 6s
PR description / Description follows the template (pull_request_target) Successful in 8s
CI / Workflow lint (actionlint) (pull_request) Successful in 10s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 10s
Website / Website on Cloudflare (pull_request_target) Has been skipped
Third-party parts / As their notes say (pull_request) Successful in 13s
beanstalk/approval can't be tested as asked: see the farm's comment
CI / Website build and checks (pull_request) Successful in 2m53s
This pull request has changes conflicting with the target branch.
  • gpu/vk/vk_dlss.cpp
  • gpu/vk/vk_draw.cpp
  • tests/test_hos_ab.py
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'perf/narrow-barriers:GummiNaomi-perf/narrow-barriers'
git switch 'GummiNaomi-perf/narrow-barriers'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2072
No description provided.