perf(vk): the mesh-draw scan looks each op's kind up in a table #2008
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2008
Loading…
Reference in a new issue
No description provided.
Delete branch "klimovich008/Longshot:perf/mesh-scan-op-table"
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?
Summary
After each of the game's barriers the renderer scans the frame's commands for indirect mesh draws to batch (#1846). For every command it asked which kind it is by walking a list of 37 commands one by one, about 1,200 scans a frame, and that walk alone was about 1.7 % of the render thread's time on my PC. Now each command's kind is looked up in a 256-entry table built at compile time from the same list. Same answers, same draws, a little less recording time on the render thread.
gpu/vk/mesh_conv.h:Opsholds the table (kind[kOpTable], 256 entries) instead of a pointer to the list;constexpr make_ops()builds it (every entry starts as Stop, the listed commands become Pass, the mesh draw becomes Draw);kind_of()is one bounds check and one byte read. Anything not in the list, or past the table, is Stop, as an unknown command was before (that only costs a rescan, never a draw converted early).OpKindis nowuint8_twith Stop at 0.gpu/vk/vk_replay.cppmesh_conv_at_barrier: the list of 37 commands stays the one place they are named; the table is made from it as astatic constexpr, with astatic_assertthat every command fits.RX_VK_MESH_CONV=0or1still turns the batching, and so the scan, off.Who gains: every GPU on the native mesh path (
RX_VK_MESH_CONV=2, the default, on a GPU with mesh shaders): NVIDIA, AMD and Intel on Windows, NVIDIA and Intel on Linux. The cost is a count of compares per command of the game's own stream, the same on every PC, so it carries; a slower CPU pays more of it in ms. In Automatic mode, RADV GPUs and the Steam Deck take the compute fallback withdev.mesh_shaderdisabled, so they do not run this scan. Forced native mode on a supported RADV device can reach it. The scan also requiresmesh_args_rewriteto be off; that function gates a separate argument-rewrite mode. #1946 is in this branch's main and its test is kept.Read first:
kind_ofandmake_opsingpu/vk/mesh_conv.h, thenmesh_conv_at_barrieringpu/vk/vk_replay.cpp.Testing
Tested: Windows 11, Ryzen 7 5700X3D, RX 9070 XT, AMD 26.11.2: Hyrule Field with the camera turning, uncapped (
frame_rate_cap = 6,vsync = 2,frame_generation = 0), 3 alternating pairs against main plus sampled runs and one screenshot run a side. Grass and foliage look the same as on main (nothing missing, flickering or garbled); the mesh counters in the log (vk: a frame: indirect mesh draws' arguments) are the same on both sides: 47 draws from 30 batches a frame, 0 dropped, 0 stale, the scans ending at a barrier, a command and the end the same number of times; no new kinds of error lines; the game clock read 1.000 in all 10 runs.Checks:
tests/test_mesh_conv.py(inrun_all):kind_offrom the table answers as a walk of the replay's own list does, for every opcode 0..4096, every rx_nvn.h opcode with one of bits 8-31 set, and huge values, for the replay'sOps(its declaration cut from the live code ofvk_replay.cpp),Opswith buffer clears added and anOpsmade in a constant expression. A new check overwrites the list after makingOpsand expects the same answers: main fails there ("kind_of walks the list at each op: no table"), this branch passes. Two new broken variants must fail and do (the table shifted by one opcode; an opcode past the table answered Pass), as do the five old ones. Seven broken copies of the realmesh_conv.heach make the test fail.tests/mesh_conv_real_test.cpp(constexpr int log_debugunused,-Werror), before it reaches this change; before merging main it passed with clang++ (llvm-mingw's clang 23 on Windows, clang 21 on Linux).vk_replay.cppandvk_draw.cppfor Windows (llvm-mingw) and Linux (clang 21, the Linux renderer flags); the Windows renderer DLL built with llvm-mingw.mise run lint: only the known SC2016 info inbuild-windows.yml, which passes in CI on main.tests/run_all.py(Windows, llvm-mingw clang): 776 passed, 75 failed, 54 skipped on this branch and the same on main @f1f2dc5b; the failing files are identical,test_mesh_conv.pyamong them for the clang++ fixture reason above.Still to test:
Measurements
Verdict: the scan's cost on the render thread fell from 2.30-2.65 % to 0.62-0.74 % of its time, about 0.2 ms a frame; fps no lower (diagnostic, see below).
Setup: Windows 11, Ryzen 7 5700X3D, RX 9070 XT, AMD 26.11.2, 16:9, Hyrule Field with the camera turning from the load, a 20 s window,
HOS_FPS_MAX=240,RX_VK_ASYNC=1(render thread on), uncapped profile (frame_rate_cap = 6,vsync = 2,frame_generation = 0). The cost: sampled runs, the share of the render thread's samples that fall in the scan's code (each DLL's own map; 3,775-3,968 samples a run; two of this PR's three sampled runs failed the fps test's game-clock rule in one probe (0.936, 1.021; two of main's runs today failed it the same way), which doesn't change the sample counts). fps: 3 alternating pairs, the median. The renderer was built from4c4583b0; the commits after it change only tests and merge main.87c0d7b44c4583b0The fps rose in all 3 pairs, but I don't claim that +6 %: it is more than the 0.2 ms the scan saves explains. The replay's draw and descriptor times fell too (5.62 → 5.45 ms, 2.58 → 2.29 ms), and this change doesn't touch them, so part of the difference is run-to-run spread or how the rebuilt DLL is laid out; I did not run a control with main's renderer rebuilt unchanged. Read the fps rows as "no loss". The one frame over 250 ms was on main's side (460 ms).
Measured on main @
87c0d7b4; the branch is now on main @f1f2dc5b. The counted cost should still hold: none of the commits between touchmesh_conv.hor the scan inmesh_conv_at_barrier(the renderer commits between change the compute fallback and its log line, the pipeline caches, the swapchain at the close and a brace), so the scan does the same work per command. The fps rows were not measured again. Since then the branch moved to main @fd7dc40d. Betweenf1f2dc5bandfd7dc40d,mesh_conv.handmesh_conv_at_barrierare untouched too. The only renderer changes are the FPS counter footer's upscale route record invk_draw.cpp(and its two lines invk_replay.cpp), which runs only while that footer is shown, so the numbers still hold.Risks
A command given the wrong kind would be a rendering bug, not a crash: one taken for Pass that writes memory would convert a draw's arguments before the write (wrong grass for a frame); one taken for Stop only costs a rescan. The test compares the table with the old walk for every opcode, and anything unknown is Stop. A revert is enough to undo it;
RX_VK_MESH_CONV=1or0turns the scan off. After updating: nothing.mesh_conv.handvk_replay.cppare not in the shader-cache stamp, so no re-prepare; no renderer API change.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). On the author's Windows run (Checks above), the 75 failures are the same files on this branch and onmain@f1f2dc5b(test_mesh_conv.pyamong them, failing onmainalike for the clang++ fixture reason in Checks; it passes with g++); the list itself wasn't kept, and the maintainer accepted the author's account of it.main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
f1f2dc5b) into perf/mesh-scan-op-tableTested in game: Windows 11, RX 9070 XT, AMD 26.11.2, Ryzen 7 5700X3D: Hyrule Field uncapped, 3 alternating pairs against main plus sampled and screenshot runs. Grass and foliage look the same as main, the indirect mesh draw counters match, no new error-line kinds, game clock 1.000 in all runs; the scan's share of render-thread samples fell from 2.30-2.65 % to 0.62-0.74 %.
@Beanstalk please compare this PR's head against main, no-loss check for a render-thread CPU change on the native mesh-shader path. Hyrule Field from the load, camera turning, windowed,
frame_rate_cap = 6(Uncapped),vsync = 2(Off),frame_generation = 0, 2 runs a side. On: Windows NVIDIA with 6 GB of VRAM or more (not the RTX 3050 Ti laptop tester), Linux NVIDIA, and Linux AMD. Report fps, frame time p99 and any crash or hang per side. Expecting fps and p99 no worse than main. Linux AMD on RADV takes the compute fallback, where this change doesn't run, so it should match main.Beanstalk test farm · an earlier run: commit
9391932, run 3 (the newer results are in a comment below)Commit
9391932· approved by klimovich008 (reviewed) · dashboard⚠️ Note: The requested windowed camera-turning comparison is omitted: window scenarios require every target to have the window tag, and Linux testers cannot run them; the explicitly requested headless alternative runs instead.
⚠️ Note: The farm cannot exclude a specific GPU model from a target, so the Windows target may include the RTX 3050 Ti laptop if it meets the VRAM requirement.
⚠️ Note: On RADV, the compute fallback does not execute the changed scan, so that comparison is a control rather than a direct test of the optimization.
Done (started 04:27 UTC, last report 04:55 UTC). Run 3: re-planned by klimovich008. Comment
@Beanstalkto run it again.windows+nvidia+vram-ge6gb(6 GB VRAM or more)linux+nvidialinux+amdWhy it failed
windows+nvidia+vram-ge6gb:field-headlessfield.fps_mean.min_delta_pct:109.6 → 109.4 (−0.1%); limit 0.0linux+amd:field-headlessfield.fps_mean.min_delta_pct:97.8 → 96.8 (−1.1%); limit 0.0Couldn't be judged: the tester's PC could not finish the test. The farm tries another PC, or the same one after a fix; it says nothing about the PR on its own.
windows+nvidia+vram-ge6gb, report 2:Insufficient frame-time evidence for 1 required comparison(s). See rule results. a step ran out of time at step 2 (wait map HyruleField_Child): timeout: not met in time (then the game was in play on KokiriForest_Child)linux+nvidia, report 1:Insufficient frame-time evidence for 1 required comparison(s). See rule results. a step ran out of time at step 2 (wait map HyruleField_Child): timeout: not met in time (then the game was in play on KokiriForest_Child)linux+nvidia, report 2:Insufficient frame-time evidence for 1 required comparison(s). See rule results. a step ran out of time at step 2 (wait map HyruleField_Child): timeout: not met in time (then the game was in play on KokiriForest_Child)linux+amd, report 1:Insufficient frame-time evidence for 1 required comparison(s). See rule results. a step ran out of time at step 2 (wait map HyruleField_Child): timeout: not met in time (then the game was in play on KokiriForest_Child)What was tested
What will be tested · AI plan (
gpt-6.1-terra)Compare PR head with main in headless Hyrule Field on Windows NVIDIA with at least 6 GB VRAM, Linux NVIDIA, and Linux AMD. Two runs per side measure FPS and frame-time p99 with the requested uncapped settings, compare a field image, and check for crashes or hangs. Lower FPS, higher p99, a crash, a hang, or a significant image difference fails the check; each tester's runs take about 22 minutes.
kokiri-start(settings vsync=2, frame_rate_cap=6, frame_generation=0), then teleport to Hyrule Field, take the picture field to compare with main, measure field for 20 s (after 5 s warm-up); 2 runs on each side.Measurements on `windows+nvidia+vram-ge6gb`, for the PR description
Verdict: fail on windows+nvidia+vram-ge6gb (2 reports):
field-headless field.fps_mean.min_delta_pct (-0.1%)failed.Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu
NVIDIA GeForce RTX 3080 Ti, 621.24.0AMD Ryzen 9 5900X 12-Core Processor, 64 GB RAM; 2: windows+nvidia+nvidia-proprietary+dgpuNVIDIA GeForce RTX 4070, 616.56.0AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAMScene: field-headless, from the repository's save kokiri-start (vsync=2, frame_rate_cap=6, frame_generation=0); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); field-headless: 2 game starts a side, field 20 s after 5 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)f1f2dc59391932Flags and settings
None: the plan varied no setting, switch or build option.
As Markdown for the PR description:
Measurements on `linux+nvidia`, for the PR description
Verdict: could not be judged on linux+nvidia (2 reports): required frame-time comparison inconclusive (fewer than two usable starts per side).
Hardware: 1: linux+nvidia+nvidia-proprietary+dgpu
NVIDIA GeForce RTX 5070, 620.70.6AMD Ryzen 5 9600X 6-Core Processor, 32 GB RAM; 2: linux+nvidia+nvidia-proprietary+dgpuNVIDIA GeForce RTX 5080, 620.73.4AMD Ryzen 7 7800X3D 8-Core Processor, 32 GB RAMScene: field-headless, from the repository's save kokiri-start (vsync=2, frame_rate_cap=6, frame_generation=0); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); field-headless: 2 game starts a side, field 20 s after 5 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)Nothing was measured: no metric came back.
Flags and settings
None: the plan varied no setting, switch or build option.
As Markdown for the PR description:
Measurements on `linux+amd`, for the PR description
Verdict: fail on linux+amd (2 reports):
field-headless field.fps_mean.min_delta_pct (-1.1%)failed.Hardware: 1: linux+amd+radv+dgpu
AMD Radeon RX 580 Series (RADV POLARIS10), 26.2.7AMD Ryzen 5 5500F 6-Core Processor, 32 GB RAM; 2: linux+amd+radv+dgpuAMD Radeon RX 9070 (RADV GFX1201), 26.0.8AMD Ryzen 7 5800X 8-Core Processor, 32 GB RAMScene: field-headless, from the repository's save kokiri-start (vsync=2, frame_rate_cap=6, frame_generation=0); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); field-headless: 2 game starts a side, field 20 s after 5 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)f1f2dc59391932Flags and settings
None: the plan varied no setting, switch or build option.
As Markdown for the PR description:
The testers' hardware
windows+nvidia+vram-ge6gbNVIDIA GeForce RTX 3080 Ti, 621.24.0AMD Ryzen 9 5900X 12-Core Processor, 64 GB RAMwindows+nvidia+vram-ge6gbNVIDIA GeForce RTX 4070, 616.56.0AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAMlinux+nvidiaNVIDIA GeForce RTX 5070, 620.70.6AMD Ryzen 5 9600X 6-Core Processor, 32 GB RAMlinux+nvidiaNVIDIA GeForce RTX 5080, 620.73.4AMD Ryzen 7 7800X3D 8-Core Processor, 32 GB RAMlinux+amdAMD Radeon RX 580 Series (RADV POLARIS10), 26.2.7AMD Ryzen 5 5500F 6-Core Processor, 32 GB RAMlinux+amdAMD Radeon RX 9070 (RADV GFX1201), 26.0.8AMD Ryzen 7 5800X 8-Core Processor, 32 GB RAMWIP: perf(vk): the mesh-draw scan looks each op's kind up in a tableto perf(vk): the mesh-draw scan looks each op's kind up in a table@Beanstalk the same comparison headless instead of windowed, so Linux can run too: this PR's head against main, Hyrule Field from the load (the camera need not turn during the measure step),
frame_rate_cap = 6(Uncapped),vsync = 2(Off),frame_generation = 0, 2 runs a side, on Windows NVIDIA with 6 GB of VRAM or more, Linux NVIDIA and Linux AMD. Report fps, frame time p99 and any crash or hang per side; a crash, hang, lower fps or higher p99 fails the no-loss check. The replay still runs headless, which is what this change touches.@Beanstalk test it anyway (the headless alternative on Windows NVIDIA, Linux NVIDIA and Linux AMD is what this PR needs)
Recommendation: Request changes. The lookup preserves the current command classifications, but the new test can pass using a different initializer from the one the renderer compiles. The earlier Windows runs show a lower scan sample share. The gain still needs confirmation against the current base.
The renderer classifies each command with a bounds check and a byte lookup instead of walking a 37-opcode list. This reduces recording work for players using native mesh batching. The runtime addition is a 256-byte static table, with no new allocation or player setting. The test adds a partial C++ preprocessor that can give false confidence about which table it checks.
@fixwill do (6)tests/test_mesh_conv.py:75: The source cutter can silently select the inactive configuration. (more on the line)tests/mesh_conv_test.cpp:284: Thepast_passvariant first fails atNOP_COUNT_, which is inside the 256-entry table. (more on the line)tests/mesh_conv_test.cpp:304: The fixture queries out-of-range opcodes but constructs every table from in-range opcodes. (more on the line)mesh_args_rewritethe RADV compute fallback and says RADV never scans. That function gates a separate argument-rewrite mode. Automatic RADV skips the scan throughdev.mesh_shader, while forced native on a supported RADV device can reach it. Describe the two gates and qualify the RADV and Deck statement with Automatic mode.For the author (2) (a run, a measurement or a decision)
Checks: Still running:
CI / Website build and checks (pull_request),PR description / Description follows the template (pull_request_target),CI / Conventional Commit title (pull_request),CI / Workflow lint (actionlint) (pull_request),Guide screenshots / Guide images and local UI source review (pull_request),Third-party parts / As their notes say (pull_request).More: does it help, other systems, switches, what was read
Does it help: Unproven on the current head. On the author's Windows RX 9070 XT system, three sampled runs per side attributed 2.30–2.65% of render-thread samples to the old scan and caller versus 0.62–0.74% to the new inlined scan and caller. Three unsampled pairs reported median 85.24 → 90.34 fps and p99 frame time 17.7 → 16.7 ms. Those runs compared
87c0d7b4with4c4583b0. Current basef1f2dc5bcontains subsequent renderer and host changes. The summary lacks the per-run spread and the render-thread CPU time per frame needed to verify the claimed 0.2 ms saving.Other systems: The scan runs when the recording uses mode 2, the device uses native mesh shaders, and argument rewriting is off. That includes eligible Windows and Linux configs, including RADV when native shaders are explicitly forced. Automatic RADV and Steam Deck use compute and skip the scan. The table is shared read-only and adds no GPU buffers or synchronization. Replay waits, registration order, ring allocation and draw conversion follow the existing paths. No host API, shader cache, save, audio, input or installer changes.
Switches: None added, changed or removed. RX_VK_MESH_CONV still defaults to 2 and retains the device and argument-rewrite gates. Modes 0 and 1 bypass the scan. The table lookup needs no separate switch.
Reviewed:
9391932ee7againstf1f2dc5bd2: Read AGENTS.md, CONTRIBUTING.md, the PR template and developer standards. docs/review-checklist.md is absent. Read mesh_conv.h, mesh_conv_test.cpp and test_mesh_conv.py in full. Read the changed vk_replay.cpp routine, both scan call sites, replay entry and scan statistics in context. The rest of vk_replay.cpp was skimmed for dependencies. Traced opcode definitions, command recording, mesh conversion and device policy, and inspected the source cutter, compiler selection and changed commits. The PR description supplies the run summaries. No run artifacts, translations or generated files changed.; nothing run (a code review).Checked and fine:
Testing: Read-only review. git diff --check produced no output. The author reports GCC passes on Windows and Linux and an existing Clang error in the fallback fixture that prevents the new model from running on the current base and head. The supplied CI snapshot has six checks pending and no head-only failures. No independent runs were performed.
Overlaps and merge order: #1846 introduced the batching path. #1946 is already in the base and its fallback fixture is retained. No open overlap or merge-order dependency surfaced in the supplied material.
Automated code review by BeanBot (gpt-6.2-sol), on the pull request's opening. Nothing was run; a maintainer decides.
@ -266,0 +281,4 @@// (kind_of, or a broken one: table_shift, past_pass)mesh_conv::OpKind kind_tested(const mesh_conv::Ops& ops, uint32_t op) {if (variant == "table_shift") return mesh_conv::kind_of(ops, op + 1);if (variant == "past_pass" && op >= NOP_COUNT_) return mesh_conv::OpKind::Pass;L2 (minor): The
past_passvariant first fails atNOP_COUNT_, which is inside the 256-entry table. It demonstrates an unlisted entry being answered Pass, while the description says it demonstrates an opcode beyond the table being answered Pass. Start this variant atkOpTableso the failure checks the claimed boundary.@ -266,0 +301,4 @@return true;}// (made in a constant expression, as the replay's `static constexpr` Ops is: the model fails to build if it cannot be)constexpr uint32_t const_ops_list[] = {PASS_OPS};L3 (minor): The fixture queries out-of-range opcodes but constructs every table from in-range opcodes. Removing either range check in
make_opswould leave these cases green. Add constexpr cases that supplykOpTableas a pass opcode and as the draw opcode, then verify it stays Stop and a valid entry still classifies correctly.@ -37,0 +72,4 @@elif re.match(r"#\s*endif", d) or (depth == 1 and re.match(r"#\s*(?:else|elif)\b", d)):depth -= 1line = ""elif re.match(r"#\s*if\s+0\b", d):L1: The source cutter can silently select the inactive configuration. With the live initializer in
#if 0 || 1and a correct copy in#else, the compiler uses the first initializer whilelive_codediscards it and the test checks the copy. An off-by-one pass-list count in the live initializer can therefore escape the test. Compile the same configuration the replay consumes, or reject conditional declarations the extractor cannot resolve. Cover a case where the inactive copy is correct and the live initializer is wrong.@fix
I didn't fix this pull request: docs/user/images/guide/settings-graphics.png isn't a UTF-8 text file. Nothing was pushed.
Automated fix by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@fix
I didn't fix this pull request: it failed (Codex didn't finish with an answer (exit 1)). Nothing was pushed.
Automated fix by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@fix
The ChatGPT usage limit is reached (it resets Nov 25th, 2026 1:04 AM), so this fix is paused. It runs by itself once the limit lifts (tried again every 30 minutes); nothing needs asking again.
Automated fix by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@fix
I changed this pull request where an edit could (the rest needs runs, measurements or decisions): the new head is
f432bd1df8. I edited the pull request's description too (3 edits).Changed
Not done this time (still open: the next
@fixtakes it)Left for the author
Still for the author (no edit does these)
Nothing was built or run: check the change. Its review follows.
Automated fix by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
Recommendation: Request changes. The table preserves the scan’s classifications, and the reported samples show less scan work on the tested PC. A current-base comparison and affected hardware results are still needed to establish the player-facing gain and coverage. (It stands on L8: The check
Guide screenshots / Guide images and local UI source review (pull_request)fails on this head and passes on the base branch: Failing after 10s.)The native mesh batching scan replaces a linear opcode search with a compile-time lookup table. It simplifies each lookup at the cost of a small static table; the latest commit strengthens the test’s extraction and boundary checks.
@fixwill do (4)Guide screenshots / Guide images and local UI source review (pull_request)fails on this head and passes on the base branch: Failing after 10s.CI / Website build and checks (pull_request)fails on this head and passes on the base branch: Failing after 21s.For the author (2) (a run, a measurement or a decision)
Since the last review (on
9391932ee7)Resolved: L1 (The source cutter can silently select the inactive configuration. With the live initialize…); L2 (The
past_passvariant first fails atNOP_COUNT_, which is inside the 256-entry table.…); L3 (The fixture queries out-of-range opcodes but constructs every table from in-range opcodes.…); L6 (The hardware summary callsmesh_args_rewritethe RADV compute fallback and says RADV nev…)Still open: L4 (Repeat the comparison on the current base and final PR head. The old pair predates the fal…); L5 (The affected Tier 1 native configurations still need results. An Automatic Linux AMD run o…); L7 (The updated Testing section says no Beanstalk request is recorded, but the supplied commen…)
New: L8 (The check
Guide screenshots / Guide images and local UI source review (pull_request)fai…); L9 (The checkCI / Website build and checks (pull_request)fails on this head and passes on…)More: does it help, other systems, switches, what was read
Does it help: Unproven on the current base and final head. On an earlier pair, the reported scan share of render-thread samples fell from 2.30–2.65% including its caller to 0.62–0.74%; the claimed approximately 0.2 ms per frame is not supported by reported absolute render-thread times. Median FPS was 85.24 versus 90.34 across three pairs, but the author does not claim that difference as the gain.
Other systems: The changed scan runs on eligible native mesh-shader recordings. Automatic RADV and Steam Deck configurations use the fallback and skip it; supported RADV devices forced to native mode can reach it. Windows and Linux NVIDIA, AMD native coverage, and a slower CPU still need the comparisons described in L5.
Switches: None added, changed or removed. Existing RX_VK_MESH_CONV modes 0 and 1 disable batching and its scan; mode 2 enables it where the other gates permit.
Reviewed:
f432bd1df8againstf1f2dc5bd2: Read AGENTS.md, CONTRIBUTING.md, the pull request template, mesh_conv.h and test_mesh_conv.py, and the supplied description, comments, CI and ledger. Reviewed the diffs and relevant mesh_conv_test.cpp and vk_replay.cpp sections; the large replay file and surrounding callers were skimmed. The review checklist file was absent; the network and adjacent Tooling instructions were unavailable.; nothing run (a code review).Checked and fine:
Testing: No code or tests were run during this read-only review. The author reports matching Windows game results and GCC fixture passes; the reported Clang fixture failure also occurs on main. Two head-only CI failures are supplied separately and are not restated as review items.
Overlaps and merge order: none found
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
Beanstalk test farm
Commit
a6ef02b· approved by nobody yet · dashboardA member of
BigBeanscan review this commit and comment@Beanstalkto test it.@fix
I changed this pull request where an edit could (the rest needs runs, measurements or decisions): the new head is
c7883df9b1. I mergedmain(fd7dc40db0) into it, as it has merge commits. I edited the pull request's description too (1 edit).Changed in part (the rest is for the author)
Not done this time (still open: the next
@fixtakes it)Left for the author
Still for the author (no edit does these)
Nothing was built or run: check the change. It will be reviewed again.
Automated fix by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
Recommendation: Wait. The sampled scan cost fell on the author's Windows AMD system, but the claimed per-frame saving has not been established against the current base and final head. The remaining hardware comparisons are also needed before merge.
The mesh-draw scan replaces a linear opcode search with a compile-time lookup table, reducing work on the native mesh path while preserving the existing batching behavior. The cost is a small fixed table and test complexity.
@fixwill do (2)For the author (2) (a run, a measurement or a decision)
Since the last review (on
f432bd1df8)Resolved: L8 (The check
Guide screenshots / Guide images and local UI source review (pull_request)fai…); L9 (The checkCI / Website build and checks (pull_request)fails on this head and passes on…)Still open: L4 (Repeat the comparison on the current base and final PR head. The old pair predates the fal…); L5 (The affected Tier 1 native configurations still need results. An Automatic Linux AMD run o…); L7 (The Testing section reports 75 identical failures on the branch and main but does not incl…)
More: does it help, other systems, switches, what was read
Does it help: Unproven against the current base and final head. On the earlier measured builds, the scan and caller fell from 2.30–2.65% to 0.62–0.74% of render-thread samples; absolute render-thread time per frame and a matched current-base comparison are missing.
Other systems: The scan runs on eligible native mesh-shader recordings, including forced native mode on supported RADV devices. Automatic RADV and Steam Deck use the compute fallback; Windows and Linux NVIDIA, slower CPUs, and AMD native and fallback coverage remain outstanding.
Switches: None added, changed or removed. RX_VK_MESH_CONV continues to control the existing batching path.
Reviewed:
c7883df9b1againstfd7dc40db0: Read the supplied description, comments, CI and ledger; repository rules and PR template; the diff and relevant mesh conversion and test code. The large combined file output was truncated, so the full changed files and all dependent code were not read in full. No review checklist was present at docs/review-checklist.md.; nothing run (a code review).Checked and fine:
Testing: No commands from the project or tests were run. The author reports paired game runs, GCC fixture passes, and a Clang fixture failure also present on main; the requested farm runs have no recorded results.
Overlaps and merge order: Not checked; network access is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
Recommendation: Request changes (description only). The code is right and I would approve it as it is: it classifies every opcode exactly as the old walk did, the cost it removes is measured, and it can't act differently on another GPU, driver or OS. What has to change is the description. The
mise run testbox is unticked and the 75 shared failures aren't listed, so the template check fails.For players on the native mesh path (the default on any GPU with mesh shaders), the render thread spends a little less time recording each frame. The scan after each barrier now finds an op's kind with one bounds check and one byte read, not a walk of a 37-entry list. The code comes out a little simpler. It costs a 256-byte table, built at compile time, and nothing else.
Does it help: Yes, as a CPU cost, with no player-visible fps change shown and none claimed. Sampled runs, 3 a side, on a Ryzen 7 5700X3D with an RX 9070 XT under Windows: the scan and its caller fell from 2.30-2.65 % of render-thread samples to 0.62-0.74 %. The two ranges don't overlap, which puts the saving at about 1.7 % of the render thread. The author's +6 % fps (85.24 → 90.34, 3 pairs) is rightly not claimed, since it is more than 0.2 ms can explain. The farm run on
9391932shows nothing past the noise either way:The fps rows are "no loss", not a gain, and the PR says so.
Why the farm run says "failed": the farm, not this PR.
field-headlessscenario's teleport timed out at "wait map HyruleField_Child" (the game was still in Kokiri Forest). That happened on both sides: on Linux NVIDIA, for example, the report has 0 usable starts for main and 0 for the PR. It happened on four of the six reports.min_delta_pctlimit of 0.0 on fps, which any noise trips: −0.1 % on Windows NVIDIA, and −1.1 % on RADV, where the changed code doesn't run.Other systems:
mesh_conv_batching()returns first).Switches: none added, changed or removed.
RX_VK_MESH_CONVkeeps its default of 2, and modes 0 and 1 still skip the scan. A plain speed-up needs no switch, so that is right.Reviewed:
a6ef02b3, against mainfd7dc40d(BeanBot's merge of main). The PR's own diff is identical to the one onf432bd1dagainstf1f2dc5b.gpu/vk/mesh_conv.h(theOpKind,Ops,make_opsandkind_ofchanges, andscan(), which uses them),mesh_conv_at_barrieringpu/vk/vk_replay.cpp,tests/mesh_conv_test.cpp's diff and the model it drives, andtests/test_mesh_conv.py's diff.Fixed in this review:
a6ef02b3, pushed toperf/mesh-scan-op-table. The test's docstring said main "fails there", at the overwritten-list check. Sincef432bd1dadded the boundary fixtures, which callmake_opsandkOpTabledirectly, main's header no longer builds the model at all, so main now fails sooner. The docstring says so now. The same sentence in the description's Checks ("main fails there ("kind_of walks the list at each op: no table")") is stale for the same reason; that one is the author's to change.Checked and fine:
NOP_DRAW_MESH, as the walk asked it first.kOpTable, at build time and at lookup. That is the safe side: a rescan, never an early conversion.NOP_COUNT_ <= kOpTableis checked bystatic_assert.rx_nvn.hhas far fewer than 256 ops.OpKindmoved Stop to 0, and nothing outsidemesh_conv.hand the test uses its values (grep).static constexprgives a compile-time table: no per-call build and no guard on a function-local static.constexprloops need only C++14.kind_ofwith the old walk for 0..4096, high-bit opcodes and huge values, on the replay's own initializer (cut from live code, now rejecting preprocessor directives). Its two new broken variants exercise the shift and the past-table boundary.anyOps in the test was unused.fd7dc40d: betweenf1f2dc5bandfd7dc40dthe only change tovk_replay.cppis the Sprint Toggle's option line (frome6196f0f).Guide screenshotscheck fails on mainfd7dc40d's push as well, so it isn't this PR's.Blocking (to change before merge; all in the description)
mise run testpasses (any failure that also fails onmainis named). Testing gives 776 passed, 75 failed and 54 skipped on both sides, with "the failing files are identical", but it doesn't name them. List the shared failing files (or attach the pairedrun_allsummaries) and tick the box.pr statusand the "PR description" check fail on this alone.Suggestions
f1f2dc5b" line could namefd7dc40d(the base after BeanBot's merge). Its reasoning still holds there, as checked above. That would also clearpr status's "measured on main87c0d7b4" warning, which asks for exactly that sentence.Testing:
9391932couldn't be judged (the scenario's teleport timed out on both sides) and showed no crash.Guide screenshotsfails on main too. Website build was still pending when I looked.Overlaps and merge order: none found. Among the open PRs, about twenty others touch
vk_replay.cpp. None of them changesmesh_conv_at_barrier,pass_ops,mesh_conv.hor its tests. #2028'scollect_kind_ofis an unrelated function with a similar name.Recommendation: Approve. The code classifies every opcode exactly as the old walk did. The CPU time it saves is measured, and it can't behave differently on another GPU, driver or OS. The description blocker from my last review is resolved.
Re-review:
a6ef02bhas the same code as my last review. Only the description changed:mise run testbox is ticked, on the author's report that the failing files are the same on this branch and onmain. I accepted that as the maintainer, since the list wasn't kept.fd7dc40d. Sincef1f2dc5b, nothing touchesmesh_conv.hor the scan. The only renderer change is the FPS counter footer's route record, which runs only while that footer is shown.Does it help: Yes, as CPU time. The scan's share of render-thread samples fell from 2.30-2.65 % to 0.62-0.74 %, 3 runs a side on an RX 9070 XT. No fps gain is claimed.
Testing: the farm run on
9391932couldn't judge the change: the scene's teleport timed out on main as well. It showed no crash. An NVIDIA run is still wanted, but it doesn't hold the merge, because this CPU code is the same on every vendor.