Repository navigation
GPU: what shaders touch on the card's side in one switch, sizes by the card's budget (VICTORY_CARD_SIDE=1, off by default) - #1476
PiloteCode wants to merge 1 commit into
Conversation
…es by the card's budget Every title buffer's copy (a least of 64 KiB) and the windows of title memory outside buffers go to the card, up to totals chosen by the card's budget (8 GB: 768/512 MB; 12 GB: 1/1 GB; 16 GB: 1.5/1.5 GB; 24 GB: 2/2 GB; 32 GB and more: 3/3 GB). Windows go main's way: one buffer in a GPU upload heap where the device has such heaps, two sides where it has none. A window goes to the card up to 97 hundredths of the budget, and the texture queue keeps the room of both totals (at most 1.5 GiB of buffers and 2 GiB of windows). Every switch of its own still wins: VICTORY_CARD_BUFFERS_MIN_KB, _MIN_MB, _MB, VICTORY_CARD_WINDOWS_MB, VICTORY_WINDOW_UPLOAD, VICTORY_CARD_ROOM_FOR_BUFFERS. Off, nothing changes. A line at the first copy says what was chosen. On an RTX 5090 with fxceless#854 and fxceless#1450, four alternated runs of four minutes: 183.1 and 186.2 ms a frame without the switch, 154.2 and 158.1 ms with it.
…dget fxceless#1476 lets a title buffer's copy and a window go to the card up to 97 hundredths of the budget. On an 8 GB card that leaves about 215 MB for what no kept room counts (our lists, staging, descriptor heaps), and past the budget the driver moves allocations to shared memory, slower than the bus the placement saves. With the switch the line is now 90 hundredths, the texture queue's own (resource::room); without it, copies keep 97 as before and windows 80. The start line names the line and the most room the texture queue keeps for both. Ours, not in fxceless#1476. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings, each behind its own switch and off unless set: VI-BR-PORT's held levels (VICTORY_HELD_LEVELS), copies and refreshes (SEND_OWN, UNDER_WORDS, UNDER_WIDE, WIDE_FILLS, REFRESH_AHEAD), page parts and guards (PAGE_PARTS, GUARD_REST, OPEN_ONE_VIEW), the heap pass aside (HEAP_PASS_ASIDE); from fxceless/victory-fork fxceless#1450 (PIPELINE_COMPUTE_WAIT_MS), fxceless#1461 (SAMPLER_ORDER), fxceless#1468 (CARD_READ_COPY), fxceless#1476 (CARD_SIDE), fxceless#1424 (WIDE_READS), fxceless#1427; Belobug's FidelityFX bridge (VICTORY_FIDELITYFX_DIR); a local window icon (VICTORY_WINDOW_ICON); and fixes to LAZY_REMAP's copies and clean pages. Nothing derived from XCL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Ran the card-side budget tests at Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, Rust 1.98.1 (pinned by All three tests pass: the set grows with the card, a switch of its own overrides the set, and the room kept counts the windows in the set. They are helper unit tests; the Not tested: a real frame with AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used. |
Based on
main(9a9091d1), on its own: it needs none of our other PRs. One commit:crates/victory-gpu/src/shadow/placement.rs(new): the switch, its table of sizes, how it meets the switches that already exist, and three tests;shadow.rs:card_limits,card_room_kept,window_card_most, and the room test ofwindow_card_room;With the switch unset, nothing changes except one log line. With it, on an RTX 5090,
main's frame was about 15 % shorter (see "Measured").What was wrong
A host copy in the PC's memory is read and written by shaders across the bus: every load, store and atomic. On
maintwo kinds of copies are there:card_limits' least size is 1 MiB.VICTORY_CARD_BUFFERS_MIN_KB=64takes every title buffer to the card, but it is off by default.In another tree of this layer (PiloteBox, below), on an RTX 5090, the card's time was measured with GPU timestamps by command. The scene was one scene of about 4,850 draws a frame, with the Series X profile and a diagnostics build:
main's own default lies between those two cases: sinceb1d777a8it puts up to 1,280 MB of windows on the card. Measured onmainitself, the switch still took about 15 % off the frame.What changes
VICTORY_CARD_SIDE=1sets every size that no switch of its own sets:mainsends them: one buffer in a GPU upload heap, which the CPU writes across the bus, where the device has such heaps; two sides where it has none, or withVICTORY_WINDOW_UPLOAD=0. A window goes to the card up to 97 % of the budget, as a title buffer's copy whose room was kept (80 % onmain).card_room_kept) counts both totals, less what they hold already. It keeps at most 1.5 GiB for buffers and 2 GiB for windows: what they came to with everything on the 32 GB card (1.3 GB of buffers in 3,714 copies; the windows filled a 2 GB limit).The totals, by the budget the system gives (
video_memory), which is about nine tenths of the card:On the smaller cards, the copies made first take the room and the later ones stay in the PC's memory, as today. With no budget known, nothing changes.
Each switch of its own still wins:
VICTORY_CARD_BUFFERS_MIN_KB,VICTORY_CARD_BUFFERS_MIN_MB,VICTORY_CARD_BUFFERS_MB,VICTORY_CARD_WINDOWS_MBandVICTORY_WINDOW_UPLOAD. WithVICTORY_CARD_ROOM_FOR_BUFFERS=0, no room is kept and the windows' line stays at 80 %.At the first copy, one line says what was chosen:
what shaders touch is on the card's side (VICTORY_CARD_SIDE=1): the card's budget … MB; title buffers' copies from 64 KiB up to … MB, windows up to … MB through the bus, in GPU upload heaps, …; switches of their own set, which win: none(with two sideswhere the device has no such heaps);what shaders touch is placed as before, by its own switches (…).Switch unset: the same sizes and paths as
main.card_limitsgivesmain's values (a test checks them), windows still get 1,280 MB (in the upload heap where the device has one), and the line is stillbudget / 10 * 8. The room kept is the buffers' alone, as before.Through the bus. The placement keeps
main's way for windows. In the other tree, with the same build and scene, the median frame of each run's last minute, the two ways alternated:The later runs of both ways had other programs on the card. With the bus, the thread that prepares submissions worked about 7 ms less a frame. So the bus is the faster way or an equal one, and it spares the PC's memory a second copy of each window, as
main's run 273 found.Why it is off.
main's test machine is a 12 GB card at 9.2 to 9.6 GB of a 10.3 GB budget. On that card,main's run 295 (diagnostics/README.md) traced black surfaces to 2 GB of windows on the card: textures waited for room. With 512 MB of windows, the surfaces were textured again. The 12 GB row here (1 GB of buffers and 1 GB of windows, their room kept) has not run, and neither have the 8, 16 and 24 GB rows. Issue #1163 adds a second risk on small cards: with small buffers allowed under a flat cap, small copies fill the cap before the large ones come. On the 32 GB card the buffers came to 1.2 to 1.3 GB of a 3 GB cap, so that case did not arise there. Before this could be on by default for a size of card, a run on that card should read what is listed under "Not tested".A follow-up could turn it on by default where the budget is over 26 GiB, the one row measured (32 GB cards), once the pictures there have been looked at.
Measured
This branch on
mainBuild:
main9a9091d1with #854 (so that the title's 64-lane programs run on a 32-lane card), #1450 (so that a new cache reaches the world) and this branch. Diagnostics build, Series X profile, RTX 5090 (32 GB) and i9-14900KF.Method:
VICTORY_BVH_BUILDER=0 VICTORY_PIPELINE_COMPUTE_WAIT=0;The pipeline library had been filled before, by two warm-up runs with the same switches.
main's ownVICTORY_CARD_SIDE=1main's ownVICTORY_CARD_SIDE=1That is about 15 % off the frame. No fault and no device loss in the four runs.
From the lines of A and B. The first three come from the frame log's usual frame (184 and 138 ms); the others are each run's last such line:
Before this branch ran, in other trees
maindoes not share line for line.VICTORY_CARD_BUFFERS_MIN_KB=64,VICTORY_CARD_BUFFERS_MB=1536andVICTORY_CARD_WINDOWS_MB=1024, a reservation switch of that tree, and other thread counts, so its figures are not of the placement alone.Tested
The branch was checked as it is, on
9a9091d1, on the software adapter (no card), with the commands ofmain's CI:cargo test -p victory-gpu --locked -- --test-threads=1withVICTORY_D3D12_WARP=1: 245 passed, 0 failed, 7 ignored. The three new tests are among them:the_set_grows_with_the_card: the table;a_switch_of_its_own_wins_over_the_set:main's limits without the set, and each switch over it;the_room_kept_counts_the_windows_with_the_set.cargo test --workspace --locked --exclude victory-gpu -- --test-threads=1withVICTORY_WARP=1: every package passes exceptvictory-shader, which has 247 passed and 5 failed. They are the same five that fail onmain:ds_min_max_f32_order_floats_and_return_the_old_value,legacy_mad_fuses_its_product_and_flushes_its_sources,v_permlane16_and_x16_read_the_lanes_their_selectors_pick,whole_wave_f64_sum_and_cvt_f32_f64anda_lane_mask_joined_with_a_number_is_read_as_the_number_it_is.cargo clippy --workspace --all-targets --locked -- -D warnings, and the same with--all-features: the only errors aremain's own 7 lints invictory-shader's tests (valu_tests.rs,wave64_after_loop.rs).victory-gpuis clean both ways.The switch itself runs in no test: it is read once per process.
Overlaps with open pull requests
card_limits' defaults by the budget. It changes the same function; here the sizes change only with the switch.window_card_room, which this changes on one line.VICTORY_VIDEO_BUDGET_MB).Not tested
mainwith the switch. The measured runs took no captures.mainwith Shaders: what the paired form still lacks on 32-lane hosts (the structure builder's programs, DispatchX counts per lane, on by default), mesh programs over 32 KiB linked with their pixel program, and smaller fixes #854 did not reach the world on this card: the title's hang watchdog fired in the first world frame, twice, as in Regression after 52ac4ec: title crashes ~1 min in (write to 0x0 at image+0x23cf683) on RTX 5080 #1420.VICTORY_PIPELINE_COMPUTE_WAIT=0let the warm-up runs through.memory of textures: … passes that made none for lack of roomandhost copies the title fills: … alive: whether textures wait longer;no card copy for a title buffer of …: large buffers turned down;title buffers' host copies made so far, by where shaders read them;windows outside buffers and the card's memory;usual frameand its card columns.VICTORY_INPLACE=1with the switch: every title buffer's copy then goes to the card, so no title buffer is used in place. Windows still are.Where this also lives
The placement this ports is in PiloteBox (https://github.com/PiloteCode/PiloteBox), a tree kept up to date for NVIDIA cards. There it is on by default on NVIDIA cards and, since its 0.13.1, sends windows through the bus as here; this branch is its port to
main's code. Its 0.13.1 runs the Series X profile at about 21 frames a second on an RTX 5090 (46.6 and 48.8 ms a frame in one scene; its changelog says how that was measured).