Repository navigation
Ray tracing: the title's structure builder runs without crashing it (dispatches by thread counts, title memory by address made ready); node tests answer no hit while it is off (stacked on #854 and #993) - #994
Conversation
…s-only count `cargo clippy --workspace --all-targets -- -D warnings` (CI) fails on 9376fd6 with this toolchain: unnecessary_sort_by in draw.rs, the bench's depth_written in indirect.rs never read, and placed_filler_twins unused without the diagnostics feature. No code changes.
…rams over 32 KiB linked with their pixel program, and more: 230 more programs pass Over the title's shader pack (`victory translate --validate --pipelines` on an RTX 5090, 32-lane waves), 25,682 of 25,953 programs translate, validate and get a pipeline, against 25,452 on 9376fd6 (compute 2,729 against 2,695, mesh 8,694 against 8,657, pixel 12,067 against 11,947, vertex 2,192 against 2,153). Of the 271 left, 195 are the unused voxel geometry stages and 71 the mesh programs below, valid once linked. - Wave64 compute programs on 32-lane hosts in a paired form: each console wave runs as one host wave, each thread two of its lanes (n and n + 32); every per-lane branch is taken by the whole wave with EXEC as each lane's guard, and lane reads, permutes, lane masks and reductions take both halves through the host wave's own operations. Tried after every other form for a program the host refuses (it asks for 64-lane waves) or that does not translate: 28 programs (screen-space tracing tiles, particles, decal trails, hair shadow masks, alpha resolve, three structure-builder programs, a cascade shadow program). Tried before the per-half forms that are approximate: 36 programs in which each half-wave counted, ORed or elected over its own 32 lanes now run as on the console. VICTORY_WAVE_PAIRS=0 turns it off. The allocation idiom also takes a base with a multiply-add (three lens-flare scans keep their per-half form, which is exact for them). - Mesh programs whose outputs pass D3D12's 32 KiB as translated alone (71: pedestrian, vehicle and prop transforms, 65 to 71 components for 128 vertices; NVIDIA builds them, the validator refuses them) are translated again with the pixel program of the pipeline (emit::link_mesh): the mesh program writes only what the pixel program reads, which declares only the inputs it reads. pipeline/host.rs makes such a pipeline from the linked pair (once per pair, same root signature and bindings; VICTORY_MESH_LINK=0 turns it off). `victory translate` with VICTORY_PAIRS links and validates pairs as the runtime does: 710 pairs (each of the 71 with the ten pixel programs that read most of its outputs) link, validate and get a pipeline. - One interpolation mode per signature register (70 programs: a float the console declared nointerpolation beside an integer or the front face); signature rows in the validator's order (72 programs); a level-of-detail query of an array texture leaves the layer undefined. - An immediate sampler chosen by a uniform branch: the block is copied for each way in (ir::split_joins; the terrain programs). - Pixel programs ordered by primitive (POPS) go past the console's wait and use rasterizer-ordered views (ten cut-out programs). - A 16-bit write over a first interpolation half reads that half as zero (eight deferred and decal programs). The write of zero over every first half (v_interp_p1_f32, v_interp_p1ll_f16) is left out: with it, 59 pixel programs that translated came out changed and none more translated; the retry with first-half pairs stays. - Whole-wave sections that a jump splits are joined into one block (the water optical depth program), tried first for a program whose permutes no followed section holds; elsewhere the v_permlane16/x16 lowering stands. - 64-bit floats and their wave sums (five water volumetrics programs), one implementation of the two that existed (float64.rs): both dwords of a sum from one host wave operation (in place of Red64F/ActiveF64, which summed each dword on its own), v_add_f64, v_mul_f64, v_cvt_f64_f32, and the IEEE v_cvt_f32_f64 on integers. Its unused flush-to-zero twin and ignored test are left out. - Descriptors read only for their size, one implementation of the two (descriptor_data.rs): a buffer with a used-resource entry gets the title's view, structured where its elements are whole dwords (a raw handle of such a view answered 2 records where it holds 9 on the RTX 5090); VICTORY_DESC_WHY stays. - A subtraction on group-shared memory (ds_sub, or ds_add of 0 - x) is a compare-exchange loop: NVIDIA's compiler refuses the pipeline otherwise (E_OUTOFMEMORY; DXC's own InterlockedAdd(g, -x) too). The weather particle update gets a pipeline. - A lane mask parked in two VGPR lanes that also hold single scalars comes back as the mask (ir::with_shared_slots; the voxelization program). - Loops of programs that test rays against tree nodes stop at 1,024 iterations (the compute limit is 4,096): with the title's builder off, a walk follows whatever memory holds. Shadow mask 11.7 -> 2.4 ms a frame in timing runs of the opening of the gameplay. The allocation-idiom check (idiom.rs), descriptors read as data (descriptor_data.rs) and 64-bit floats (float64.rs) are modules of their own, so that lower.rs stays under the asset policy's 512 KiB a file. Tests: each new form is run on the card against what the console's 64 lanes give; the linked signatures, the LDS subtraction loop, the shared slots, the joined sections and the descriptor sizes have tests of their own.
…, mesh programs linked with their pixel program (VICTORY_MESH_LINK) The whole pack on an RTX 5090 (32-lane waves): 25,682 of 25,953 programs translate, validate and get a pipeline, against 25,452 at 9376fd6. All 52 structure-builder programs translate (three in the paired form); switched on in game runs, the builder crashed the title about 80 s into the gameplay, so it stays off.
…ate sessions; no conflict
…them The shader tests' host can now bind a root UAV as a table of one raw view (`Root::Uav`, and `Root::UavAlias` for a destination that is its source, as the title rehydrates its structures in place) for a root signature from `Host::compute_pipeline_bounded`, as the layer binds root UAVs: an access past the buffer's end is dropped. An unbounded root UAV let random inputs write past the buffers and remove the device. The views' contents come back after the heap's UAVs, in the order of the roots.
…024,...) The limits of translated loops were literals in count_iteration, and the switch set one limit for every stage. Now they are named per stage (pixel 128, vertex and mesh 256, compute 4,096, ray tracing 1,024, as before) and the switch can set one stage alone (`stage:n` pairs) or all (one number); the shader cache keys on all four. The documentation says what a lane at the limit does: where the loop branches back on a condition it leaves the loop and goes on; where it jumps back it leaves the program (a pixel discards).
…s limit (VICTORY_LOOP_NOTES=1) With the switch, every program with a counted loop gets a root UAV of ours (u252, space 1) and each lane that reaches a loop's limit adds one to that loop's record: the lanes that left the loop and went on, and the lanes the limit took out of the program, by the loop's first code byte. The host binds each program a range of one shared buffer of its own at its first draw and logs the records that grew every five seconds, by stage and hash. A helper lane of a pixel shader writes nothing, so it is never counted. Off by default: it adds a root parameter to every program with a loop. Part of the shader cache key. First run, the opening cutscene from a new game (8 minutes, 254 programs with counted loops drawn): only the three environment BRDF integration programs reached a limit, all 65,536 texels of each table in each of their six loops; no lane of any program was taken out.
The console runs a pixel program's helper lanes as lanes of EXEC (the program starts with s_wqm), so a waterfall loop over descriptors serves a helper lane in a pass of its own, with its own descriptor. The host's wave operations leave helper lanes out (SM 6.6) and give them undefined results: a helper lane whose value no other lane of its wave held never met it as the first lane, went round the translated loop to the iteration limit (with the loop's samples each pass) and left with what the loop computes never set, which its quad's derivatives then read. The character skin and cloth program (94d281151ca58b4f) samples its material layers in nine such nested loops. A first-lane read in a pixel program now gives a helper lane its own value; since scalar code made of such a read may then differ in helper lanes, every heap handle of such a program is created non-uniform. Test: a waterfall over each pixel's own number, with the count of the lane across the quad's x read through a quad permute. On the RTX 5090 the helper lane's count was 0 (never served) before, 1 now; WARP agrees.
…limit The iteration limit is for loops whose end the data decides (a count read from memory the host has not got yet). A loop whose exit is a scalar counter that starts at a constant, moves by a constant step each pass and is compared with a constant (at its bottom, or at its top with a jump back) runs as often as the console's, up to 65,536 passes: its limit becomes its own count. The title's environment BRDF integration tables (PS_IntegrateEnvBRDF, the Beckmann and thin-film variants) integrate 1,024 samples a texel, two or four a pass, in six loops of 256 or 512 passes. At the pixel limit of 128 every one of the 65,536 texels of each table stopped at a half or a quarter of its samples (loop notes, opening cutscene), and the tables, which every specular reflection reads, held a half or a quarter of their values. Translated now with limits of 256 and 512. Tests: the count analysis on synthetic loops (bottom and top tests, four adds a pass, counts the data bounds or that never meet their constant), and a compute loop of 5,000 passes that runs past the compute limit on the GPU and WARP.
Where two host waves run one console wave of 64 lanes, they exchange first lanes, masks and LDS order through group barriers, only in blocks every lane runs (`all_lane_blocks`): no per-lane branch's region, the blocks a branch reaches that do not post-dominate it. A loop each lane leaves on its own (its back edge or a break on the lane's own bit) has blocks that post-dominate the branch, its own among them, yet only the lanes that stayed run them again: a waterfall loop in one block was taken for code every lane runs and got two host waves' exchange of the first lane, four group barriers a pass, which lanes that had left met at other barriers. In the projected-decal classification (CS_ProjDecalReduceClassification_Scalarized, 1f1fbd86759b3da2) lanes then never met their descriptor and ran to the compute limit of 4,096 passes: 77 lanes in each of five loops, 44, 19 and 1 in three more, in seven minutes of the gameplay's opening (loop notes); those lanes lost their loads. A loop a lane branch leaves is now part of that branch's region (natural loops of the lane exits). Of the 1,085 compute programs seen in the title's runs, two translate differently: the decal classification takes each host wave on its own (approximate: the tile's sums are each half's; the exact paired form is tried after the approximate ones), and CS_SortRayTiles (a1bf269d5b19f025) keeps its form with its LDS ordered by group barriers at the loop's ends. Test: the waterfall's block is not every lane's, a scalar loop around a lane branch still is.
…n 100 columns, tests last, lint)
lower.rs had grown past the asset policy's 512 KiB per file (533,966 bytes; `cargo xtask policy` refused it). The limits by stage, the count and its test on back edges and the loop notes move to emit/loops.rs, the regions of lane branches (blocks every lane runs, the natural loops they leave) to emit/regions.rs, both child modules of the lowering. No change in what is emitted; lower.rs is 520,593 bytes.
…t by ending the lane A loop that goes round by jumps back alone has its exit test elsewhere in its body; at the limit its jump back could only end the lane (a pixel discarded, a mesh or compute lane stopped before its writes). Its exit tests now take the limit too, so a lane at the limit leaves there and goes on with the program, as one does at a branch back; the jump back still ends a lane whose way round passes no exit test. With the limits raised to 1,024 / 4,096 / 65,536 (VICTORY_SHADER_LOOP_LIMIT, loop notes) the opening cutscene lost the card again, 9 minutes in, and the notes named loops of that kind that never end: PS_Textured_Eight (b37565055f2f7d3b, 1af4a50c7fb40c97), whose search of its shadow cascades reads its cascade count as 0 (the count minus one never stops it), 10,441 pixels taken out at 1,024 (holes in what it draws); and the projected-decal resolve's walk of its decal bits (c4183d3cbee28e8e, in the approximate one-host-wave form), 10,381 lanes at 65,536. The limits stay where they were; the comment records why. The loop limit's helpers (`limit_of`, the exit test, the search for such loops) live in emit/loops.rs. Tests: a loop closed by a jump goes on with s6 at the limit; one whose way round skips its exit still ends the lane.
…ery stage
With loop notes (VICTORY_LOOP_NOTES=1) every program with a counted loop
binds the notes as a root UAV. A vertex or mesh program that binds a UAV
must say so (ShaderFlags bit 16, SFI0 0x4); without it the validator
refused 62 of the 801 vertex and mesh programs of a game run translated
with notes ("Flags must match usage"); with it they all validate (but
the two whose outputs pass 32 KiB, as without notes). The runtime does
not validate, so the game ran them as they were.
Test: a vertex program writing the notes' UAV validates.
For an A/B of what the fix changes on screen: with the switch at 0, helper lanes of pixel programs read the host wave's first lane in the title's first-lane reads again, as before. On by default; part of the shader cache key (the build script lists every VICTORY_ switch the translator reads).
…remote-desktop reset The opening cutscene run with the limits raised to 1,024 / 4,096 / 65,536 did not lose the card to a long loop: Windows reset it 2.5 s after a Parsec session ended (09:54:32 disconnect, 09:54:34 "Resetting TDR"), as in the day's other losses. The limits stay where they are for the reason the loop notes give: no loop needs more, and the ones that reach them never end (PS_Textured_Eight's cascade search, the decal resolve).
…5,535 groups in x is named The clamp of indirect records counts, per list, the compute records that ask for more groups in x than one dispatch runs (up to 93,648 in the runs of this morning, cut to 65,535: the rest never run), but not whose they are. At recording, the arguments are now read where title memory has them (the card writes them, so this is an earlier frame's copy-back), and the first record over the limit of each program is logged with its counts.
…s count their groups from a base the host gives One host dispatch runs at most 65,535 groups in a dimension; the console runs more. The title's depth-of-field blur asks for up to 115,200 groups in x every frame of a defocused shot (2 x 57,600: one group per 8x8 tile of each of its two layers at 2560x1440; the clamp of indirect records counted 81,064 to 115,200 asked, 0.3 to 3.5 records a frame cut, in the opening's first minutes), and the clamp cut the record to 65,535: the groups past it never ran. The tiles of the second layer past that point stayed unblurred, which shows as blocks: in the kitchen shot the blinds are blurred above a row and, in that row, left of a column, sharp everywhere after it, the shape of a tile list in reading order cut after its 65,535th tile. - Translator: a compute program's group id in x adds a user-data dword the host computes, USER_GROUP_BASE (0x104), as the host's other words are given (not for programs with a spilled user-data table, whose root signature is close to the host's 64 dwords). - Direct dispatches of more than 65,535 groups in x run as several, each told its first group by a root constant. - Indirect dispatches of such programs are clamped as split dispatches (a kind of the clamp's own): each record becomes four records of the base and the counts, at most 65,535 groups in x each (up to 262,140 in all), run through a command signature that sets the base and dispatches; the records past a count buffer's count come out empty, and every one runs. Tests: on the software adapter, a record of 100,000 groups runs each group from 0 to 99,999 once and a record past the count runs none; the clamped records and the budget charged are checked. A compute program reading its group id in x asks for the base; one reading y does not. The 3,418 shaders of this morning's runs translate with the change (warm-up, 94 s).
A split dispatch's command signature is cached by the address of the root signature it was made for (with the root parameter and dword of the group base). D3D12 does not say that a command signature holds a reference to its root signature: with the root signature released and another made at the same address, the cache would hand out a signature made for the first, and ExecuteIndirect with a command signature of another root signature is undefined. The cache now keeps the root signature alive with it, so an address in the cache names one root signature for the whole run. Few root signatures run split dispatches (the screen-probe final gather's and the meshlet culling's in the general tests), so nothing much is kept.
A program that counts its groups from a base is named once (info) when its indirect dispatch asks for more than 65,535 groups in x, and run as several; one that asks for more than runs even so is still a warning.
It runs nothing whatever its x (one such record, 6,062,079 x 0 x 0, was named in the opening run of the split dispatches).
…a 32-lane host With VICTORY_SHADER_CENSUS, `victory translate` now writes `form=` for each console wave64 compute program translated for a host of 32-lane waves: paired, local (each host wave on its own), local-any (approximate), exchange (two host waves meeting at group barriers), halves (two host waves with nothing to exchange) or wave64 (refused by such a host); empty for every other program. The lowering names its form, and each program emitted since the last `emit` is remembered by its DXIL, so the form of the one `emit` returns is known whatever forms were tried before it. On integration (9376fd6 merged), the title's wave64 compute programs: 69 paired, 30 local (all the allocation idiom, exact), 160 exchange, 141 halves, none refused.
…re only lanes inside the guard read it In the paired form every per-lane branch is the wave's, so EXEC stays a guard on each vector instruction and a guarded write is select(guard, new, old): about a sixth of the paired programs' host code (360,668 of 2,303,768 instructions in the title's 69 paired programs, against 29,850 selects of that kind in all the other forms of the same programs), each keeping the register's old value alive. A lane that reads the register under a guard that implies the writer's ran the write, so it now reads the value as computed: its own registers only (not a DPP source, a lane read or write, a swizzle or permute, which read other lanes), never the old value a write keeps for the lanes outside its guard. The reader reads the writer's SSA value, so the writer dominates it and no atom of the writer's guard is defined again in between: both guards are evaluated on the same lane-mask atoms, and the implication of the two functions (Bools::meet) holds lane by lane. The selects nothing reads any more go with the clean-up's dead code. Offline (CPU census, every program of the title): only the 69 paired programs change; their host instructions 2,303,768 -> 1,617,871 (-30%), guard selects 360,668 -> 124,509, joins 151,991 -> 122,297. VICTORY_WAVE_RAW=0 turns it off. Test: values written and read under the same guard, a narrower one in the block and in a nested branch, a wider one after it and by every lane past the branch, floats and an accumulator, against the console's 64 lanes.
…n as two host waves of their own, not meeting at group barriers A console wave64 compute program whose wave-wide values are used only as the allocation idiom uses them (idiom::wave_local: each wave's first lane reserves its count on a shared counter, every lane takes the base plus its rank) is exact with each host wave on its own: the same records, reserved by each half in another order. That form was only tried for programs no form in two host waves took, so a program the exchange form also translated took that one: two host waves meeting at two group barriers for each first-lane read, mask and sum. CS_Primary_RegisterAllocationRequests (33 group barriers in 681 host instructions) took 3.7 ms of the card per dispatch in the opening cutscene, 2.8 ms a frame, the most of any wave64 program; its irradiance-cache twin 0.5 ms a frame. Where the exchange form translates a program, the local form is now tried and kept if it translates (split::local_if_exact). The idiom check also took every guarded write as mixing the register's old value (a wave count, say) into the lanes outside its EXEC, read or not: the light-probe allocations reuse the register that held the count for the first lane's lane number. Such a write now keeps its kind where no reader can see those lanes (split::read_inside_only): followed through the guarded writes that keep it and the joins that take it, every reader of its own lane reads under a guard that lies, where it stands, inside the guards written since the old value; a reader of other lanes and a loop's join count as seeing them, a whole-wave section's select by its mask, a first-lane read by its own guard (the idiom's shortcut for first-lane reads). Offline (CPU census of every program, the same build with the switch off): 40 of the 160 exchange-form programs take the local form (both allocation requests, the depth-of-field and trail-map tile classifications, the depth pyramids, shadow-mask denoises, ray-bin offsets, the screen-space ray pre-passes, water patch culling, among them), and 5 of the 70 paired programs (the four temporal resolves that count frame statistics, and lens_flares CS_ScanMip0, the idiom with a multiply-add as its three siblings); no other program changes. Their host instructions: the 5 paired ones 48,501 -> 19,039. VICTORY_WAVE_SPLIT=0 turns both off. Diagnostics builds: VICTORY_WAVE_PAIRED_OVER_EXCHANGE=1 gives the remaining exchange-form programs the paired form, to time the two in a run. Test: an allocation that reuses its count register as the light-probe requests do takes the local form; on the card its counter and records against the console's (the paired form's also in the console's order).
…ps only its system values The 71 mesh programs whose outputs pass D3D12's 32 KiB as translated alone (128 vertices of 65 to 71 components) were linked with the pixel program of their pipeline (link_mesh), but a pipeline without one, as the title makes for depth (14,576 binds of 143 mesh programs alone in the runs so far), got the invalid translation as it is. link_mesh_alone translates such a program again without its outputs of arbitrary semantics, which only a pixel program reads: position, clip and cull distances stay, and it fits. The runtime makes those pipelines with it; the offline census, whose stub pixel program reads nothing, checks that form of the 71 (all 71 validate and get a pipeline, RTX 5090) and counts them on its mesh line. None of the 71 was drawn alone in the runs so far: the two drawn (72da0ba1efaec1e0, 8a621a22094767f3) came with pixel programs and linked.
The census's 195 geometry programs (all GS_VoxelizeGeneric variants) stopped at resource tracking: their first load reads the console driver's table that user data 0 and 1 point at. The console runs such a program in one hardware stage after the ES half of its vertex program: it reads its triangle's vertices from LDS at the offsets v0 and v1 hold (16 bits each), writes the vertices it emits to its lane's slot of the GS-VS ring, also in LDS, and sends a GS message for each emit and cut. The stage data gives the ring's layout (vertex count and dwords per vertex, four per register of the output signature; StageIo::Gs). The host runs the ES half as the vertex program it is (the container's VS program, the other compilation of the same HLSL) and the program as a geometry shader of one invocation per primitive (crate::geometry, emit/rings.rs): the address of each LDS access is followed to the input vertex and dword it reads, or the emitted vertex and dword it writes; a ring read is that input's loadInput, a ring write is kept as that vertex's output, and the n-th emit stores vertex n's outputs and emits it. The load from the driver's table only places the ring (resource::DRIVER: its value is never needed). The prologue that narrows EXEC to the wave's GS threads keeps every lane (NativeProgram::patched_code). The primitive id (v2) is the host's; an invocation id (v3, instancing), vertices 4 and 5 (adjacency), another stream or emits in branches are refused. Offline (32-lane host) all 195 translate and validate (the census's new geometry line), the DXIL of every other program unchanged; their pipelines between a stub vertex and pixel shader build on the WARP device (the card's are left to the general test session). Tests: the rings of a program of the console's form written for them, the refusals, the prologue, the primitive id, and that program drawn between a pass-through vertex and pixel shader (every texel as it writes it; passed on WARP). No run so far drew with a geometry stage.
A pipeline whose stream has a geometry shader was refused ("only vertex,
mesh, pixel and compute stages are translated") and its draws dropped. Its
geometry program now translates (the commit before): the host pipeline is
the vertex program, the pixel program and the geometry program between
them, its user data and views bound per stage as the others' (stage last,
so the pixel stage keeps its place; no rectangle stage beside it, and none
in a mesh pipeline). Its library entry has a name of its own. The translated
geometry stage brings its used-resource entries like the other stages.
shortcut: not run in the title yet: none of the runs so far (opening
cutscene, gameplay from the user's save) drew with a geometry stage.
… that allocate, dispatches past 65,535 groups Four lines in the summary: the 195 geometry programs run as host geometry shaders (no run has drawn with one), oversized mesh programs drawn without a pixel program keep their system values, and the CPU census (25,948 of 25,953 translate and validate; the rest: five ray-trace programs); the loop fixes; the two wave64 forms; the split of dispatches past 65,535 groups in x. VICTORY_WAVE_SPLIT and VICTORY_WAVE_RAW in the table of switches, VICTORY_MESH_LINK's alone form, and geometry stages out of what the shaders lack.
Five of the title's sun-shadow trace programs (shadowmask:CS_TraceShadowRays at full, half, quarter and eighth resolution) take the address of their ray-tracing structure out of a buffer descriptor they pick from the view heap at an index they compute, and walk the structure from it: they stopped at "a descriptor read only as data". The host now keeps, per view heap, a table of each slot's view address (buffer views, and ray-tracing structure views) beside the table of strides, and such a load reads it (root SRV t252 in space 1). Offline (`victory translate`, VICTORY_HOST_MAX_WAVE=32, the game's shader archive): compute programs 2677 -> 2681 of 2682 emitted, nothing else changed; the four validate and get pipelines. The fifth (FullAdaptive) now stops further on, at a lane mask read as data. In the user-save scenario the title uses the checkerboard variant, which translated before.
…uns on the card in the form the card takes
|
@BradRoland thanks, that is a real defect and your fix is the right one. With the structures off, the first look in the directory was still emitted, with a false predicate, before the branch on Your commit
The missing-page fix you adapted from #1165 is not taken here: it belongs with #1165, and this PR stays what it was plus your correction. |
|
@deadkid14 thanks for the report and for what you ruled out. A read of Two runs would tell:
If it is the first, a stub pixel shader for those pipelines under Proton would be the way round it (the offline census already builds them that way); say so and we will add it behind a switch. |
|
@Zayfway @Exopus-0x65f7ad0 @Yorivel thanks for the three reports.
|
…=1, off by default); VICTORY_WAVE_WIDE=last (fork PR #1141) The structure builder does not run unless asked for, and the title's ray-traced passes run all the same: every node test then reads whatever bytes lie where a structure would be, in a walk bounded at 65,535 steps a wave. With VICTORY_BVH_NO_HIT=1 (and not VICTORY_BVH_BUILDER=1) a box node enters no child and any other node is missed: every ray leaves at its first test, the answer is the same in every run, and the program asks the host for neither the directory of title memory nor the list of missing pages (unit test). The idea is fork PR #994's, done here at translation instead of by a host word. Also fork PR #1141 as it is (VICTORY_WAVE_WIDE=last: the barrier form only for programs every other form leaves at 64 lanes; opt-in), and the comment on the wide loads corrected (not the same result on the card: run 277). A TRANSLATOR EDIT: an exe from here on has a new shader fingerprint; wipe the DXIL cache and the pipeline library before its first launch. Not run in a game. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
@PiloteCode thanks. Results of the two checks you asked for, same tree as my report (main
The program: I added a log line before each library load and make, with the thread, and compared what was in flight at three crashes. Each time, the crash follows the start of the make of
The same program builds fine in the same tree without #993/#994 ( Something else turned up while looking, in both builds: four compute pipelines start and never finish on this stack ( I can run a build that leaves AI-assisted: Claude Code ran the builds and tests on my machine, read the logs and wrote this comment; posted at my request. |
|
AI-assisted (Claude Code). Numbers and log lines only, no game data. RTX 5070 12 GB, 32 GB RAM, builder on, no quarantine: no crash, no device loss, 6 min 17 s with the builder, and the picture looked right to the player. On Setup. RTX 5070 12 GB (32-lane waves, driver 610.88; an RTX 3060 in the same PC, the game on the 5070 by Windows' per-app GPU preference), Core Ultra 7 270K Plus, 32 GB with a 32 GB paging file, Windows 11 26300, Series X profile, release build (no diagnostics). Tree: fork Merging. Since the last merge of
The run. 10 min 51 s; the builder came up at 3 min 30 s ("all of its programs have host pipelines", 53). From then on:
For comparison, without this PR. On 32 GB the builder fits for these six minutes; with shared memory still growing at the end, a longer run would tell whether it stops. |
|
Follow-up on Linux with this PR's current head ( The result is the same crash as before, so This was at frame 1268. A cached form of the same program had bound earlier at that frame, and the crash comes right after this new translation of it. No Xid and no device loss. So on Windows the driver takes this pipeline, and under Wine vkd3d-proton fails on it with a null read. I haven't tried a newer vkd3d-proton than GE-Proton11-14's. If someone on Linux has one built from master, this program would be the one to check. AI-assisted: Claude Code ran the builds and tests on my machine, read the logs and wrote this comment; posted at my request. |
|
AI-assisted (Claude Code). Numbers and log lines only, no game data. Correction to my comment above: the tree I tested had this PR's A longer run of the same build (
So with this PR the builder runs for an hour on 32 GB without crashing, and memory holds. The limit we hit is the copy numbers, which #1082 addresses. It conflicts with this PR only in |
|
Linux follow-up: with a newer vkd3d-proton the structure builder now starts here. The game then hangs about 50 s into the world. Tree: this PR at
The hang with master: the last log line is So with vkd3d-proton master the builder's own pipelines all get made, which GE-Proton11-14's build never got to. I can't say the mesh/pixel crash is gone: this run hung at frame 1315, before the frame (1464) where the earlier run crashed. The next blocker is this spin after the builder starts. If there's a trace switch that would show what the spinning thread waits for, I can run it. AI-assisted: Claude Code ran the builds and tests on my machine, read the logs and wrote this comment; posted at my request. |
|
AI-assisted (Claude Code). Numbers and log lines only, no game data. @deadkid14 for the spin there's a switch already in this tree: The log may already narrow it. The For comparison, on Windows (RTX 5070, this PR + |
|
An update to my 589 ms figure above, on the same RTX 5070 Ti (Series S profile, Windows 11). Our main stack now carries #993 and this PR at
Correction (2026-11-26): with the builder on, the skin draw was missing in both builder-on runs, including the one with AI-assisted (Claude Code). |
…om spare trim, RT DispatchX hardening & SRWLOCKs - Lazy materialization for read-only 2D/3D slot-133 textures (clean-room MIT from R0Y00/Xbox2Windows#2773): defer CreateCommittedResource / VkImage + VRAM allocation until first SRV/view/copy/barrier use while answering metadata/residency queries and untouched Release with zero VRAM (LEONIDA_LAZY_SLOT133_TEXTURES). - 256 MiB existing-heap / page-commit cap for slot-133 buffers (clean-room MIT from R0Y00/Xbox2Windows#2775): oversized title buffer reservations fall back to committed DEFAULT without whole-span page commit (LEONIDA_SLOT133_HEAP_CAP_MB, LEONIDA_UNBOUNDED_EXISTING_HEAP). - VRAM-headroom-scaled spare pool retention, 64-frame idle upload-ring reclamation & non-local shared memory pressure tracking (GPL-3.0 from avatarmanz/VIctory-7900XTX#119 and Marvisak/VIctory#2972). - RT structure builder DispatchX hardening (GPL-3.0 from fxceless/victory-fork#994): accept compact 20-byte FSPX kind0 headers (w4 at byte 16..19) and inherit compute workgroup dims through derived PSOs (slot 55). - Reader-writer SRWLOCK conversion for hot read-mostly registries in d3d12_xs_device.cpp (GPL-3.0 from wolfattack199/victory-fork@d3d3760) with zero non-trivial thread_local. - Unit tests in d3d12_xs_format_sanitize_test.cpp and d3d12_texture_mip_drop_test.cpp. Verified: 10/10 CTests passed on NVIDIA GeForce RTX 3080 under LEONIDA_VK_VALIDATION=1 (0 validation errors); check_no_game_data.py 0 violations.
|
AI-assisted (Claude Code). Numbers and log lines only, no game data. Follow-up to the boat and the black surfaces in my earlier comments here and on #1082. Neither one comes from this PR. The boat was the water copy-back being off. I suggested the boat's engine might break because pages read zeros after the copy numbers ran out. That was wrong. I ran the same part of the game four ways on main + #994 + #1082 (da19199):
This is the known water bug (#863, #1034): the boat floats on wave heights the GPU writes, and without the copy-back the CPU reads nothing there. With the copy-back on, the builder doesn't change anything at the boat. The four water textures were copied back 646 times in the builder run. There was one The black surfaces aren't from the builder either. Surfaces in shade (house walls, a wheelbarrow, parts of the dock, the building at the camp) come out flat black. They look the same with the builder on or off, so it's something else. Still open: one indoor scene at the camp (the "Press X to fight" prompt) came out washed white with smeared streaks. That was with the builder on; I don't have the same moment with it off yet, so I can't say whether the builder is involved. Cost of the builder in the same place: with it, frames took about 340–770 ms; without it, about 290–450 ms (RTX 5070, 32 GB PC). #1082's reclaim kept the run going after the copy numbers ran out at +28 min (7 give-backs, no crash). |
|
With the builder on ( Setup
What we saw
Cause Fix - Some(&Root::Table(table)) => crate::descriptor::view(table + u64::from(dword) * 4)
- .and_then(|view| crate::descriptor::host::buffer_range(&view))
- .map_or(0, |range| range.0),
+ Some(&Root::Table(table)) => crate::descriptor::view(table + u64::from(dword) * 4)
+ .map_or(0, |view| crate::descriptor::host::view_address(&view)),After the fix (same switches)
Not tested
|
|
Correction to the cost numbers above: the 0.1–0.6 fps was measured with With the probe off, same build and switches (
|
|
An RTX 3090 Ti data point (32-lane, 24 GB; 62 GB RAM, Windows 11), this PR at As published, Series X profile (
The builder came up with all 53 pipelines and ran 4 min 38 s to the run's limit. On With the README's speed switches ( Picture with the builder off (the no-hit node tests), same shot of the cell from behind, against
With the builder on, the top of the head and the shoulders are darker, with a rim of light from the window. I have not compared either against the console. Series S needs #798 on this base to show the world, so those runs are of a tree of mine (this PR + #911 + #798 + #1081 + our speed commits): about 81 ms a frame in the same shot, hair and window as above. One difference from Series X on the same build: the print on the back of the character's shirt is missing on Series S in 4 of 4 runs and there in 2 of 2 on Series X. Memory, for others with background apps open: the working set's peak comes at world entry with or without the builder (39 GB against 40.8 GB); the builder adds about 4 GB once settled. AI-assisted (Claude Code, Claude Fable 5.2). Numbers and descriptions only, no game data. |
…=1, off by default); VICTORY_WAVE_WIDE=last (fork PR fxceless#1141) The structure builder does not run unless asked for, and the title's ray-traced passes run all the same: every node test then reads whatever bytes lie where a structure would be, in a walk bounded at 65,535 steps a wave. With VICTORY_BVH_NO_HIT=1 (and not VICTORY_BVH_BUILDER=1) a box node enters no child and any other node is missed: every ray leaves at its first test, the answer is the same in every run, and the program asks the host for neither the directory of title memory nor the list of missing pages (unit test). The idea is fork PR fxceless#994's, done here at translation instead of by a host word. Also fork PR fxceless#1141 as it is (VICTORY_WAVE_WIDE=last: the barrier form only for programs every other form leaves at 64 lanes; opt-in), and the comment on the wide loads corrected (not the same result on the card: run 277). A TRANSLATOR EDIT: an exe from here on has a new shader fingerprint; wipe the DXIL cache and the pipeline library before its first launch. Not run in a game. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> (cherry picked from commit 96ff135) Port to coolfox-4gb: only the VICTORY_BVH_NO_HIT part (intersect.rs and its test). Left out: VICTORY_WAVE_WIDE=last (emit/mod.rs) and the opt.rs comment; coolfox keeps its own VICTORY_WAVE_WIDE policy. The switch joins the shader cache key by itself (build.rs lists every VICTORY_* name the translator reads). Not compiled, not run.
|
Local integration test of #994 at Hardware: Ryzen 7 9800X3D, 16 GB system RAM, RTX 3060 12 GB, NVIDIA 621.14, Windows 11. A newer retail game remained on an HDD; cache/profile were on SSD. Series X profile, builder enabled, D3D12 debug layer and input/BVH tracing enabled; no ambient substitute, shader skips, quarantine or dry builder mode. Runtime, 2026-11-26 19:40–20:05 UTC:
Validation of the tested integration: AI use: Codex, GPT-6 (exact serving variant not exposed), integrated the existing changes, ran the tests and local runtime checks, and wrote this report. No game data or raw traces are attached. |
Stacked on #993 (the second translator PR), which is itself stacked on #854. This PR's commits are the 21 after
README: geometry stages, loops as the console runs them, .... It needs that PR in two places:Where the builder stands
Until now, the title died about a frame after the structure builder's first frame, on pointers of all ones read from its own objects. The cause was the layer's: it took the builder's dispatches by thread counts for group counts (below).
With the fix, in runs of our tree on an RTX 5090:
VICTORY_BVH_BUILDER=1, its trace on): no fault and no card loss. Every stage ran, none was dropped (Dec 2,516, Leaf 2,516, Box32 7,446, Box16 14,719, ReloadTriangles and Refit 26,144 each, Construct 5,618, LoadInstances 2,032 dispatches), about 200 builder dispatches a frame once the world was up. In the window scene, the hair's light is steady with the builder on. With it off, it changed from run to run: dark in two runs, lit in one, because the passes walked whatever lay in memory.This PR keeps the builder opt-in, as on
main(VICTORY_BVH_BUILDER=1), for its cost:Whether the traced passes light as the console's do is still to be compared picture by picture.
What changes
Dispatches by thread counts run only those threads (
list.rs,draw.rs,pipeline.rs,shader_cache.rs,emit/lower.rs)DispatchX(x, y, z, flags)passes the console's dispatch initiator bits as its flags. The builder setsUSE_THREAD_DIMENSIONS(0x20; 0x8020 for its wave32 programs) on its header copies (DecompressHeader), its box rehydration of pre-built structures (Box32Rehydration, Box16Rehydration) and its triangle reloads (ReloadTriangles, ReloadProcedurals). There, x, y and z count threads: the last group is cut short, and no thread past the count is launched. The layer ran them as group counts.The box stages rebuild one level of a tree a dispatch, in place, one node a thread: group g writes its 64 nodes at g x 8 KiB (4 KiB for 16-bit boxes), and a lane count read off EXEC (
WaveAllBitCount) places each node's payload. In the first frame of a crashing run they ran 272,948 and 47,026 groups where 5,983 and 4,217 were wanted, and wrote 2.2 GiB of empty nodes past their levels. Where that was put back, it lay over the title's own objects, which share those pages at a CPU view 24 GiB lower. Every crash site of that run lies inside such an overrun.dispatch_xnow makes groups of the program's console size out of the counts. Where a last group is cut short:victory_shader::emit::translate_thread_limited), made at its first such dispatch and cached under a key of its own.USER_THREAD_LIMIT,RootType::Other(0x105)), only along a dimension whose groups are more than one thread wide.The plain translation is untouched: only dispatches by thread counts whose last group is cut short use the second form.
Title memory by address made ready for the builder (
list.rs,memory.rs,host.rs,queue.rs,pipeline.rs,draw.rs)List upload memory where shaders reach it. The builder hands its stages the addresses of tables it writes into list upload memory (
allocate_upload); its header stage reads its records through them. The layer gave out blocks of the process heap at 1.5-1.8 TiB, beyond the console's 40 bits and the directory of title memory by address (below 128 GiB): the records read as zeros and no structure header was written. Upload memory now comes from 4 MiB chunks of one 512 MiB write-watched reservation between 4 GiB and 128 GiB. Each chunk is a window of memory outside buffers, copied when a list that names it is submitted. Larger requests still come from the heap.The addresses in the records of upload memory are named. The leaf rehydration reads 48-byte
D3D12_RAYTRACING_GEOMETRY_TRIANGLES_DESCrecords through a root SRV in upload memory, and loads vertices and indices through the addresses in them, which no root argument names. In one run, 638 of the 2,139 such addresses lay in no copy when the stage ran, and those leaves read zeros. Before such a dispatch, the block of upload memory each root SRV points into is looked through (16 KiB at most) for 8-byte title addresses, which are named like the dispatch's own.Copies by address declared written only for address stores. A program that reaches title memory by address declared every numbered copy written as soon as it could store anywhere. Only a program that can store through a raw address now does (a flat or global store or atomic, not to scratch, or code not all known). Of the builder's 52 programs, 11 store that way.
Copies kept current where named. Each list that ran such a program refreshed all 1,023 numbered windows (4 GiB) and, if it could store, declared them all written. With the builder's dispatches bound and not run, that alone made a median of 975 ms a frame, against 353 without the builder. Now:
VICTORY_MEMORY_ALL=1restores the old way.The structures' sizes are copied on the card. The title copies each structure's compacted size out of the builder's buffer with
CopyBufferRegion, in the list that computed it. Done on the CPU at submission, the copy took what the buffer held before the list's shaders ran. In a list whose shaders store by address, a copy whose source those shaders declared written now runs on the card behind them, and its destination is declared written. Other title copies stay on the CPU.VICTORY_CARD_TITLE_COPIES=0turns this off.Remaps after the flights.
CopyPageMappingsBatchXmaps pool pages at once, while the console does it behind the work sent before. A remap now first waits for the flights in the air whose declared writes touch its range, so their writes are not put back into pages mapped there since.VICTORY_REMAP_LAND=0turns this off.View addresses read from the view heap by slot (
descriptor/host.rs,draw.rs,emit/lower.rs)Four sun-shadow trace programs (
shadowmask:CS_TraceShadowRaysat full, half, quarter and eighth resolution) take their structure's address out of a buffer descriptor they pick from the view heap at a computed index. They stopped at "a descriptor read only as data". The host keeps, per view heap, a table of each slot's view address (SLOT_VIEW_ADDRESSES, a root SRV beside the strides), and such a load reads it. The fifth (FullAdaptive) now stops further on, at a lane mask read as data.Node tests answer no hit while the builder does not run (
emit/intersect.rs,pipeline.rs,draw.rs)The title's ray-traced passes run whether or not anything built their structures. With the builder off, they walked whatever bytes lay where the structures would be: screen-aligned dark tiles on sunlit hair, lit squares in shadow, and hair dark in some runs and lit in others.
A program with a node test now reads a host word (
USER_STRUCTURES,RootType::Other(0x106)): 1 while the builder runs whole, 0 before its first dispatch, withoutVICTORY_BVH_BUILDER=1, or once it is turned off. While it is 0, every node test answers no hit without reading the node: rays escape, and shadow rays find no occluder.VICTORY_BVH_NO_HIT=0lets them walk memory, as before.Diagnostics (diagnostics builds)
VICTORY_BVH_TRACE=<file>, written unbuffered so that a crashing run keeps it. One line per:VICTORY_BVH_DRY=1binds the builder's dispatches without running them.VICTORY_BVH_CHECK=<hash>[,<hash>]walks the structures that the header stage, and the in-place rebuild's header stage, start, once their headers are put back. It reports bad nodes: bounds not finite, inverted or outside the parent's, nodes outside the structure or reached twice.VICTORY_CRASH_MEMORY=1adds to a crash report the title memory around each register that holds a title address, and one pointer further.Switches
VICTORY_BVH_BUILDERmain=1runs the builderVICTORY_BVH_NO_HIT=0: node tests walk memory while the builder does not run, as beforeVICTORY_MEMORY_ALL=1: every numbered copy refreshed and declared written, as beforeVICTORY_CARD_TITLE_COPIES=0: the title's buffer copies all on the CPU, as beforeVICTORY_REMAP_LAND=0: remaps do not wait for flightsVICTORY_BVH_TRACE,VICTORY_BVH_DRY,VICTORY_BVH_CHECK,VICTORY_CRASH_MEMORYTested
The branch was checked as it is. The card was reserved for other work, so the tests ran on the software adapter:
cargo test -p victory-shader -- --test-threads=1withVICTORY_WARP=1: 264 passed, 5 failed, 2 ignored. The five are the ones that fail on Shaders: wave64 programs in a paired form on 32-lane GPUs, mesh programs over 32 KiB linked with their pixel program, and more (230 more programs pass) #854's head merged withmainon the software adapter (see Shaders, second round: geometry programs as geometry shaders, loops as the console runs them, lighter wave64 forms, dispatches past 65,535 groups in x (stacked on #854) #993). The tests that need the title's builder DLL skip.cargo test -p victory-gpu --features diagnostics -- --test-threads=1withVICTORY_D3D12_WARP=1: 188 passed, 1 failed, 6 ignored. The failure isdepth_bounds_pipeline_loads_and_filters_draws, as on Shaders: wave64 programs in a paired form on 32-lane GPUs, mesh programs over 32 KiB linked with their pixel program, and more (230 more programs pass) #854's head: WARP does not reject the pixels outside the depth bounds.cargo test -p victoryandcargo test -p victory-loader: passed.cargo clippy --workspace --all-targets --locked -- -D warnings, and the same with--all-features: clean.cargo build --release -p victory,cargo build --profile diag -p victory --features diagnosticsandcargo xtask policy: pass.Offline census over the title's whole shader pack, as for #993 (
victory translate --validate --list,VICTORY_HOST_MAX_WAVE=32, CPU only: no pipelines): 25,952 of 25,953 programs translate and validate, against #993's 25,948. The four sun-shadow trace programs are the difference (compute 2,733 of 2,734). The one left is the FullAdaptive shadow-mask trace (a lane mask read as data). All 52 builder programs validate.New tests:
VICTORY_TEST_BVH_DLLpointing at the title'sXboxBvhBuilder.dll(skipped when unset), the builder's wave64 programs run in their picked and paired forms on the same inputs, and agree. With the same switch, 49 of the 52 programs translate for thread counts and validate; the three paired prefix sums are refused.The shader tests now keep one device per adapter for the whole test process. Two card test sessions had died in the driver (an access violation in
nvwgf2umx.dllon a driver thread, reading freed memory) after a test made and dropped its device.Overlaps with open pull requests
GPU and shaders: handle DispatchX USE_THREAD_DIMENSIONS partial thread groups (#16) #646 handles
USE_THREAD_DIMENSIONStoo: groups bydiv_ceil, and a user-data word (USER_DISPATCH_THREADS,RootType::Other(0x104), 0 for no cap) read by the prologue of every spilled compute program. On wave64-on-wave32 hosts and in programs with barriers, GPU and shaders: handle DispatchX USE_THREAD_DIMENSIONS partial thread groups (#16) #646 keeps every thread alive and predicates memory accesses, ballots and reductions. Here:GPU and shaders: handle DispatchX USE_THREAD_DIMENSIONS partial thread groups (#16) #646 uses
0x104, which Shaders, second round: geometry programs as geometry shaders, loops as the console runs them, lighter wave64 forms, dispatches past 65,535 groups in x (stacked on #854) #993 and GPU: indirect dispatches past 65,535 groups in x run the rest in a second execution #834 use for the group base: one of them needs another code.GPU: only a shader that can store by address declares its title-memory copies written (12 GB/frame of CPU compare with ray tracing) #916 is the same change as "copies by address declared written only for address stores" (
stores_by_addressinpipeline.rs).Builder quarantine that holds; tracing where the builder's results land #935 adds a
crates/victory-gpu/src/bvhtrace.rsof its own under the sameVICTORY_BVH_TRACEswitch, crash-report memory dumps, and a quarantine that holds. Its runs crashed 3 to 12 s after the builder's first frame. The overrun of the dispatches by thread counts, fixed here, explains such crashes. Whichever goes in second needs a merge ofbvhtrace.rsandcrash.rs.shader,gpu: resolve heap-loaded view addresses and widen native complement masks #738 and Shaders: view-address table for descriptors picked by a computed index #749 keep a table of view addresses by heap slot as well. shader,gpu: resolve heap-loaded view addresses and widen native complement masks #738 uses the same slot (
SLOT_VIEW_ADDRESSES, 252) and also widens complement masks, which makes the fifth shadow-mask program translate. Shaders: view-address table for descriptors picked by a computed index #749 keeps addresses, lengths and strides.Preliminary live ray tracing, Series S overlay/upscaler, and 8 GB VRAM stability #814 and Live ray tracing (#814) on current main, conflicts resolved; tested on an RTX 3080 #905 (live ray tracing) carry view addresses, a thread-count word and title-memory write-back changes of their own.
NVIDIA (32-lane waves): four refused compute programs run, the whole structure builder has pipelines, xmem maps page runs as one view #823 and Ray-tracing builder translates on 32-lane GPUs; textures spill to shared memory; findings on a 6 GB laptop #601 give the whole builder pipelines on 32-lane GPUs in other ways (Shaders: wave64 programs in a paired form on 32-lane GPUs, mesh programs over 32 KiB linked with their pixel program, and more (230 more programs pass) #854 does it with the paired form). GPU: VICTORY_BVH_SKIP drops chosen structure-builder pipelines (diagnostics) #579 drops chosen builder pipelines (diagnostics). Shaders: guard title-memory fault writes and skip second BVH directory lookup on non-straddling box32 nodes #607 saves the second directory lookup of a 128-byte box node.
GPU: constant buffer views at most 64 KiB (NVIDIA removed the device for a larger one) #911 caps constant buffer views at 64 KiB. With the builder on,
mainneeds it (or an equivalent cap): without it a 1.3 MB view removed the device on an RTX 4070 about 36 s after the builder's pipelines were ready, and with it the same run went on (tested by rafaconvaitis below). Our tree has the cap.Not tested