Repository navigation
Conversation
|
An indirect dispatch can have a valid pipeline and a zero count-buffer value. In that case Should the clear run even when the indirect call executes zero commands? If it should only run after shader work, a focused regression test could seed the UAV with a sentinel, issue the indirect call with Static review only. AI-assisted with Codex. |
|
Reviewed together with #2620: this is the same new |
…ords ran An indirect dispatch with a host pipeline and a count of zero runs no records, but the stand-ins after it still cleared the named views, over what the title expected them to keep (review of Marvisak#2619). The stand-ins follow shader work, so after an indirect dispatch: - at most no records (MaxCommandCount 0): no clears; - a record count in a buffer: the clears are predicated on it (SetPredication, D3D12_PREDICATION_OP_EQUAL_ZERO), so a count of zero skips them on the GPU. A predicate is a 64-bit value at an 8-byte aligned offset while the count is a 32-bit word anywhere, so the count is copied into the low half of the list's own predicate word (8 bytes of video memory, zeroed at creation, common between uses). The copy is recorded just before the execution, where it reads the count, so the word holds the count it read whatever its records then write; the clears after it move the word to PREDICATION and back. Only the Clear call is predicated, not the copies and barriers that ready its view. Without that word the clears are skipped and logged once; - no count: every clear, as before. Direct dispatches are unchanged. Test (WARP): a view seeded with a sentinel, a host ExecuteIndirect of a program that writes it (at most one record), then the stand-in. Count 0 (at offset 4, a nonzero word after it): the sentinel survives. Count 1: the stand-in's value. At most no records: the sentinel. No count: the stand-in's value. Tests count their own stand-ins: under test, ambient::filled() is the count of this thread (each test runs on its own), not the run's, which the stand-in tests running alongside add to. The stand-in tests' deltas of the shared count failed when they ran in parallel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@DrDarkDK, thanks, good catch. An indirect dispatch with a zero count ran nothing, but the stand-in still cleared the view. Fixed in the new commit on this branch (head
Regression test on WARP, as you suggested: The same commit fixes a test flake:
#2620 ( @kotekompotek, thanks for reviewing both. Yes, #2620 is stacked on this one by design: this PR is the smaller, self-contained The title was not used in these tests. AI-assisted |
|
I tested the two switches separately on an RTX 5070 Ti in the prison-window shot. I used the same local integration of #2619 (
Values are displayed SDR luma on a 0–255 scale, averaged within each region and then summarized by the median of three camera-matched frames per run. With ambient alone, the shirt lettering and seams became readable. Before lighting, the shirt's median RGB stayed within two code values per channel across all runs. The captured screen-probe dispatch was direct (320×360×1). The ambient rule filled the 2560×1440 packed screen-probe output. In the shadow-only run, all four held-back passes reported a successful fill on their 1280×720 R16_UINT masks. The last counters were 197 ambient fills and 693 shadow fills respectively, with zero skipped in both runs. This isolates a visible contribution from ambient in this shot. Filling the four distant-shadow masks with all ones on its own produced no appreciable change on the character here. Mask polarity and interaction with ambient remain open. The ambient result still looks flat, especially around the hair. |
|
@Venom2054, thanks. The three runs on matched frames make this easy to read: ambient alone takes the back of the head from 1.33 to 32.77 and the shirt from 0.36 to 40.02, while the four distant-shadow masks alone change nothing measurable. Two notes on the heads you tested:
On polarity:
If AI-assisted |
|
I ran the three follow-ups from your reply on the same RTX 5070 Ti using the same executable, initial state and camera-matching method as the earlier report. One run per setting, three matched window frames per run. The values are median displayed luma on the same 0–255 scale.
For reference, ambient alone was 32.77 / 40.02 / 238.64. Each of the four 1280×720 R16_UINT outputs accepted the requested fill in each run. The last combined counters showed 928 fills for ambient + ones and 1,002 for ambient + zeros, with zero skipped in either run. Changing the masks to zero without ambient left the character a silhouette. With ambient on, the lettering and collar stayed visible with either mask value. I could see individual strands at the right edge of the head in both the ambient-only and ambient-plus-ones frames, but no additional rim lighting or ponytail detail from the distant masks. This closes the interaction check for this close-up on these revisions. The small differences do not establish mask polarity elsewhere. |
|
Calibration data for the example value, measured against Series X footage instead of by eye. On victory-fork (its own version of this switch,
So 0.6 sits 12-16 above the console in these shots and 0.3 within 2-4. The rooms also lost their flat look at 0.3: ceilings and corners darker, closer to the footage. It's still one constant everywhere, so it can't give the console's falloff. The common room, about 52 in the footage, measured 86 at 0.6; I don't have a 0.3 shot of it yet. Most of the console's light there comes from the windows, which a constant can't follow. Caveats: one machine, one capture of the footage (YouTube's encode and levels sit between the console and these numbers), and the shots are matched by camera, not frame-exact. If the example is meant as a sensible default, AI-assisted (Claude Code, Claude Opus 5.5): runs, captures, the measurement and this text. Numbers only; no frames attached. |
|
@tippythetaidum, thanks for measuring it against console footage. Three matched shots, with 0.6 at 12-16 over and 0.3 within 2-4, is enough to change the example. The PR description now suggests Your caveat on the common room (about 52 on the console, 86 at 0.6) fits what the switch is: one constant for every pixel in place of probe lighting, so it can't match both a lit cell and a dim room. The real fix is getting the probe passes themselves to run, and the stand-in only bridges that gap. AI-assisted |
|
Automated triage for the maintainers. Needs the maintainer's decision. The switch is opt-in, names no title program in code, and handles the zero-count indirect case raised in review (predicated clear). On your reply: thanks for splitting the slot sharing out into #2871. That resolves the second point of the earlier triage. This branch still carries #2871's two commits ( Generated by Claude Code |
clear_unordered took a dynamic slot of the bound view heap on every call and held it until the list was reset, so a list that clears the same view many times (a per-frame clear inside a loop of passes, say) took one slot per clear from the capped heap; when the pool runs out, later draws and dispatches that need dynamic slots are dropped. The list's draw state now keeps the slot it made per view (view heap, view, host resource) and clears of that view reuse it. The cache lives with the slots: it goes when the list is reset (or released) and at a cut of the list, where root views are made again too. The host resource in the key is one the list keeps, so its address names no other while the slot is held. The view is now made before a slot is taken, so a view the host cannot make takes none. The clear itself moves into State::clear_view (taking the resolved view, returning whether it was recorded), which clear_unordered calls after it looks the title's CPU handle up; the test drives it directly. Test (WARP): eight clears of a view take one slot, another view one more, a further clear of the first none; the views hold their last clears; the slots come back at reset. HostHeap::dynamic_free (tests only) counts the free slots. Split from Marvisak#2619 at the maintainer's triage. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…held A view cleared on both sides of a cut (a wait that moves the recording on to a new host list), both segments submitted in order: the first segment's clears share one slot, the cut gives none back, the second segment takes one slot of its own (its view heap is bound afresh) and shares it for its next clear, and both stay held until the list is reset, when both come back. A read in each segment sees the last clear recorded before it in that segment. Suggested in review of Marvisak#2871. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (VICTORY_AMBIENT) Some outputs have inputs the host never fills: light gathered by rays walks structures that are not built yet, so the program that resolves it leaves black (or whatever its memory held), and shaded surfaces read it. VICTORY_AMBIENT=<program>:<view>:<value> clears one unordered view after every dispatch, direct or indirect, of the program whose shader hash the log prints, to a constant: - the view as the console code addresses it: root parameter and table offset in dwords (s1+176, the diagnostics' notation). It comes from the shader, so it holds across translator versions; the n-th view would shift as the translator finds more; - the value: r,g,b[,a]. A float or normalized view takes it as it is (ClearUnorderedAccessViewFloat); an integer view takes it packed: R9G9B9E5 or R11G11B10 into a 32-bit word, RGBA16F into R16G16B16A16_UINT or R32G32_UINT, by the texture's format or as named (rgb9e5=, r11g11b10=, rgba16f=); 0x..., mask (all ones) or zero is a raw word for an integer view of any width (zero clears floats too). The clear goes through the existing UAV clear path (a dynamic slot of the bound view heap), between UAV barriers on the resource. Nothing runs while the variable is unset. The first dispatch of a named program logs its table views, formats, size and the packed value; counts are logged every 5 s. Tests (WARP): a program writes three views of a title table; after it, the two its rules name hold the R9G9B9E5 word and the RGBA16F colour, the third keeps what it wrote, and a program no rule names changes nothing. CPU: R9G9B9E5 against a reference encoder (smallest shared exponent whose mantissas fit), small floats against a nearest-code search, the rules' parsing and the packing chosen per format. The idea, and R9G9B9E5 held as 32-bit words, come from the Belobug fork (github.com/Belobug/VIctory-Belobug-AMD, 0603123 and 4f45ab8, GPL-3.0-or-later), which matches its program by name; here the user names it by hash, so no program is named in the code. The masks and zeros for narrower integer outputs follow ScarlettPort's stand-in encodings (github.com/ZigZagBoi1/ScarlettPort, emit/stand_in.rs, GPL-3.0-or-later). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ords ran An indirect dispatch with a host pipeline and a count of zero runs no records, but the stand-ins after it still cleared the named views, over what the title expected them to keep (review of Marvisak#2619). The stand-ins follow shader work, so after an indirect dispatch: - at most no records (MaxCommandCount 0): no clears; - a record count in a buffer: the clears are predicated on it (SetPredication, D3D12_PREDICATION_OP_EQUAL_ZERO), so a count of zero skips them on the GPU. A predicate is a 64-bit value at an 8-byte aligned offset while the count is a 32-bit word anywhere, so the count is copied into the low half of the list's own predicate word (8 bytes of video memory, zeroed at creation, common between uses). The copy is recorded just before the execution, where it reads the count, so the word holds the count it read whatever its records then write; the clears after it move the word to PREDICATION and back. Only the Clear call is predicated, not the copies and barriers that ready its view. Without that word the clears are skipped and logged once; - no count: every clear, as before. Direct dispatches are unchanged. Test (WARP): a view seeded with a sentinel, a host ExecuteIndirect of a program that writes it (at most one record), then the stand-in. Count 0 (at offset 4, a nonzero word after it): the sentinel survives. Count 1: the stand-in's value. At most no records: the sentinel. No count: the stand-in's value. Tests count their own stand-ins: under test, ambient::filled() is the count of this thread (each test runs on its own), not the run's, which the stand-in tests running alongside add to. The stand-in tests' deltas of the shared count failed when they ran in parallel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
67320f3 to
a83bdc1
Compare
|
Following triage: the slot sharing (the old second commit, 11012ea) is now its own PR, #2871. It was adapted to WARP at a83bdc1 (on AI-assisted |
…ght (VICTORY_AMBIENT, on by default at 0.3) The title fills its indirect diffuse light from screen probes it traces rays for; without the structure builder (off by default) the program that resolves them leaves next to nothing or garbage, and whatever the sun does not reach directly is black. Now, while the builder may not run: - after each dispatch of the resolve (six variants), a pass of ours replaces its output (R9G9B9E5 as R32_UINT, table 1 dword 176) with a level times a warm white, shaded in creases and under objects from the depth the resolve read (table 0 dword 464); - after the specular denoiser's history update (table 1 dword 40) the reflections are held to half of that light (without rays indoor floors mirrored the open sky five to ten times brighter than the room); - the program that asks the probes for rays is left out; - `VICTORY_AMBIENT=sky` has the level follow the sky dome the title draws, held as the dome alone (Belobug e48eb83). The programs are known by the first 16 hex digits of their hash, as the tree knows the decoration bake and culling programs; VICTORY_AMBIENT_PROGRAMS names others. The default level 0.3 is the one compared against console footage (Marvisak/VIctory PR Marvisak#2619, same scale: the R9G9B9E5 value before the surfaces' colours); tint, shading, reflection parts and the sky's curve are tunable. The pass's own heap, root signature and pipeline are dropped from the bound state after it, so the next draw or dispatch binds the title's again; the sky dome's host copy is held and its state tracked per list (HostList::transition_copy). From Belobug/VIctory-Belobug-AMD ambient.rs (0603123 to 4f62c2a, e48eb83, 44dcd43, c3bd561, 6986a57; GPL-3.0) as fxceless/victory-fork PR Marvisak#1093 wired it, with the level of Marvisak/VIctory PR Marvisak#2619. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Some outputs depend on inputs the host never fills. Light gathered by rays walks structures that are not built yet, so the program that resolves it leaves black (or whatever its memory held), and every shaded surface that reads it goes dark. This adds a run-time switch that clears one unordered view to a constant after every dispatch of one program the user names.
Opt-in, off by default. Nothing runs while
VICTORY_AMBIENTis unset. No title program names or hashes appear in the code: the user names the program by the shader hash the log already prints.Syntax
VICTORY_AMBIENT=<program>:<view>:<value>, rules separated by;<program>: the 16-hex-digit shader hash the log prints for the compute program (compute 0123456789abcdef).<view>: the unordered view as the console shader addresses it: root parameter and table offset in dwords,s1+176or1+176(the notation of the diagnostics' table listings). The address comes from the console code, so it holds across translator versions. An n-th-view index would shift as the translator finds more views.<value>: a colourr,g,b[,a](alpha 1 if left out). A float or normalized view takes it as it is (ClearUnorderedAccessViewFloat). An integer view takes it packed by the texture's format, or as named:rgb9e5=,r11g11b10=(into a 32-bit word) orrgba16f=(intoR16G16B16A16_UINT/R32G32_UINT). A raw word is0x...,mask(all ones) orzero, for an integer view of any width (zeroclears float views too).Example:
VICTORY_AMBIENT=0123456789abcdef:s1+176:rgb9e5=0.3,0.294,0.282(Level 0.3 per @tippythetaidum's measurement against Series X footage in three prison shots, where 0.6 came out 12-16 display-luma steps too bright: #2619 (comment). The right level depends on the scene; it is a stand-in, not the title's lighting.)
What it does
dispatch) or indirect (execute_indirectof kind dispatch), the named view is cleared through the existing UAV clear path, between UAV barriers on the resource.Tests
The title was not used in these tests.
the_ambient_stand_in_fills_the_named_views_after_the_named_program(WARP): a program writes three views of a title table. After it runs, the two views its rules name hold the R9G9B9E5 word and the RGBA16F colour, the third keeps what the program wrote, and a program no rule names changes nothing.clears_of_one_view_in_a_list_share_a_dynamic_slot, anda_clear_after_a_cut_takes_a_new_slot_and_the_old_one_stays_held) are GPU: clears of one view in a list share one dynamic slot #2871's.ambient.rs: R9G9B9E5 against a reference encoder (smallest shared exponent whose mantissas fit), small floats against a nearest-code search, rule parsing, and the packing chosen per format.mainf3578e3, WARP):cargo clippy -p victory-gpu --all-targets --locked -- -D warningsand the same with--all-features, both clean;VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --features diagnostics --lib --locked: 251 passed, 0 failed, 1 ignored (an existing benchmark). The stacked VICTORY_STAND_IN branch (GPU: an opt-in constant takes the place of a named program that does not run (VICTORY_STAND_IN) #2620, 33df069): 253 passed, 0 failed, 1 ignored.In game
In our play build (RTX 5070, local title data used for the in-game measurement; only log lines and a description of the picture are reported), with #2311 holding back the BVH walks:
(
VICTORY_STAND_INis the follow-up PR, stacked on this one.)Credits
runtime/victory/crates/victory-shader/src/emit/stand_in.rs, GPL-3.0-or-later).🤖 Generated with Claude Code