Skip to content

Ampere exp2: upstream sync and opt-in performance ports - #7

Draft
Matartos wants to merge 131 commits into
ampere-sm86-perf-exp1from
ampere-sm86-perf-exp2
Draft

Matartos wants to merge 131 commits into
ampere-sm86-perf-exp1from
ampere-sm86-perf-exp2

Conversation

@Matartos

Copy link
Copy Markdown
Owner

Sync f9dfb76, port trustno1-coder#1823, trustno1-coder#1821, trustno1-coder#1825 and compute budget fix trustno1-coder#1831. Defer trustno1-coder#1477 for the 10 GiB profile. See OPTIMIZATION_REGISTRY.md. Windows CI and hardware A/B tracked separately. For review only.

wike1701 and others added 30 commits November 27, 2026 22:04
…GPURT node answer

Port the portable pieces of fxceless/victory-fork commits 17533c5, 1170216, 1320dfd, and 9a9091d onto trustno1 main (f3534e6):

- victory-shader: enable USER_DISPATCH_THREADS_X guarding for spilled 1D compute programs on 32-lane waves and programs with barriers by adding partial_active/effect_guard instead of early return when threads must stay for s_barrier or two-wave exchanges (after 1320dfd).

- victory-shader: check exact operand dwords in lane_uniform (full dwords on scalars, exact VGPR dwords except v_movrel/v_swap), widen ordered/stable uniform ds_read checks beyond ds_read_b32, and mask v_readfirstlane_b32 with partial_active when halves are alike or guarded (after 1170216, 1320dfd).

- victory-shader: return [u32::MAX; 4] (-1 per AMD GPURT) for instance and procedural BVH nodes (kinds 6 and 7) in bvh::intersect and emit::intersect, and use effect_guard for BVH intersection loads (after 9a9091d).

- victory-gpu: extract Location (words 4-5) for placed as well as shader acceleration-structure views in view_address, returning None when zero (after 9a9091d).

Adaptations for main: 17533c5 (VICTORY_WAVE_PAIRS_SPILLED) is inapplicable because main uses halves/exchange/pairs without paired.rs; 9a9091d memory sync/written-page tracking is omitted because main already uses arena Shadow::by_address sync (preserving PR trustno1-coder#88 and PR trustno1-coder#58) and VICTORY_BVH_BUILDER remains opt-in (=1).
The Arc B580 hung (DXGI_ERROR_DEVICE_HUNG, sometimes a page fault at a
small address) whenever a mesh pipeline stayed bound while copies,
clears, dispatches or barriers were recorded after it; a synthetic mesh
pipeline did the same. A list with a mesh pipeline bound now gets a
vertex-only rest pipeline before any recording title call, before a
bind of another kind, before an indirect execution's copies and clamps,
and before it closes. State-only calls keep the mesh pipeline bound.

VICTORY_MESH_REST=off|bind|draw; default bind on Intel, off elsewhere.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
members() tested every one of the 513 places of a RegSet to give the few
registers that are live, twice for each block of a program. It now walks
the set's nine words by their lowest set bit (trailing_zeros, then
bits &= bits - 1), in the same order. Only insert sets bits, so none lies
past REGS; one there would end the walk rather than reach reg_at.

Port of slatefield's change (Marvisak/VIctory#1833), which measured
ir::build 4.5 % faster on synthetic programs of 12,000 and 24,000
instructions. Not measured again here.

