- docs/RESEARCH-CORE-PROCESSING.md: the per-frame budget by thread; the sweep every 1.5 s on the submitting thread as the source of nine tenths of the card's idle time behind it; rep movsb's weak case timed on this processor; thread priorities that are not applied under this runtime; ten changes in order - docs/RESEARCH-SHADERS-RDNA2-RDNA3.md: a census of the translated set; the wave32 fault on every RDNA generation; the exact port of the records pair to the records' copy; mesh groups of 128 as the largest unsized item; the contents of one translator bump (cherry picked from commit 724dd8edf48730ac4d7e82f8e30b8f35d9dfe376)
65 KiB
The shader pipeline on RDNA 2 and RDNA 3: what to change, with the evidence
Status: research, 2026-12-04, against main at ac988f8 (read in the frozen checkout). Nothing was built, no
game was run, no test was run. It reads the translator (crates/victory-shader), its users in victory-gpu,
apps/victory/src/warm.rs, the pinned Mesa 26.3.1 and vkd3d-proton as built under deps/, the record
(docs/ARCHITECTURE-PERF.md), the fork's issues 8, 13, 16, 17 and 21, upstream's commits, the logs under
local/run, and the caches under local/cache. It builds on RESEARCH-WEAK-POINTS-AND-OPPORTUNITIES.md
(branch research-weak-points) and does not repeat it.
Conventions:
[inference]marks what was neither measured nor read in source.- "Computed here" means a count made for this report from files that are there. Section 10 says how each was
made. The scripts were throw-away (
/tmp/census), not in the tree. - "The census" is a count over all 25,790 translated shaders of the newest set in
local/cache/shaders(the files of 2026-12-03, translator buildf02c22b5…,TRANSLATOR_VERSION10, default settings). The fork's writer emits unabbreviated bitcode (emit/bitcode.rs:684-1040), so a short reader counts instructions and calls exactly. It counts sites in the DXIL, after the fork's own clean-up passes. It does not count what RADV makes of them, and it does not weigh a shader by how often it runs: no release log has that. - "The console census" is a count over the 25,790 console containers in
local/cache/pipelines/known-shaders.bin, read with the layout innative.rs:1-70. - Mesa paths are under
deps/mesa/, vkd3d-proton paths underdeps/vkd3d/, code paths under the repo root. - "Needs a bump" means the change alters the DXIL of shaders at default settings, so
TRANSLATOR_VERSIONmust move and every user runs./run.sh shadersand./run.sh warmonce.
1. In short
- The translator is not where a large part of the frame can be won today by reading alone. The record sized the record chain at 0.1 to 0.67 ms a frame for dispatches (section 10 of the record). Nothing found here lifts that bound with a measurement. What can be said with evidence is which changes are right, which are free in one bump, and which need one measurement first.
- The wave32 bug is real on this fork and on every RDNA generation. RADV runs every pixel program in waves
of 64 on GFX10.3, GFX11 and GFX12 (
radv_physical_device.c:2838-2849). 1,123 of the title's 12,069 pixel programs are compiled for waves of 32 (console census). No vertex and no mesh program is. - In pixel programs 39 % of all raw buffer loads are record bookkeeping (the record, the table's row, the
probes), 22 to 31 % in the other stages (census). Mesh programs carry ranges (11 table rows a program at
the median), pixel programs carry slots (11 hashed slots a program at the median). So
VICTORY_RECORD_RANGESis the one for mesh draws andVICTORY_RECORD_PLACESthe one for pixel programs. VICTORY_RECORD_PLACESremoves instructions and no load. The floor rows of the record size a removed load level. They do not size the places. The 0.1 to 0.67 ms of the record belong to the ranges alone.- Every mesh program of the title is a group of 128 threads that declares 128 vertices and 128 primitives
(console census). The translator always tells the host 128 and 128 and culls unused primitives as
triangles of no area (
lower.rs:7001-7067, with a note in the source that says so). A frame asks for 41,000 to 45,000 such groups. No floor row has a group like it. This is the largest unsized item. - No host pipeline is compiled in play on this route. Of the 396 pipelines first bound on a drive, all were made before the go mark. vkd3d-proton can compile late for 44 of the 99,326 known pipelines only. So the first binds found in long frames are not compiles [inference for "so"].
- RDNA 2 has no FSR 4.1: RADV gives cooperative matrices from GFX11 up, and vkd3d-proton needs them for the upscaler's matrix operations. The fork refuses any other provider. That is what issue 17 asks about.
local/cache/shadersholds 13 sets of translations, 17.2 GB, of which one set (1.3 GB) is in use.
The changes, ranked (section 7 has each in full):
| # | Change | Needs a bump |
|---|---|---|
| 1 | e5243e4 with f0fc990: wave32 lane numbers and masks |
yes |
| 2 | 36df108: record, table and directory loads are pure for reuse |
yes |
| 3 | 47f5223 with ca165e7: the legacy multiply in the form Mesa makes one instruction of |
yes |
| 4 | da45c04 and 8b4ec00: parity with upstream |
yes |
| 5 | The version line split: upstream's number as it is, a fork revision beside it | in the same bump |
| 6 | The records pair, ported: 34b9685, e09d42e, 18eab93; off by default |
no (a key of its own when set) |
| 7 | FSR 3.1 where there is no FSR 4.1 (the provider part of cacaae1), for RDNA 2 |
no |
| 8 | isa_probe with set_records_copy, and a tool that cuts a container out of the book |
no |
| 9 | Mesh groups: two floor rows first, then the cull flag or the program's own counts | yes if built; behind a switch until measured |
| 10 | The early depth test wherever the title asks (b97c80a), behind a switch, off | no while off |
| 11 | Old sets of translations and pipelines removed after a good shaders and warm |
no |
| 12 | The depth format learned for the 44 pipelines vkd3d-proton compiles late | no |
| 13 | A release line for first-use waits; a seed for the early list | no |
| 14 | The bounds check of a raw access in three instructions where four | yes; only with an instruction count first |
Today's single bump, in order: 36df108, 8b4ec00, da45c04, 47f5223, ca165e7, e5243e4, f0fc990, then the port
of 34b9685, e09d42e and 18eab93 (off by default), then one commit that sets the version (section 8).
Decided here, since nobody answers today: what upstream runs by default goes on by default; what has no
measurement (records pair, early depth, mesh) lands behind switches that are named in the key only when set.
The cost of that choice: making one of them the default later is one more pass of shaders and warm for
every user. It can be avoided only by one measured run with the switches set before the bump is pushed.
2. What the translator emits, and what it costs on the card
The frame, from the record
- A frame is about 12,000 small pieces in a row: 2,860 dispatches at 6.6 microseconds, 8,150 mesh draws at 1.9, 1,350 ordinary draws at 2.9 (record, section 1; stamped run, each time with a wait behind it).
- The card is busy 98 % of the time and not full (weak-points report, section 3).
- On the floor a dispatch that waits costs 0.42 microseconds with its barrier and 0.04 without. A record chain adds 0.49 behind a barrier and nothing measurable without one. A title dispatch behind a waiting barrier takes 11.5 to 13 (record, sections 6, 9 and 10).
- 560 to 830 dispatches a frame stand behind a waiting barrier (record, sections 6 and 9).
The size of the translated set (census)
| Stage | Programs | Results a program: median, mean, 9 in 10 under, most | Console wave size |
|---|---|---|---|
| Vertex | 2,193 | 655; 1,637; 3,836; 18,511 | all 64 |
| Mesh | 8,765 | 2,566; 3,492; 7,170; 24,264 | all 64; all groups of 128 threads, 128 vertices, 128 primitives |
| Pixel | 12,069 | 2,350; 5,101; 15,067; 30,877 | 1,123 of 32; 10,946 of 64 |
| Compute | 2,763 | 6,798; 20,332; 63,311; 134,629 | 1,573 of 32; 1,161 of 64 (29 in another container form not read) |
A "result" is an instruction that makes a value (stores, branches and calls without a result are left out). The set has 151.9 million of them.
Record chains
What is lowered (lower.rs):
- A descriptor at a fixed place of a table gets its handle in the entry block, once a wave
(
handle,:11827-11855;fixed_locator,:11972-12002). So the loads that are uniform for a draw are hoisted already. - The record: one load of 16 bytes at the locator (
record_load,:12055-12069). The fork first reads the row that says where its copy of the heap is (records_copied,:12075-12094; the row once a program, in the entry block) and redirects the locator with a subtract, a compare, an add and a select. - A buffer read as raw bytes: the record, then a row of the table of ranges, then the descriptor of the
2 GiB chunk the range lies in, then the data (
record_range,:12114-12172;address_view,:12275-12307). About 33 instructions between the record and the row's use [counted in source]. - A texture or typed buffer: the record, a hash of its key (16 instructions, six multiplies), two probes of
the table of slots, then the view (
record_slot,:12192-12242). - Every raw access through a range is bounds-checked:
at()(:12322-12336) emits an add of the base, an add of the reach, an unsigned compare and a select.
What the census counts, per stage:
| Vertex | Mesh | Pixel | Compute | |
|---|---|---|---|---|
| Programs with a record load | 1,994 | 8,765 | 11,622 | 2,706 |
| Record loads: all; median of a program that has any; 9 in 10 under | 15,900; 6; 18 | 114,584; 12; 25 | 289,013; 17; 62 | 184,431; 25; 184 |
| Loads of table rows (one of them the copy's row): all; median | 14,854; 6 | 100,411; 11 | 116,482; 9 | 105,379; 12 |
| Probes of the table of slots: all; median (two a slot) | 6,080; 4 | 45,876; 2 | 368,306; 22 | 163,644; 32 |
| Slots found by hashing | 3,040 | 22,938 | 184,153 | 81,822 |
| Raw buffer loads, all | 150,916 | 1,203,466 | 1,993,533 | 1,487,631 |
| of them through the three handles of the records (record, row, probe) | 24.4 % | 21.7 % | 38.8 % | 30.5 % |
| The hash's share of all results (16 a slot) | 1.4 % | 1.2 % | 4.8 % | 2.3 % |
Bounds checks of at() |
95,314 | 747,507 | 1,167,852 | 957,294 |
Reading:
- The chain is the same for a draw as for a dispatch. A mesh program resolves about ten ranges and one slot, a pixel program about eight ranges and eleven slots (medians).
- What the floor measured is the latency of loads that wait for each other behind a barrier: 0.19 to 0.20
microseconds for one level less (
floor_records: range 0.911 to 0.717; record, section 10). The levels of a chain run beside each other, so the saving is per level, not per chain. - The fork's chain is one level longer than upstream's at its head: the copy's row is read before the record. The same line every time, in card memory: 0.01 microseconds as a load (record, section 6), but the record's load waits for it [inference for the wait's cost: not on the floor].
- Draws were never sized: back to back the floor shows no cost of a chain (record, section 10).
Memory by address (the page directory)
global_load_*,global_store_*,global_atomic_*ands_load_dword*by address go throughmemory()(lower.rs:4704-4802): a clamp, a load of the directory's entry (8 bytes), a mask, a branch with a store that notes a missing page, a handle made with the non-uniform flag always set (:4793-4795), then the load.- Census: 49,758 raw loads through non-uniform handles in compute programs (3.3 % of their raw loads), 108
in pixel and 47 in mesh programs. They sit in at most 1,190 compute programs. These are the ray tracing
and structure-builder programs. With
VICTORY_BVH_BUILDER=0(this PC) they do not run [inference]. - RADV takes the non-uniform flag off again where the index does not differ between lanes
(
radv_pipeline.c:329-331;src/compiler/nir/nir_opt_non_uniform_access.c:257-287, by divergence analysis). What stays non-uniform becomes a loop over the lanes' values (radv_pipeline.c:334-340).
Wave and lane operations
- Compute: the program declares the console's wave size, lanes are the console's (
MaskData::Console,lower.rs:735-739). vkd3d-proton passes a declared size on as the required subgroup size (libs/vkd3d/state.c:3220-3266). - Pixel and vertex: no size can be declared in D3D12, so masks are ballots of the host's wave
(
MaskData::Host,lower.rs:740-745,:2705-2709).waveActiveBallotgives two dwords (mask_dword,:5596-5600). - Mesh: lanes come from the thread index, no wave is assumed (
lane_index,:7109-7116). - Census, pixel programs:
waveGetLaneIndexin 1,065,waveActiveBallotin 1,156,waveReadLaneAtin 1,051,waveReadLaneFirstin 4,901; the wave-operations flag in 8,756 (most for quad reads).
Quad reads, kills, 64-bit maths, the node test
| What | How it is lowered | Census |
|---|---|---|
Quad reads (dpp quad_perm, the console compiler's derivatives) |
quadReadLaneAt for one lane, quadOp across x, y or the diagonal, selected by the lane's place in its quad (quad_read, lower.rs:7183-7240). VICTORY_QUAD_GUARD doubles each read to tell a neighbour that did not run the block; off by default (:33-40) |
99,538 reads in 6,114 pixel programs, 15 at the median |
| Kill | discard and return; with VICTORY_KILL_CONTINUE=1 a discard and a branch on (emit/mod.rs:157-173) |
14,232 in 7,405 pixel programs |
| 32 x 32 to the high dword | extend to 64 bits, multiply, shift, truncate (mul_hi, lower.rs:6017-6028) |
the 64-bit flag in 6,674 programs |
| Legacy multiply (0 times anything is 0), on an RDNA host | min(abs(a), abs(b)) == 0 ? 0 : a * b, which Mesa makes one fmulz of (src/compiler/nir/nir_opt_algebraic.py, "Optimize open-coded fmulz"; ac_nir.c:107); or, where one factor is known finite, a test of that factor alone (legacy_mul, lower.rs:6067-6093) |
4,063,506 in the first form (16 % of all results, one instruction each on the card); 520,092 in the second, in 16,522 programs |
| Legacy fused multiply-add | three flushes of subnormals, the fused operation, two compares, an or, an add, a select (legacy_fmad, :6130-6143) |
16,499 in 3,866 programs |
| The node test | on a card that has it, one call that vkd3d-proton and RADV make image_bvh64_intersect_ray of (intersect.rs:535-573; patches/vkd3d.dxil-spirv.patch; patches/mesa.patch:3042-3063); else inline code |
not counted (ray tracing only) |
Mesh programs
- The console program is one NGG stage. Lane n exports vertex n and primitive n. One lane sends the counts
(
io.rs:25-32). - The translator calls
setMeshOutputCountswith the declared maxima, in the entry block. Each lane first emits its primitive as indices 0, 0, 0. At the export it emits the real indices, or 0, 0, 0 again where the console sets the cull bit (mesh_prologue,lower.rs:7001-7067;emit_indices,:18198-18249). - The source says of it: "this costs the host the unused vertex and primitive slots. Pass the program's own
counts if that shows in frame time" (
lower.rs:6995-6999). - All 8,765 mesh programs: 128 threads, 128 vertices, 128 primitives (console census). None has a per-primitive part or a cull output in its container, so the title culls with the export alone.
- Groups asked for a frame: 44,868 on the walk and 41,102 on the drive at the median in
play-20261204-002052, 42,629 and 40,962 in-002810(theindirect mesh dispatchesline). So the host is promised about 5.5 million primitive slots a frame. How many are real is not known: the counts are run time values. - RADV picks waves of 64 for these (a group over 32 threads takes
ge_wave_size,radv_shader.c:395-419), two waves a group as on the console. - The floor's mesh row is a group of one thread with 3 vertices and 1 primitive
(
indirect/floor.rs:1836-1852): 0.198 microseconds a draw. It says nothing about a group of 128.
3. The generations
RDNA 2 is GFX10.3, RDNA 3 is GFX11, RDNA 4 is GFX12 in Mesa. Read in the pinned Mesa 26.3.1 with the fork's patch applied.
| Property | RDNA 2 (RX 6000) | RDNA 3 (RX 7000) | RDNA 4 (RX 9000) | Where |
|---|---|---|---|---|
| Wave size by default: compute, pixel, vertex and mesh, ray | 64, 64, 64, 32 | the same | the same | src/amd/vulkan/radv_physical_device.c:2838-2861 |
| A compute or mesh group of 32 threads or fewer | waves of 32 | the same | the same | src/amd/vulkan/radv_shader.c:389-419 |
| A pixel program's wave | ps_wave_size, so 64 |
the same | the same | radv_shader.c:423-428 |
RADV_PERFTEST=pswave32, cswave32, gewave32 |
set the default of that stage to 32; a required size still wins | the same | the same | radv_instance.c:129-131; radv_physical_device.c:2843-2852 |
| A required size for a pixel program in Vulkan | allowed (fragment is in requiredSubgroupSizeStages) |
the same | the same | radv_physical_device.c:2025-2030 |
| What D3D12 passes on | a required size only for compute (WaveSize), or for every stage that uses wave operations with VKD3D_CONFIG=force_minimum_subgroup_size |
the same | the same | libs/vkd3d/state.c:3196-3281 |
| Wave lanes D3D12 reports | 32 to 64 | 32 to 64 (the log's host wave lanes min=32 max=64) |
32 to 64 | radv_physical_device.c:2025-2026 |
| NGG culling in vertex programs | on by default (not on Raphael and Mendocino) | off; RADV_PERFTEST=nggc turns it on |
off | radv_physical_device.c:2823-2828 |
| Mesh shaders | yes, with MEC firmware 100 or newer; else none at all | yes | yes | radv_physical_device.c:67-76; src/amd/common/ac_gpu_info.c:1050-1061 |
| Outputs of vertex and mesh programs | parameter exports | the attribute ring | the attribute ring | ac_gpu_info.c:359 |
image_bvh64_intersect_ray (the node test) |
yes | yes | yes (the opcode of GFX11 carries on; RADV's own ray tracing uses BVH8 there) | ac_gpu_info.c:342; src/amd/compiler/aco_opcodes.py:316-331, :1913-1915; radv_physical_device.c:281-286 |
| Cooperative matrices (what vkd3d-proton needs for FSR 4) | no | yes | yes | radv_physical_device.c:188-192, :696; libs/vkd3d/device.c:2426-2462, :2675-2691 |
| 8-bit floats in shaders | no | no | yes | radv_physical_device.c:926 |
| Buffer barriers without an L2 flush | where the card's cache blocks and render backends agree: holds on the 6900 XT (issue 16) | not on Navi 31 (20 blocks, 24 backends, issue 16): every such barrier empties the L2 unless the fork's mode 2 | always | ac_gpu_info.c:1243-1245; src/amd/vulkan/radv_cmd_buffer.c:7933-7938 |
| A line of the card's L2 | 128 bytes (4 records) | 128 bytes | 256 bytes (8 records) | ac_gpu_info.c:591-593 |
| Legacy multiply and fused legacy multiply-add as one instruction | yes, yes | yes, yes | yes, yes | src/amd/common/nir/ac_nir.c:107-108 |
| A pixel program that writes memory and does not ask for the early test | the depth test after it, and it runs where the coarse test fails | the same | the same | radv_shader.c:2038-2051 |
| Root constants | in registers, up to 32 dwords if registers are free; else loaded from the upload buffer | the same | the same | src/amd/common/ac_shader_args.h:18-20; radv_shader_args.c:25-48 |
| Command and upload buffers in VRAM | if all VRAM is visible, the link is at least PCIe 3.0 x8 and the card is discrete; nosam puts them in RAM |
the same | the same | winsys/amdgpu/radv_amdgpu_cs.c:204-222 |
What the runtime asks of the host, read in the fork:
| Requirement | Where | RDNA 2 |
|---|---|---|
| D3D12 feature level 12.0, shader model 6.6 | crates/victory-shader/src/emit/host.rs:107-157 |
met |
| Mesh shaders at shader model 6.6 | crates/victory-gpu/src/host.rs:3833-3864 |
met with new enough card firmware (above); 34,167 graphics pipelines have a mesh program |
| A view heap of 2,097,152 views | patches/vkd3d.patch (the last hunk); the log's host view heaps hold 2097152 views |
met (the descriptor heap extension is on for every card, radv_physical_device.c:851) |
| Unified memory: an AMD card, resizable BAR on, the patched RADV | crates/victory-gpu/src/um.rs:524, :617, :1177 |
met with resizable BAR |
| The node test by the card: the driver says it has the instruction, then a probe in a process of its own | host.rs:899-910; um.rs:1069-1087; patches/mesa.patch:190-197; host/node_test.rs:1-12 |
available. The probe's own process exists because the probe on the title's device left an RX 6700 XT's scene black (node_test.rs:8-12) |
| An FSR 4.1 provider, or no upscaler | crates/victory-hle/src/modules/fidelityfx.rs:304-360 |
not met: no upscaler |
The translator's RDNA forms (set_host_rdna): AMD and lanes 32 to 64 |
host.rs:891-896 |
on, as on RDNA 3 |
What the three generations share, so that one translation serves them: the wave sizes, the node test, the
legacy forms. The shader cache key is the same on an RX 6900 XT and an RX 7900 XT with the same settings
(host_settings, lower.rs:2035-2043: widest wave, heap limit, raw twins, RDNA forms, node test and
records copy). Pipelines are per adapter and driver (pipeline/known.rs:591-612).
What differs and matters here:
- RDNA 2 has no FSR 4.1 (change 7).
- The floor figures behind a barrier were taken on Navi 31, whose barriers empty the L2. About two fifths of a record chain's cost there is the refill (record, section 6, the pass with mode 2: 0.49 to 0.31). On a card whose barriers keep the L2 (the 6900 XT by issue 16, every RDNA 4) the same chain should cost what the mode 2 column says [inference: no floor pass on such a card]. So a shorter chain is worth most on this PC's card and less on RDNA 2 and RDNA 4.
- On RDNA 2 vertex programs carry NGG culling code by default. The title has 1,350 ordinary draws a frame
against 8,150 mesh draws, and mesh programs are not culled so.
RADV_DEBUG=nonggcwould compare. No report shows a need. - Issue 17 (RX 6900 XT, Ryzen 5900X): it runs, "a few popping shadows", and asks for FSR 3.1. Issue 13 (RX 7800 XT, ray tracing on): 24.4 fps, card busy 99 %, stutter with page faults waited for. With ray tracing on the directory path and the node test run; changes 2 and 4 touch them.
4. Upstream's translator commits that are not here
TRANSLATOR_VERSION is 10 here (crates/victory-shader/src/lib.rs:30) and 20 upstream. Each commit below
was read (git show). "Merges" is issue 21's test (git merge-tree), not repeated here.
| Commit | What it changes in the emitted code | Programs it can touch (census) | Benefit on RDNA 2 and 3; basis | Risk |
|---|---|---|---|---|
e5243e4, f0fc990 |
In a wave32 pixel or vertex program: the lane's own number is taken modulo 32; v_mbcnt_hi adds nothing; s_bcnt1, s_ff1, s_cmp_eq, s_cmp_lg of a mask take both dwords of the ballot |
at most the 1,123 wave32 pixel programs | correctness on both: the same host waves of 64. No frame time | low: on upstream's main since 2026-12-03; tests draw on the host |
36df108 |
Loads of the record, the table's row, the probes and the directory's entry are marked pure, so REUSE gives one load for one place across blocks, also past a store |
every program with a record load (25,087) | fewer loads and less arithmetic behind them where a program resolves one descriptor in several blocks. No figure upstream. Not counted here: the reuse cannot be predicted without running the pass | low: on upstream since 2026-12-02. In this fork the record may be read in the copy: the copy changes only in a round, as title memory does under the title's own writes |
47f5223 |
The legacy multiply with one finite factor is written as min(abs(a), abs(b)) == 0 ? 0 : a * b; its zero is +0 |
520,092 multiplies in 16,522 programs | two instructions less each on the card (a compare and a select after the multiply). Upstream's counts on an RX 7900 XTX: 13,918 to 13,626, 35,684 to 35,217, 3,845 to 3,760, 27,383 to 27,357 in four compute programs: 0.1 to 2.2 % | low; a zero's sign changes to the console's |
ca165e7 |
A legacy multiply-add's zero addend comes out +0 | 16,499 sites | correctness; issue 21 takes it for what the one failing victory-shader test waits for [inference there] |
low |
da45c04 |
The directory's entry is tested for 0 unmasked; a store takes a signed maximum with 0 where a compare and a select | the directory path: 49,758 loads in compute, ray tracing only | one or two instructions a lookup | low; memory.rs gets a test of the host's encoding, which this fork shares (memory.rs:405, :1475) |
8b4ec00 |
User-data rows are loaded once in the entry block by construction | none in effect: the census finds 2 to 3 row loads a program already | none; parity. It removes Lower::user_at and so keeps later picks clean |
low |
34b9685 |
With VICTORY_RECORD_PLACES=1: a texture's two table places are read from words 4 and 5 of its record, not hashed |
291,953 slots: 16 instructions each, 4.8 % of a pixel program's results | upstream on RDNA 4: scalar instructions 636 to 572 (compute), 631 to 550 (pixel), 415 to 401 and 786 to 772 (mesh). One more load, issued with the record's: no level less | a port (below). A wrong or missing texture if the read misses the copy |
e09d42e |
With VICTORY_RECORD_RANGES=1: a buffer's range is read from words 4 to 7 of its record with a check of the key; a constant buffer view is decoded from the record itself; the table's row is not read |
312,039 range lookups (table rows less one copy row a program) | one load level less: 0.19 microseconds a waiting dispatch on the floor, 0.1 to 0.16 ms a frame for 560 to 830 of them (record, section 10). Upstream: scalar instructions 572 to 538, 550 to 487, 415 to 380, 786 to 704; chain depth 5 to 4 | a port. A record whose second half is another's reads as an empty view |
18eab93 |
The places' load is marked pure | with 34b9685 |
as 36df108 |
needs 36df108 |
1fc6138, 9a4c8c6 |
VICTORY_UNIFORM_GUEST_LOADS: a uniform handle where both address words are proven uniform |
the directory path | none expected on RADV: Mesa removes the flag itself by divergence analysis (section 2) | not taken |
d14c4c3, 44f5b82 |
VICTORY_CLUSTER_GUEST_LOADS: adjacent loads of one page share a directory lookup |
the directory path | unmeasured upstream; ray tracing only | not today |
a2c8b12, 83cfa8a |
VICTORY_BAKE_SOURCES_ONLY in draw.rs |
not the translator | no shader changes, no key | issue 21, item 3 |
The wave32 bug, precisely
Read in lower.rs of this fork, for a console wave32 pixel program in a host wave of 64:
v_mbcnt_lo_u32_b32with an all-ones mask, which is how the code asks for the lane's own number (:15534-15581). The lane iswaveGetLaneIndex, 0 to 63 (console_lane,:6351-6361). The mask of the bits below it is(1 << (lane & 31)) - 1, and all ones from lane 32 on (:15567-15575). So lanes 32 to 63 all get 32. Seen: whatever the program picks by lane number is the same in half of each wave. Upstream names the window glass, which picks a cell of the light grid by lane and frame: dark bands that blink every other frame. HereVICTORY_GLASS_DITHER_OFF=1hides it by zeroing the dither.v_mbcnt_hi_u32_b32in a wave32 program: for lanes 32 and up it counts bits of its operand belowlane - 32(:15562-15566), where the console adds nothing.s_bcnt1_i32_b32,s_ff1_i32_b32,s_cmp_eq_u32,s_cmp_lg_u32of a mask: the ballot has two dwords andmask_dwordgives the low one for a one-dword mask (:5532-5539,:5596-5621). Lanes 32 to 63 are not asked. Seen [upstream's account, not seen here]: "does the whole wave have this value" can say yes with another lane's value in the upper half;exec_lo == -1is false in a full host wave.
It exists on RDNA 2, 3 and 4 alike: the pixel wave is 64 on all (section 3), and D3D12 cannot ask otherwise.
RADV_PERFTEST=pswave32 is not a fix: it gives the 10,946 wave64 pixel programs waves of 32, whose lane
numbers then stop at 31 where the console's go to 63, and it remakes every pixel pipeline. It can serve once
as a check that the bands go.
The records pair: the exact port
Upstream reads words 4 to 7 at the title's address. This fork reads the record in a copy on the card when
the heap has one (records_copied, on by default, records.rs:896-909). The copy holds whole 32-byte slots:
it is filled whole (records.rs:976) and brought up to date in runs of whole slots (records.rs:857-872).
Translator (crates/victory-shader/src/emit/):
shader.rs: take upstream'sRECORD_PLACES_AT,record_place_offsets,records_carry_places,RECORD_RANGE_AT,RECORD_RANGE_MARK,RECORD_RANGE_HIGH,record_range_words,records_carry_rangesand the test cellsRECORDS_HERE,CARRY_PLACES_HERE,CARRY_RANGES_HERE. Add one of the fork's own forrecords_copy(), so the tests run with the copy on and off.mod.rs: the export list conflicts besideRECORDS_COPY_ROW,records_copy,set_records_copy. Keep both sides.lower.rs: one new helper,record_at(locator):records_copied(locator)whenrecords_copy()is on, else the locator; kept per block and locator asrecord_loadsis. Three loads go through it and no other:record_load(words 0 to 3), as now;carried_placesof34b9685: read atrecord_at(locator) + RECORD_PLACES_AT, where upstream haslocator + RECORD_PLACES_AT;record_carriedofe09d42e:raw_words(h, record_at(locator) + RECORD_RANGE_AT). The locator is a multiple of 32 on the fixed path (fixed_locatormasks it) and the copy is whole slots, so+ 16stays in the slot and in the copy.
record_slot(locator, carried),record_handleand the tests as upstream.view_addressandheap_view_addresskeeprecord_range(they need the row's fourth word), as upstream.18eab93after36df108:mark_pureon the places' load.- Tests: upstream's six, each also with the copy on. With the copy on and
VICTORY_RECORD_PLACES=1a program with one texture has one load of the copy's row, two loads on the records handle and two probes; withVICTORY_RECORD_RANGES=1a raw buffer has no load of a table row but the copy's.
Host (crates/victory-gpu/src/):
descriptor.rs,record()(:1110-1133): as upstream it computes words 4 to 7 (the range ifcarry_ranges()andrecords::carried_rangegive one, else the places) before the head. In this fork it must store the whole record with one 32-byte store (the build is x86-64-v3,build.sh:20), not a tail and then a head.put_record(16 bytes) stays for its other callers.records.rs:carried_rangeas upstream; it useskind,rangeandhost::view_address, which are here.round()(:857-872) and the first fill inheap_copy(:976) copy slot by slot with one 32-byte load and one 32-byte store, not with onecopy_nonoverlappingover a run.shader_cache.rs: the two keys of upstream, named only when set, after the fork's glass switches (:118-122).- No other host write needs the second half:
- the title's own stores are one 32-byte
vmovupsa record (victory-loader/src/descriptor_sites.rs:4-13) and itsmemcpycalls copy whole ranges: copies keep words 4 to 7; copy_simplecopies whole slots (descriptor.rs:1353-1378);draw.rs,beside()(:2764-2789) copies a table whole and rewrites uncovered records as constant buffer records, which name themselves whole and do not use words 4 to 7;records.rs:537-538writes the host's own heap of slots, which no shader reads as a record.
- the title's own stores are one 32-byte
seen()(records.rs:373-402, diagnostics) mirrors the table path. It should learn the carried range, or its audit will call every carried record wrong.
What happens to a slot copied in the middle of a write:
- Every writer marks after it wrote: the patched stores store, then mark (
descriptor_sites.rs:15-20); thememcpyhooks copy, then mark (port_descriptors.rs:285-296);record()writes, thenmirrormarks (descriptor.rs:1123-1124,:143-147). A round takes marks and copies (records.rs:841-872). - So a round can copy a slot half written only when the slot still carries a mark of an earlier write. The
new write's mark follows, and the next round copies the slot again. A torn slot lives for one round: at
most until the next submission or 4 ms (
SYNC_EARLY,descriptor.rs:186). - With one 32-byte store a record and one 32-byte load a slot, the host's own writes and the title's
patched stores cannot be seen torn [inference: a 32-byte load and store inside one cache line on
processors with full-width vector ports; records lie on 32 bytes]. What is left is the title's
memcpyinto the heap: 10,623 calls and 40,022 records a frame (therenderer port 2line of-002052). - What a torn slot shows. Today: a head of two records, a key that names nothing, slot 0, the null view. With the places: also a head of one record beside the places of another, the probes miss, slot 0, the null view where today the old or the new texture would show. With the ranges: the key check fails, an empty view. For one round.
- Timed here, on the Ryzen 7 7800X3D, RAM to RAM, best of 200,
rustc -O -C target-cpu=x86-64-v3: 262,144 slots (a frame's worth) take 0.135 ms slot by slot, 0.141 ms by onememcpy, 0.474 ms by amemcpya slot. So the slot-wise copy costs nothing. The real copy writes card memory through the BAR, which this does not time.
What the port does not settle: VICTORY_RECORD_PLACES=2 (typed buffers too) is wrong if the title copies
only the first 16 bytes of a record. Whether it does is not known. Use 1 with the ranges.
5. Opportunities beyond upstream's
Each is here because a count, the source or a floor row supports it. The frame time of none was measured.
Mesh groups of 128 (change 9)
- Evidence: section 2, "Mesh programs". 41,000 to 45,000 groups a frame, 128 primitive slots each, declared whole. The mesh draws are the largest block of card time in the stamped run (15.4 ms of 38).
- RADV has the two cheaper ways: counts given at run time (
ac_nir_lower_ngg_mesh.c:690-758) and a cull flag that becomes the null-primitive bit of the export (:809-829). dxil-spirv mapsSV_CullPrimitiveto it (subprojects/dxil-spirv/dxil_converter.cpp:5501-5506). - Not known: how many of a group's 128 slots hold a real primitive, and what a triangle of no area costs the card against a null primitive or no slot. Both decide it. The second is a floor row.
The early depth test (change 10)
- Console census: 3,009 of 12,069 pixel programs ask for the depth test before they run
(
DB_SHADER_CONTROLbit 12) and export no depth, stencil or mask. 873 of them have an unordered view among their resources; 2,409 kill. - The fork passes the flag on for one program, by its hash (
emit/mod.rs:935-947). - On RADV a pixel program that writes memory and has no early test gets the late depth order, and runs where
the coarse test fails and where nothing would be written (
radv_shader.c:2038-2051). So those 873 run for pixels the console never shades, and their writes land [inference for "never": the console's flag says so]. The other 2,136 differ in where the depth is written against a kill. - b97c80a (from another tree, in the local object store) does it for every program that asks, with
VICTORY_EARLY_DEPTH=0to go back. - Not known: how much of a frame those 873 draw, and whether this fork shows the fault b97c80a mends.
The bounds check (change 14)
at()emits four instructions an access; the census counts 2,967,967 accesses, 7.8 % of all results.off + (bytes - 1) < lencan beoff < limitwithlimit = len >= bytes ? len - (bytes - 1) : 0, made once a range and width (theREUSEpass joins equal ones). Three instructions an access, and it no longer accepts an offset that wraps.- The gain is one add in four where the offset is per lane: 2 % of a program's results at most. Whether RADV already folds it was not looked at.
Looked at and not proposed
- Hoisting loads that are uniform for a draw: done (
handle,lower.rs:11836-11853). - Uniform handles where the index is provably uniform: Mesa does it (section 2).
- The copy's row as root constants in place of a load: three more dwords in every program. Past what fits
in registers RADV loads all constants from the upload buffer at a new place each draw
(
radv_shader_args.c:36-41), 0.27 microseconds behind a barrier on the floor against 0.19 for the level it saves (record, section 6). The logs show programs with 5 to 25 user-data dwords. No gain is safe. - The host handing redirected table bases, so that the shader does not redirect: one level less for every
chain, bounded like the ranges. The base is also used as an address (
view_address), so it is a design, not a patch. Not today. - The legacy fused multiply-add as Mesa's
ffmaz: 16,499 sites, 0.3 % of results. - Wave sizes by lowering: upstream tried a wave size for every compute program on an RX 7900 XTX and found
nothing (
emit/mod.rs:247-250).
6. Preparation: the key, the caches, warm, first binds
The shader cache key
crates/victory-gpu/src/shader_cache.rs:74-146:
| Part | Lines |
|---|---|
version N (TRANSLATOR_VERSION), the entry format (3), the loop limit |
:87-89 |
| Fifteen switches, each always named with its value or none | :91-114 |
Three switches named only when set: VICTORY_GLASS_DITHER_OFF, VICTORY_GLASS_DIRT_OPACITY, VICTORY_KILL_CONTINUE |
:115-129 |
The clean-up passes (VICTORY_SHADER_OPT; 63 by default, without DOM_LOADS and WIDE, bitcode/opt.rs:67-73) |
:131 |
| What the translator was told of the host (five words) | :136-138 |
With records: their first slot, RECORDS_REVISION, the twins |
:139-145 |
| For six special programs a derived key by their own revision | :199-219 |
- The glass switches are named only when set so that the translations made before a switch existed keep
their key (the comment at
:115-116). A switch in the always-named list changes every key the day it is added. So every new switch belongs in the second list. - An entry also holds the build of the translator's source. An entry of another build is served as it is in
play and counted;
victory shaderstranslates it again and says how many came out different (:11-15,:270-296). - The pipelines' folder is named by a fingerprint of the translation key, the driver, the adapter and the
translator's source build (
pipeline/known.rs:591-612). A pipeline whose name (its translated code, root signature and state) is in an older folder is hard-linked from there, not made (pipeline/prepared.rs:293-322).
What is on disk (2026-12-04, computed here)
| Files | Bytes | Note | |
|---|---|---|---|
local/cache/shaders |
341,145 | 17.2 GB | 13.2 sets of 25,790; one in use (50 KB a translation, 1.3 GB a set) |
local/cache/pipelines, four native-… folders |
99,323 to 99,326 each | 8.08 GB each as listed, 16.5 GB on disk for all | hard links between them; 81 KB a pipeline |
known-shaders.bin, known-pipelines.bin |
243 MB, 59 MB | 25,790 containers, 99,326 pipelines | |
rectangle-stages |
4,737 | 15 MB |
Nothing removes an old set.
shaders and warm
shaders: 25,694 translated in 48 s, 195 not translatable (shaders-20261130-113928.log).warm: 99,319 pipelines made in 605 s with 10 processes: 164 a second, 9,850 a minute; a pipeline 20.3 ms at the median, 144.5 at nine in ten, 472 at 99 in 100, 8.4 s at the most; 5,859 s of process time (warm-20261201-193559.log). The first 105 s made 6,020: the processes start slowly. No later warm log made any.- With 8 processes since
cbeb035the same work is about 12 minutes [inference: 5,859 s over 8]. - After today's bump: every shader is translated again (about a minute). A pipeline is made again only if one of its programs' code changed; the rest are linked. Changes 1 to 4 touch most programs, so expect most of the 99,326 [inference].
First binds in play
Computed here from the two newest runs:
play-20261204-002052 |
play-20261204-002810 |
|
|---|---|---|
| Pipelines made or loaded before the go mark | 5,516 | 5,518 |
| Pipelines first bound, walk (60 s): all; seconds with any; most in a second | 84; 29; 9 | 45; 18; 8 |
| Pipelines first bound, drive (60 s): all; seconds with any; most in a second | 396; 52; 46 | 151; 33; 15 |
| Host pipelines made or loaded after the go mark | 2 | 3 |
| Shaders translated (from the cache) after the go mark | 3 | 1 |
| Dispatches that waited for a pipeline past the frame's budget | 0 | 0 |
- A first bind is a log line and nothing else in our code (
pipeline.rs:474-486). The host pipeline is asked for at the first draw (pipeline/make.rs:389-413). - A pipeline that is not made yet is made by a worker at the lowest priority while the thread that records
the draw waits, 2 ms at a time, within 500 ms a frame for all threads; past that the draw is dropped
(
make.rs:364-366,:499-560,:767-790). So yes, a first use can hold a list thread. On this route it happened 2 and 3 times in two minutes. - Loading a prepared pipeline takes a worker about 11.5 ms: 3,642 were loaded in 4.18 s by 10 workers at the
start of
-002052(23:21:08.23 to 23:21:12.41). - The book is complete for this route: 99,326 known, 4,940 on the early list, all compute pipelines started
at creation (
make.rs:474-480), and nothing new in play. - vkd3d-proton compiles a pipeline late, on the recording thread, only where the state at the draw differs
from the description: a depth or stencil test without a depth format, a sample count, patches, view masks
(
libs/vkd3d/state.c:7055-7113). Of the 96,563 graphics pipelines in the book 44 have a test and no depth format, 16 of them on the early list; all have one sample. Its message for it is off in play (VKD3D_DEBUG=none,run.sh:121). - So the first binds of the drive are pipelines that were ready. That they sit in 12.3 % of long frames against 3.1 % of the others (weak-points report) is most likely new things coming into view, which also bring textures and pages [inference]. On the walk 84 first binds, up to 9 in a second, went with no slow second.
Seen on the way, outside the translator: the submitting lane waits 1.21 ms a frame at the median for the
rounds of the records (3.3 at the most; the renderer port 7 line of both runs). A round looks at 260,000
to 275,000 slots a frame, of which the stores marked 169,000 to 174,000; the rest is the audit of 8,192
slots a required round (records.rs:22, :844-849). Not sized further here.
7. The changes, each in full
1. e5243e4 with f0fc990 — needs a bump
- Files:
crates/victory-shader/src/emit/lower.rs(MaskData,sop,valu_opatv_mbcnt_lo_u32_b32; newwide_ballot,upper_lanes,upper_compared),emit/mod.rs(tests). - Change:
git cherry-pick -x e5243e4 f0fc990; the version line conflicts (section 8). - Evidence: section 4, "The wave32 bug". At most 1,123 pixel programs. No frame time is expected: a few instructions more in those programs.
- Offline: the commit's tests draw a wave32 pixel program on the host and read lane numbers, counts and
compares back (they need the card, as the card test does).
./run.sh shaderssays how many came out different: at most 1,123 from this commit alone. In a session: the glass withoutVICTORY_GLASS_DITHER_OFF; frame time at 9,500 draws asplay-20261204-002052(31.2 and 35.2 ms). - Risk: low. If the bands stay, the cause is another and the switch stays.
- Size: a pick; an hour with the tests.
2. 36df108 — needs a bump
- Files:
emit/bitcode.rs(pure_loads,mark_pure),emit/bitcode/opt.rs(the effect of a marked call),emit/lower.rs(memory,raw_words),emit/shader.rs(RECORDS_REVISION9 to 10). - Change: cherry-pick. Take upstream's
RECORDS_REVISION. - Evidence:
REUSEjoins instructions without an effect across blocks; loads are parted by any store (opt.rs:1-33). 25,087 programs have record loads, a pixel program 17 at the median in up to 62 places. Bound: the record chain's own, 0.1 to 0.67 ms a frame for dispatches (record, section 10); the share this takes of it is not known. - Offline: its unit test. The translator's own census (
VICTORY_SHADER_CENSUS,emit/bitcode/census.rs;victory translateprints the table):buffer_loadandhandleof a program before and after. The script of section 10 over the new set gives the totals of the table in section 2 again. In a session: nothing seen; frame time not above. - Risk: low. A record read twice in one invocation is now read once; the two reads could differ only if the copy changed between them, which a correct program cannot rely on.
- Size: a pick.
3. 47f5223 with ca165e7 — needs a bump
- Files:
emit/lower.rs,legacy_mul(:6067-6093) andlegacy_fmad(:6130-6143). - Change: cherry-pick both.
- Evidence: 520,092 sites in 16,522 programs (census); Mesa's rule takes only the other form
(
nir_opt_algebraic.py, "(min(abs(a), abs(b)) == 0.0 ? 0.0 : a * b) -> fmulz(a,b)"); upstream's instruction counts (section 4). Bound: 2 instructions a site, 0.1 to 2.2 % of a program; in frame time under what a run can tell [inference]. - Offline: the
victory-shadersuite; the failing test issue 21 names should pass. With change 8,RADV_DEBUG=shaderstatson a program with many such multiplies (upstream namesCS_PedStandardSkinning_8). In a session: nothing seen. - Risk: low. A product of zero and a finite value is +0 where it could be -0.
- Size: two picks.
4. da45c04 and 8b4ec00 — need a bump
- Files:
emit/lower.rs(memory,:4718-4788;user_at),emit/shader.rs(user_word),crates/victory-gpu/src/memory.rs(a test). - Change: cherry-pick both.
- Evidence: parity.
da45c04saves one or two instructions in each of 49,758 directory lookups, which run with ray tracing only.8b4ec00changes no load count (2 to 3 rows a program already). The value is that later picks touch the same lines (9a4c8c6needs8b4ec00). - Offline: both commits' tests.
shadersshould report no change from8b4ec00alone. - Risk: low.
- Size: two picks.
5. The version line split — in the same bump
- Files:
crates/victory-shader/src/lib.rs:30; a new file of the fork's own, for examplecrates/victory-shader/src/fork.rswith one constant;crates/victory-gpu/src/shader_cache.rs:87-89. - Change:
TRANSLATOR_VERSIONtakes upstream's value as picked (20 aftere5243e4). A fork revision, 1 today, is hashed into the key beside it. A translator change of the fork's own bumps the fork's number; a pick takes upstream's line as it is. - Evidence: the version line is the conflict of nearly every translator pick (issue 21, items 1 and 2; the
record, section 18: "most of them the README,
docs/SETTINGS.md… or the translator's version line"). Upstream repaired a doubled version line three times (fdfc125,966784d,766997b). - Offline: a unit test that the key changes with either number.
shaderstranslates everything once, which today's bump does anyway. - Risk: a cache shared between upstream's build and the fork's has the same version with other code; the fork's number in the key keeps the two apart.
- Size: ten lines.
6. The records pair, ported — no bump while off
- Files and functions: section 4, "the exact port".
- Change: as there.
VICTORY_RECORD_PLACES(0, 1, 2) andVICTORY_RECORD_RANGES, both off, each named in the key only when set; rows inREADME.mdandrun.conf.default. - Evidence and bound:
- ranges: one load level less for 312,039 lookups; mesh programs ten a program. Floor: 0.19 microseconds a waiting dispatch, 0.1 to 0.16 ms a frame; 0.45 to 0.67 ms only if the skipped lines are never cached, which a table row read every frame is not [inference]. Draws: not sized.
- places: 16 instructions for each of 291,953 slots, 4.8 % of a pixel program's results, once a wave. No level less. No floor row sizes it.
- on this PC's card the level is dearer than on RDNA 2 or 4 (section 3, point 2).
- Offline: the unit tests with the copy on and off. A host test in
descriptor.rsas upstream'sbuffer_records_carry_their_range_when_asked, plus one that a record written while a round copies it is never seen as two halves. Change 8 for scalar instruction counts and the depth of the load chain on GFX11: expect upstream's deltas plus the fork's redirect. In a session, with both set, aftershadersandwarmunder that key: every texture and buffer as before;records per frame: … named a view slot given awayas before (3.0 to 3.4); frame time at 9,500 draws not above 31.2 and 35.2 ms. A gain under 0.7 ms will not show in one run (single runs differ by 1.3 ms, record, section 7). - Risk: a read past the copy shows a wrong or no texture; a torn slot shows nothing for a round (section
4).
VICTORY_RECORD_PLACES=2only after it is known how the title copies buffer records. - Size: half a day with the host tests. Issue 21's "about an hour" leaves out the whole-record store, the slot-wise copy and the tests with the copy.
Decision: port today, off. It stays off until an instruction count (change 8) and one session have shown it.
7. FSR 3.1 where there is no FSR 4.1 — no bump
- Files:
crates/victory-hle/src/modules/fidelityfx.rs(select_version,:310-360; the check after creation, about:450),crates/victory-gpu/src/external.rs,crates/victory-gpu/src/host/panel.rs. - Change: the provider part of
cacaae1: if no 4.1 provider is offered, take a 3.1 one; accept it after creation; name it in the panel. Leave out its change of the allocator (memorytonull()), which touches the FSR 4 path that works here. The panel hunk is against upstream'sVICTORY_FSR_4K; write it by hand forVICTORY_FSR. - Evidence: section 3. On GFX10.3 RADV has no cooperative matrices (
radv_physical_device.c:188-192), vkd3d-proton then has no matrix operations (libs/vkd3d/device.c:2675-2691), andselect_versionreturns "no FSR 4.1 provider for this adapter". Issue 17 asks for it. For an RX 6000 owner it is the difference between rendering at the output size and at 0.67 or 0.5 of it. - Offline: a unit test of the choice (4.1 when offered, else 3.1, else the error). Nothing changes on this
PC: the log's
FidelityFX: selected PC upscalerline still names 4.1. On RDNA 2 only a tester can show it. - Risk: that the shipped SDK file offers no 3.1 provider on such a card is not checked here; then nothing
changes.
fidelityfx.rsandexternal.rsmerge clean (tested here withgit merge-tree);panel.rsand the README conflict. - Size: an hour.
8. isa_probe and a container cutter — no bump
- Files:
crates/victory-shader/examples/isa_probe.rsand its[[example]]entry (both come with34b9685); a small tool, for example a subcommand besidevictory translate. - Change: in
isa_probealso callset_records_copy(true), as the game does (descriptor/host.rs:1785), or the code it shows is not the fork's. The tool writes the container of a given hash fromknown-shaders.bin(37 bytes of head, then the container;pipeline/known.rs:302-321) to a file. - Evidence: every change above is argued by instruction counts that nobody has taken on this fork. Run
with
RADV_DEBUG=shaderstatsorasm,ps,mesh,csit gives them on the card, without the game. - Offline: it is the offline check. Probe set: upstream's four (compute
fd46520032208bed, pixele06396004d18c51b, mesh797816f4d7b5d9b7andb1a6d299fd26d0e6) and the most frequent compute pipeline of the record (e30970f1727063fd). A tester with an RX 6000 can run the same for GFX10.3. - Risk: none.
- Size: two hours.
9. Mesh groups — a bump if built; first two floor rows
- Files: first
crates/victory-gpu/src/indirect/floor.rs(floor_mesh). Then, if the rows say so,crates/victory-shader/src/emit/lower.rs(mesh_prologue,emit_indices) andemit/mod.rs:912(the per-primitive rows). - Change, step 1 (no game, no translator change): a mesh program of
numthreads(128, 1, 1)that declares 128 vertices and 128 primitives, lane n writing vertex n and primitive n, in three forms: (a) k real small triangles and the rest indices 0, 0, 0, as the translator emits; (b) the same with the rest culled bySV_CullPrimitive; (c)SetMeshOutputCountswith the real counts. For k of 16, 64 and 128. Back to back and behind a barrier, as the other rows. Step 2, only if (b) or (c) beats (a) by 0.02 microseconds a group or more at some k: (b) is a per-primitive boolean written true in the prologue and by the export's cull bit, with the indices left as they are. (c) needs the count the one lane sends, in the entry block, for a group of two waves: larger. - Evidence: section 2 and section 5. Bound: 43,000 groups a frame times the difference a group. At 0.02 microseconds that is 0.9 ms a frame; under it the item is dropped. The upper end is not known.
- Offline: step 1 is the measurement. Step 2:
isa_probeon a mesh program; the unit tests of mesh exports. In a session: every mesh as before (a wrong cull flag makes holes); frame time at 9,500 draws. - Risk: step 1 none. Step 2 medium: all 8,765 mesh programs change.
- Size: step 1 half a day. Step 2 (b) a day, (c) several.
Decision: step 1 today if there is time; step 2 is not in today's bump. If it is built later it goes behind a switch named only when set, until its run.
10. The early depth test — no bump while off
- Files:
crates/victory-shader/src/emit/mod.rs(emit_program,:935-947),crates/victory-gpu/src/shader_cache.rs. - Change: b97c80a, with two differences: off unless
VICTORY_EARLY_DEPTH=1, and named in the key only when set (b97c80a has it on by default and always named). - Evidence: section 5. 873 programs where the host shades what the depth test would refuse; 3,009 whose depth is written at another point than on the console. Bound: not known.
- Offline: its unit test. With the switch,
shadersshould report 3,008 programs changed (3,009 less the one that has the flag today). In a session with the switch: windows, hair and foliage in front of characters; frame time at 9,500 draws. - Risk: medium. A quarter of the pixel programs test depth earlier. It is what the console's own flag says, but one program was hand-picked here for a reason nobody wrote down beyond its fault.
- Size: a pick and an hour.
11. Old sets removed — no bump
- Files:
apps/victory/src/translate.rs(precompile),apps/victory/src/warm.rs(run),run.sh. - Change: after
shadershas gone through every container without an error, remove translations that are not of the current key and are older than 14 days. Afterwarmreports every pipeline on disk, removenative-…folders other than the current one and the newest other. Print what was freed. - Evidence: section 6. 15.9 GB of 17.2 GB of translations are of no key in use. Today's bump adds a set (1.3 GB) and up to 8 GB of pipelines; a trial of change 6 adds as much again.
- Offline: a unit test on a made-up folder; the two counts before and after.
- Risk: a user who goes back to an older build translates again. The 14 days and the kept folder cover the usual case.
- Size: half a day.
12. The depth format of 44 pipelines — no bump
- Files:
crates/victory-gpu/src/pipeline/host.rs(whereDSVFormatis set,:914,:1546),pipeline/known.rs(the book). - Change: for a pipeline with a depth or stencil test and no depth format, note the format bound at its first draw and keep it with the pipeline's key; make the host pipeline with it from the next run on.
- Evidence: section 6. 44 pipelines, 16 on the early list. Each is compiled by vkd3d-proton at its first draw, on the thread that records the draw. Bound: 16 compiles a session at 20 ms (median) to 145 ms (nine in ten) each.
- Offline: the count of section 10 gives 44 again; after it, the book names a format for those met. In a
session with
VKD3D_DEBUG=fixme: the lines "Compiling a fallback pipeline late!" counted before and after. - Risk: low; a format that differs between two uses of one pipeline falls back as today.
- Size: half a day. First count the lines in one session: if there are none, drop it.
13. A line for first-use waits; a seed for the early list — no bump
- Files:
crates/victory-gpu/src/pipeline/make.rs(wait,:499-560), the frame's report inhost.rs;pipeline/library.rs(used,:987-1003). - Change: (a) count first uses that found no pipeline and the time waited, in every build (today the
counter is diagnostics only,
make.rs:558-559), on one line a second when not zero. (b) Ship a list of pipeline keys to start early when the user's own list is empty: the keys are hashes of the title's shader hashes and state (make.rs:56-80), the same for every user of the same game build. - Evidence: on this PC the early list makes play free of pipeline loads (2 and 3 in two minutes). A user
after a first
warmhas no list: every pipeline is loaded at its first draw, 11.5 ms each with a list thread waiting. How many in a first session: about 5,500 on this route. - Offline: (a) a unit test of the counter. (b) start with the list moved away and the seed in place: the
log's
title pipelines to start earlynames the seed's count. In reports of other users: the new line. - Risk: none for (a). For (b), keys of another game build match nothing.
- Size: (a) an hour, (b) two.
14. The bounds check — needs a bump; not today
- Files:
crates/victory-shader/src/emit/lower.rs,at()(:12322-12336). - Change: section 5.
- Evidence: 2,967,967 sites. Bound: one instruction in four where the offset is per lane.
- Offline: change 8 first: if the card's instruction count of the probe set falls by under 1 %, drop it.
- Risk: low; stricter than today on a wrapped offset.
- Size: an hour. A change of the fork's own in a function upstream also edits: offer it upstream instead of carrying it.
8. Today's bump
Contents and order. Each pick's version-line conflict is resolved to the line as it stands, and the version is set once at the end.
| Step | Commit | Why here |
|---|---|---|
| 1 | 36df108 |
first: 18eab93 needs mark_pure; takes RECORDS_REVISION 10 |
| 2 | 8b4ec00 |
before anything that touches user_at |
| 3 | da45c04 |
memory(), after 36df108 which edits the lines above it |
| 4 | 47f5223 |
|
| 5 | ca165e7 |
after 47f5223: the same function family |
| 6 | e5243e4 |
merges by itself (issue 21) |
| 7 | f0fc990 |
tests of 6 |
| 8 | 34b9685, ported |
off by default |
| 9 | e09d42e, ported |
off by default; after 8, it rewrites 8's host write |
| 10 | 18eab93 |
|
| 11 | the version: TRANSLATOR_VERSION as upstream's (20), the fork's revision 1 in the key |
one BREAKING CHANGE: commit: run ./run.sh shaders, then ./run.sh warm |
Not in it: 1fc6138, 9a4c8c6, d14c4c3, 44f5b82 (ray tracing only, unmeasured, the first without effect on
RADV); changes 9, 10 and 14 (no measurement).
After it, offline, in this order:
- The suites:
victory-shader;victory-gpuwith its six known failures; the card test. ./run.sh shaders: the summary line "… translated again, N came out different". Expect most of the 25,790 (change 3 alone touches 16,522) [inference].- The census of section 10 over the new set: the table of section 2 again. Record loads and table rows
should fall (
36df108); the one-factor multiplies should be 0 (47f5223). ./run.sh warm: every pipeline on disk, none bad that was not before.- Then one measured run beside
play-20261204-002052: frame time at 9,500 draws 31.2 and 35.2 ms, not above; the glass withVICTORY_GLASS_DITHER_OFFunset.
9. Rejected, with the reason
| Idea | Reason |
|---|---|
RADV_PERFTEST=pswave32 or VKD3D_CONFIG=force_minimum_subgroup_size as the fix for wave32 programs |
they give the 10,946 wave64 pixel programs waves of 32, the same fault the other way; Mesa recommends 64 for pixel programs (radv_physical_device.c:2847); every pixel pipeline is made again |
cswave32, gewave32, a wave size for every compute program |
compute programs declare their size; upstream measured nothing on an RX 7900 XTX (emit/mod.rs:247-250) |
1fc6138 (uniform handles for proven guest loads) |
Mesa removes the non-uniform flag itself where the index does not diverge (radv_pipeline.c:329-331) |
VICTORY_RECORD_PLACES=2 |
wrong if the title copies 16 bytes of a buffer's record; not known |
The floor's 0.1 to 0.67 ms as the gain of VICTORY_RECORD_PLACES |
the places remove no load; the figure is for a load level |
| The copy's row as root constants | section 5: it can push a program's constants out of the registers |
| Resolved records by the host (the slot written into the copy) | the record dropped it (section 10): one to two weeks, 0.67 ms at most; the ranges take the cheaper half of it |
| State templates for mesh draws | the record dropped it: runs of 2.25 executions (issue 8 waits for a count) |
DOM_LOADS on by default (VICTORY_SHADER_OPT=191) |
off upstream too, "until replay timings are available" (bitcode/opt.rs:65-67); 36df108 gives the reuse for the loads that matter |
The WIDE pass, v_mad_f32 as one multiply-add, a fast reciprocal |
measured as nothing upstream (bitcode/opt.rs:57-64, emit/mod.rs:247-250) |
| The legacy fused multiply-add as one instruction | 16,499 sites, 0.3 % of results |
| Making pipelines at the first bind earlier | they are made: 2 and 3 host pipelines after the go mark in two runs |
| Loading every prepared pipeline at the start | 99,326 at 11.5 ms over 10 workers is two minutes and 8 GB of pipeline blobs held |
RADV_PERFTEST=nggc on RDNA 3, nonggc on RDNA 2 |
1,350 ordinary draws a frame against 8,150 mesh draws; no figure asks for it |
nosam |
the record: no faster, more flicker (section 9 of the record) |
a2c8b12 with 83cfa8a in today's bump |
not a translator change; issue 21, item 3 stands as it is |
10. Not determined, and how the counts were made
Not determined:
- The frame time of any change here. No session, and no instruction count on the card:
isa_probeis not in this tree and nothing was built. - Which programs are hot. No release log counts draws or dispatches by pipeline.
- Whether the 1,123 wave32 pixel programs are the 1,065 that ask for the lane index.
- How many of a mesh group's 128 vertices and primitives are real, and what a triangle of no area costs.
- Whether the title ever copies half a record.
- What RADV does at the first draw with a pipeline that vkd3d-proton had ready; the 44 late compiles were
counted from descriptions, not seen (
VKD3D_DEBUG=none). - Whether the FidelityFX file the fork ships offers a 3.1 provider on RDNA 2 (upstream's commit says so).
- The cache-block and backend counts of cards other than Navi 31 and Navi 21: taken from issue 16.
- Whether the page directory can change while a list that read it still runs (
36df108marks its load pure);memory.rswas read for its encoding only. - How much of a frame the 873 pixel programs of change 10 draw.
How the counts were made (each can be made again from the files named):
- The census: for every file of
local/cache/shaderschanged on 2026-12-03 (25,790), the entry's header (shader_cache.rs:361-372: magic, source, stage, DXIL), theDXILpart of the container, the bitcode read record by record (module 8, types 17, constants 11, symbols 14, function 12; value numbers asbitcode.rs:796-812). A call is named by its callee; a handle from the heap by its index (a constant or not) and its non-uniform flag; a raw load by the handle it reads. Patterns are matched on operands: the legacy multiply as a select of a compare with 0.0 over a multiply; the bounds check as a select whose other value is 0xFFFFFFF0. - The console census:
known-shaders.binaspipeline/known.rs:302-321; in each container theDXILpart, itsXDATindex, the packedFSSMblob, the stage records (native.rs:9-28): the wave flag at +0x14; for mesh the three sizes at the record's end + 0x448; for pixelDB_SHADER_CONTROLat + 0x138 and the used-resource table. - Pipelines:
known-pipelines.binaspipeline/known.rs:325-337and:669-742; the state's numbers in the order of thenumbers!macro (the depth test at 92, the stencil test at 95, the depth format at 117, the sample count at 118). - First binds: the
first bindlines of a log by second from the go mark, pipelines counted once; host pipelines by the lineshost pipeline shadersandhost mesh pipeline shaders. - Mesh groups, record rounds: the
indirect mesh dispatches,records per frame,renderer port 2andrenderer port 7lines between the go mark and 122 s after it, medians. - The slot copy: a standalone program,
rustc -O -C target-cpu=x86-64-v3, on the Ryzen 7 7800X3D; buffers of 8,192 and 262,144 slots of 32 bytes in RAM; best of 200 passes.
Read: crates/victory-shader/src/emit/lower.rs (the parts cited), emit/mod.rs:126-1000, emit/shader.rs
(the records' constants, heap_handle_at), emit/bitcode.rs:684-1040, emit/bitcode/opt.rs:1-120,
emit/intersect.rs:535-600, native.rs (the layouts), io.rs:20-50;
crates/victory-gpu/src/shader_cache.rs, records.rs, descriptor.rs (records, marks, the sync thread),
port_descriptors.rs:1-320, pipeline.rs:454-500, pipeline/make.rs, pipeline/prepared.rs,
pipeline/known.rs, pipeline/library.rs (names, the early list), host.rs:820-940, :3825-3895,
:7829-7875, host/node_test.rs:1-45, um.rs (the requirements), draw.rs:2580-2600, :2755-2800;
apps/victory/src/warm.rs:1-330; crates/victory-loader/src/descriptor_sites.rs:1-24; patches/*.patch;
the record's sections 1, 2, 6, 7, 10 (resolved records, mesh templates), 13 (the floor rows), 18; the
weak-points report whole; issues 8, 13, 16, 17, 21. Upstream's commits e5243e4, f0fc990, da45c04, 8b4ec00,
47f5223, 36df108, ca165e7, 34b9685, e09d42e, 18eab93, 1fc6138, 9a4c8c6, d14c4c3, 44f5b82, a2c8b12, 83cfa8a,
cacaae1, 1704446 and b97c80a by git show.