Test: a_live_set_walked_by_its_bits_is_every_place_tested compares the
walk with a test of every place for the empty and the full set, 300
random sets of 1 to 300 registers, and the places at the ends of words.
get_or_convert writes a translation to a staging file and renames it over
the content-addressed entry. When another thread or process (the pipeline
makers, victory warm's processes) finished publishing the same entry in the
meantime and held it open, Windows refused the rename (access denied or a
sharing violation), and the error came back as the translation's: the
shader cache's caller then took the shader as one that does not translate,
and its pipelines' draws were dropped for the run.

The staging file is removed, and the entry is taken when it is there now;
the error is still given when it is not (or is not a file). A write that
fails before the rename is still an error.

Port of mgunes1311-lab's fix (Marvisak/VIctory#1324), with its test
accepts_entry_published_concurrently_while_open: during the conversion the
same entry is published and held open (share mode read), so the rename is
refused. It fails before the change with "access denied" (os error 5).
…clude root constants as bases

Port three shader translation correctness fixes (from Marvisak/VIctory
7ac1f54d83, f3578e386e, 88daba427b and our merged Vice-Tay trustno1-coder#229) into
crates/victory-shader:

- Seed pops_collision SGPR inputs with 1 << 16 (wave_id = 1, collision_id = 0,
  overlap clear) so inactive lanes leave the wrap-around wait loop on the
  first pass (Marvisak#2395).
- Decode Operand::Const(240..=248) via super::lower::inline_f16 when
  simulating v_add_f16 in wave.rs instead of treating inline f16 constants
  as zero (Marvisak#2493).
- Exclude RootType::Constants from Tracer::sum base matching and check
  s.base before rejecting two-dynamic-term sums so root constant dword 0
  acts as an offset while 64-bit constant pointers still classify as MEMORY
  (Marvisak#2154).
- Add four regression tests (including WARP draw + DXIL validation for POPS).
With VICTORY_BVH_SIZE_ANSWER, the builder's prebuild-info and batched-build methods are watched. The maximum result size it told the title for an input shape is put into each compacted-size slot before and after the real call, and its later store into an answered slot is kept out of title memory. VICTORY_BVH_SIZE_ANSWER=0 leaves the builder's own store alone.

Fixes trustno1-coder#689.
Faulted pages used to stay counted for the whole run, so later ones could not be mapped. Keep them under VICTORY_RT_FAULT_MB (1024 MiB by default): refresh pages that fault again through the write watch, and give back the oldest pages no packed structure owns and no shader has looked at lately. Pages taken or looked at in the last few frames stay, so the builder still has them. VICTORY_RT_FAULT_KEEP=0 keeps the old once-only count.

Fixes trustno1-coder#688.
Adapt Marvisak/VIctory#3124 and its regression tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…mory

The 195 GS_VoxelizeGeneric programs load through s8 at 0xb8. In a merged
ES-GS, user data starts at s8: s8 is user data 0, not the table root at
user data 8. That load is a raw address. The table the program uses is at
0x920 (584 dwords) through s16, and matches its UsedResource entry.

Keep the merged +8 placement for Gs, and let an address that traces to no
root parameter fall back to title memory, as compute does. The 0x920 load
stays a table; 0xb8 becomes MEMORY.

The old 0xb8/184 comparison was a unit error: 0xb8 is bytes, while 184 is
dwords (0x2e0). Tests cover the table at 584/s16, the raw 0xb8 and table
0x920 in one program, and a merged root descriptor at s17.

Refs trustno1-coder#659
Fix as described by @traeb0n in trustno1-coder#773. Keep code-table and one-term shape restrictions, and exercise emitted offsets with synthetic shaders.
…zle_b32 (port of Marvisak#1582)

Port Marvisak/VIctory#1582 to VIctory-NVIDIA while preserving its pixel
`quad_read` fast path, handling Wave64 halves / native Wave64 / mesh
quads, and fixing two additional cross-lane edge cases:

- Track source-lane activity under `EXEC` (`guard` + `waveActiveBallot`
  for wave/mesh ops; `quad_read` of `guard` for convergent pixel quads)
  for `DPP16`, `DPP8`/`DPP8FI`, and `ds_swizzle_b32`.
- Respect `fi` (`fetch_inactive`), `bound_ctrl` (`0` vs write-disable),
  and safe `waveReadLaneAt` indexing (`select(valid, src, lane)` before
  the shuffle so out-of-row or inactive source lanes are never passed to
  `waveReadLaneAt`).
- Refuse pixel quad reads inside per-lane divergent control flow
  (`!all_lane_blocks`) with `Unsupported`, matching `permlane` rather
  than silently reading stale neighbours on hardware.
- Compute `DPP16` destination `row_mask` row indices from
  `console_lane()` so Wave64 `halves` maps console lanes 32..63 to rows
  2..3 instead of aliasing rows 0..1.
- Add end-to-end D3D12 hardware + WARP + DXIL regression tests covering
  Wave32 (29 cases), Wave64 halves (7 cases including `row_mask=0x4/0x8`),
  pixel quad edge rendering, and divergent pixel quad refusal.
…ilure (trustno1-coder#788)

slEvaluateFeature returns 39, "warning: out of VRAM", for an evaluation
it recorded: sl.common asks for the card's memory budget only once the
evaluation went through, and turns only an ok into 39. It was taken as
a failure, so the title's list state was not replayed after Streamline's
passes (manual hooking leaves that to us), and the output was not told
as written. trustno1-coder#788's log: an RTX 5060 8 GB, 281 upscalings by DLSS, then
6,985 in a row with 39, each with a warning line.

39 is now an upscaling done by DLSS. The first one logs a warning, and
the per-second DLSS line counts them.
The console fence hands out its value's address, and a list's
bottom-of-pipe write can move it. Such a write changed the number and
woke WaitOnAddress pollers, but left events registered with
SetEventOnCompletion unset until some later Signal reached their value:
a thread blocked on such an event hung, or woke at an unrelated signal.

Live fences are kept by the address of their value; when a write lands
in one, the events its new value reaches are set, as a signal sets them.
With the default user added silently, the system's devices for that user
are passed to the title. XUserFindForDevice always answered
E_GAMEUSER_USER_NOT_FOUND, and the module said there were no input
devices, though gameinput hands out pads, a keyboard and a mouse. Titles
that map controllers to users saw every pad as unpaired, and may ignore
its input or ask the player to choose an account.

XUserFindForDevice now returns the one user for any device id gameinput
issued (gameinput::is_device_id), and still not found for any other.
… often

A save writes the whole library again however few pipelines were added,
every 20 s while any came in. At 4.78 GB (an NVIDIA run's library) that
dirtied 4.78 GB of the file cache every 20 s beside the title's own
streaming, and every pipeline made meanwhile waited for the save to end
before it was stored and handed to the draws that wanted it.

A pipeline made during a save is now used at once and stored after it
(VICTORY_LIBRARY_STORE_LATER=0: as before). A save waits 20 s up to
256 MB and as much longer as the library is larger, about 6 minutes at
4.78 GB; the save at the end of a run is not held back
(VICTORY_LIBRARY_SAVE_S=20: as before).
… 1 GB

The host's pipeline library has no way to take a pipeline out, and each
change of a translation stores its pipelines under new names beside the
old ones: an NVIDIA run's library held 80,703 pipelines in 4.78 GB, of
which the run loaded 986.

At the end of a title's run, a library larger than VICTORY_LIBRARY_KEEP_MB
(1024; 0: never) is written anew with the pipelines that run loaded or
made, when it used at least 1,000 (a run that ended at the menu leaves it
as it is). The early list still names the others, so the next run starts
them at their creation; the driver's own cache makes those quick where
it holds them. The tools that fill the library do not rebuild it.
At the end of an RTX 5070 Ti run the rebuilt library kept 928 pipelines
while the run had loaded 1,199 and made 1,394, and the line could not
say whether the rest were names that came again (a pipeline the title
made twice is loaded twice) or pipelines the new library refused. It
now counts both.
…iler refuses it

Under Wine, the builtin d3dcompiler_47 refuses the clamp's raw buffer
loads, and with no clamp every indirect draw and dispatch is dropped.
crate::hlsl (from kc/nvidia, after JMAN730/victory dffc5924 by Codex)
compiles a compute shader with the system's D3DCompile and falls back to
DXC (VICTORY_DXC); on Windows the system's compiler takes it as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 9d4ffd7efc5b197c5a18842822d01caeac6f4486)
… DXC

Under Proton run 35 lost, to Wine's builtin d3dcompiler_47 refusing them,
the ambient light's stand-in for the title's ray tracing ("no stand-in for
the indirect light"), the card compare ("no host copies in the card's
memory"), keeping the card awake, and the depth planes' passes. They all
compile through crate::host::compile or beside it. crate::hlsl::compile_for
compiles any entry point for a _5_1 target with the system's compiler,
then with DXC at the 6.0 model of the same stage; host::compile, the card
compare and the composer use it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit b97ad9950e8b8d400629f45c814c557bd75fd878)
…s to DXC

Wine's builtin HLSL compiler accepts [RootSignature(...)] and leaves it
out of the code, and vkd3d-proton then finds no RTS0 part and fails
CreateRootSignature with E_FAIL. Every helper that reads its root
signature out of its code was off under Wine for that: the depth planes'
pass, keeping the card awake, the scatter, the upload check and the
tiles' look (the last three failed silently). Such code is now refused,
so DXC compiles it; the depth planes' vertex shader follows its pixel
shader to DXC, so the pipeline's stages are of one kind.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 0b13dc8e3ba07ba3953f2ce99a35b366f9b5a79c)
…rustno1-coder#771)

VICTORY_CARD_AWAKE keeps one compute job running on a second queue, so
that the card does not lower its clocks in the gaps between a frame's
submissions. It went on in the launchers on a replay of one captured
frame (28.6 ms with it against 37.8 without). Measured in the game it
was slower:

- Yoshi-233 (trustno1-coder#825), RTX 4070 Ti SUPER, a boat held still facing a
  bridge, its own =turns mode (20 s on, 20 s off), five pairs: 19.0
  frames a second off, 17.4 on, every off phase faster than the on
  phases beside it. The graphics clock was 2,775 MHz either way; the
  card's work inside the submissions took 37.8 ms off, 42.1 on.
- trustno1-coder#771, RTX 3060 12 GB, Series S profile: the first menu ran at 15 to
  45 frames a second with the window in front, and at 600 or more with
  VICTORY_CARD_AWAKE=0.

victory play, play-foxhound.ps1 (play-nvidia.ps1) and play.ps1 leave it
off now. VICTORY_CARD_AWAKE=1 (play --set, -More, or a line in
victory-settings.txt) turns it on where it helps.
A line after the frame-rate line counts the mesh pipelines bound, the
rest pipelines bound in their place, and the rest draws, per frame.
Read beside the frame's preparation time and its draws dropped without
a host pipeline, it shows what the extra binds cost; with
VICTORY_MESH_REST=off it gives the binds the title asks for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
trustno1-coder and others added 30 commits November 28, 2026 12:25
…der#328's VICTORY_MEMORY_NEAR are in the key

trustno1-coder#807's test of every translator switch found them left out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5CFykxe6G44cMPrmExrcw
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5CFykxe6G44cMPrmExrcw
… fields

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5CFykxe6G44cMPrmExrcw
Refusing them dropped every draw with one of these programs: 5,587 of
20,110 of the title's shaders on an RTX 5070 preload. They are now read
with the host's quad operations where they stand; where the whole quad
takes the branch, as the title's programs do, that is the console's read.
VICTORY_QUAD_DIVERGENT=0 refuses them as before; the switch is part of the
shader cache key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5CFykxe6G44cMPrmExrcw
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5CFykxe6G44cMPrmExrcw
… that exists now

first_upload_decision charged an over-room first upload to the card only for
bytes past pool::texture_room(). That figure counts pieces given back that
still rest for 2.5 s and free space split into ranges too small to use, so a
small texture always "fit" it, even with the card past its budget, and the
pool could still make a new 64 MiB block for it (issue trustno1-coder#1496: 17,043 MiB in
use against a 14,767 MiB budget, 71,820 allowed, 0 refused at the whole card).

When the card is at or over its budget, an upload now also has to fit in the
widest free range of the texture blocks at that moment
(pool::texture_widest_free). Under the budget nothing changes, and the
existing "full card with free texture blocks still admits faces" case still
passes.

Fixes trustno1-coder#1496

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rustno1-coder#1528)

Five issue forms (crash, graphics, performance, feature request, test
report) that apply their labels and ask for both logs, a pull request
template (Fixes #, how it was tested, wave sizes for shader changes,
overlap check), a README line to search open PRs and /claim the issue
first, and the needs-logs workflow now adds the needs-logs label.
Proposed by @Jesper-Andersson in trustno1-coder#1528.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5CFykxe6G44cMPrmExrcw
Issues and pull requests that start their title with [tags] (as the README
asks when GitHub doesn't let someone set labels) get those labels, with
common spellings mapped (fix -> pr-fix on a pull request, perf ->
performance, and so on), and the tags it used are taken out of the title.
It reads only the title; no pull request code is checked out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5CFykxe6G44cMPrmExrcw
…write-only shortcut (trustno1-coder#1435)

On a 32-lane host such a program was dropped. It is now tried once more
with the rule before trustno1-coder#43 (VICTORY_LDS_WRITE_ONLY_OK=1), only when it would
otherwise be dropped: 7 of the 10 programs in trustno1-coder#1435 translate again (1
before). VICTORY_LDS_LAST_RESORT=0 drops them as before; keyed in the
shader cache.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5CFykxe6G44cMPrmExrcw
On 32-lane hosts the four programs of the trees' instance culling
(`InstanceCulling:CS_Tree_BatchCull`, `_ImposterOnly`, `_ValidateInst`,
`_ValidateInstInv`) were refused ("no wave32 lowering for this wave64
program"), so their dispatches were dropped: trees and bushes showed only up
close, stayed while one drove off a little, and went again farther off
(trustno1-coder#1516). They are of the shape the wave-wide form is kept for (groups of 64,
an LDS read and write in one lane-branch region); with it they translate,
validate and make RTX pipelines, and they are named with the other programs
that get it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lane it reads is not running

A lane of the quad that took the other way left the host's leftover in a
derivative: garbage normals or mips, and bloom spreading bright pixels over
the screen. Its own value makes that derivative 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5CFykxe6G44cMPrmExrcw
…e back and what helps

Shaders being made, full video memory, a maxed card, the processor or the
frame rate cap, each with what helps (VICTORY_ADVISOR=1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5CFykxe6G44cMPrmExrcw
…at to try

In play the programs the write-only fallback brings back cost 150 ms of
the card a frame and darkened the picture in blocks; VICTORY_LDS_LAST_RESORT=1
turns it on. The explainer now names the limit (GPU, CPU, cap), then video
memory, compiling shaders or skipped draws, each with what to try.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5CFykxe6G44cMPrmExrcw
…-coder#1579)

A looping in-world Bink video (a television, a screen behind the menu)
decoded every frame and held frame generation off for whole sessions.
While the scene was upscaled in the last 250 ms the title is playing, not
showing a full-screen movie. VICTORY_MOVIE_GATE_SCENE=0: as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5CFykxe6G44cMPrmExrcw
Without VICTORY_MENU_PLAY it said to close the game, which left it running
until then; it now starts again with the command it was started with. The
settings' restarts are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5CFykxe6G44cMPrmExrcw
… from marking a slot written again

(cherry picked from commit 2546054)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.