Repository navigation
Conversation
|
CI: the "Build and test" job's one failure is not in this PR's code. The run shows 1781 passed, 1 failed, 28 ignored. The one is AI use: Claude Code with Claude Fable 5.2 read the CI log and wrote this. |
|
I tested larger synthetic shapes on RTX 5070 / NVIDIA 616.92 at head
The two-mip array hits All focused GPU runs completed without skips and the device remained healthy. No retail title, GPU memory budget, or timing was measured. AI use: OpenAI Codex with GPT-6.2 Astra built and ran the fixture; Codex reviewed and prepared this report. |
|
@imnicho, thanks for this. We ported raylitebull's One thing that looks like a defect:
Coverage differences, as possible follow-ups on top of yours, not changes this PR needs:
Checked and fine: the split-barrier test is bitwise ( We're glad to send any of the follow-ups as small PRs stacked on this one if you'd like them. AI use: an agent swarm: Claude Opus 5.5, GPT-6.2-Sol and Gemini 4 Neon. |
|
Update for head Run on an RX 9070 XT and an RTX 3060 in the same PC: the four new tests pass, and nothing in Tested: at the PR head
Not tested: AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report. |
|
@andrewDoing thank you, that was a real hole: the limit of 64 parts was an arbitrary one of mine, and a pair past it was silently left stale (counted under "pairs that cannot be copied", nothing more). The head is now AI use: Claude Code with Claude Fable 5.2 made the change and wrote this. |
|
I reran the three native RTX 5070 / NVIDIA 616.92 alias-copy controls from my earlier report on updated head
All three fenced readbacks passed without skips. This validates the synthetic subresource boundary and controls; the title's use of the exact two-mip array shape, performance, and memory budget remain unmeasured. AI use: OpenAI Codex with GPT-6.2 Astra ran the tests; Codex reviewed and prepared this report. |
|
merge-check Independent Windows check: verdict: not yet Review verdict: not yet. I traced two state mismatches in the opt-in path. These are source-level findings; I have not run a GPU regression for either boundary.
The PR's WARP fixture verifies its copy path; this check did not measure title visuals, title performance, or paired smoke. Hardware: Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (621.35), rustc 1.99.1. AI use: Codex (GPT-6.2 Sol) ran the builds and tests and checked the source paths; Codex (GPT-6.2 Astra) independently reviewed the state invariants. |
|
Test report for #3094 on NVIDIA: the whole workspace suite on this PR merged onto today's Tested
Not tested
AI use: Claude Code (Claude Opus 5.5) ran the tests above on the hardware named and wrote this report. |
|
RTX 4090, Series X profile, clean head Copies off/on at the same 50 ms graphics wait. I matched the first three heavy frames using features in the base-color dump, then compared the format-10 FP16 target on pixels where the aligned base colors agreed within 8/255 in every channel. In the first pair (BMP 1908 off / 1899 on), 157 features agreed with 0.05-pixel median residual at 640×360. Both HDR targets ran 168 draws, with 487/486 stand-ins off/on. Across 60,341 matching scene pixels the median brightness in XCL’s tone-mapped 8-bit HDR preview was 0 off / 182 on. Both final images were still nearly black. The next two matched HDR pairs gave 0 / 177 and 0 / 191. By the third pair (1910 off / 1901 on), the median of the whole presented image was 21 / 197. The off image shows a dark yard with a few lights. With copies on, people and tables are visible in bright haze. This supports the courtyard lighting change on Ada. Exposure and geometry are still visibly broken. The cell interior and the copies' frame-time cost remain unmeasured here. Getting past the loading artwork. I used the same checkpoint, A presses at 25/30/35/40/62/64 s and a fresh verified copy of the same populated XCL cache (4,946 files) for each 360 s run. With copies on and the default graphics pipeline wait, the last interval with a present ended at 116.07 s. One thread spent 241.62 of the remaining 243.93 s inside 59 logged graphics pipeline waits. With just Where the world first appears. In Reproduction settings. Windows 11 build 26300, RTX 4090 24 GB, NVIDIA 621.40, Ryzen 7 5800X3D, 32 GB RAM. OpenAI Codex (GPT-6) assisted with building the head, running the title, verifying the traces and images, and writing this report. |
|
Test report for Tested
The copy does what the description says on this card: the same scene goes from black with sunlit edges to a lit room and sky, at the same frame rate (about 1.1 presents a second in the world in all three runs; the frame is bound elsewhere). A first run with the copy on reached the world at 449 s, fell back to the title's loading screen after about a minute and crashed at 689 s when the title read a page XCL had moved to its other mapping 207 ms before (the limit of #1031); the copy was at work in it too (1024 or more copies), and I have no sign that it had a part in that. For comparison: one memory for both. Before finding this PR we had the same pairs dark on this card and tried the console's own arrangement locally: the sampled texture is given the video-memory tiles of the written texture at its address (a written texture at an address off the 64 KiB pages is still put on the title's shared pages, and a sampled texture of the same shape placed there later is mapped to the same tiles), so nothing is copied. That is the table's third column. It lights the scene too, but the picture is worse than with this PR's copy: through the window the copy gives a clear sky gradient, a sharp fence and tower and a plant on the sill, where the shared memory gives a washed-out, hazy view, dot patterns on the window frame and no plant. With both on (the sharing takes the 2D pairs, the copy is left with 5 to 7 pairs, the 40x23x64 volumes among them) the picture is the hazy one again. So on this card the copy is the better of the two, and sharing tiles between the two formats is not the same thing as it looks on paper; I have not found out why (the tile shapes of the two formats, or the moment a pair's content is taken). Not tested
AI use
|
|
Follow-up to my merge check, item 2, on unchanged head A focused regression can use two adopted DIRECT lists and independent allocators on WARP with the D3D12 debug layer: record a sampled-texture transition on A, then record the enhanced-barrier copy on B, reset A without submission, and submit only B. The native before-state encoded for B should match the state the device actually has; inspect Measured WARP follow-up on the same head. Windows 11 build 26300, WARP software adapter with Graphics Tools debug layer (host RTX 3080 Ti / NVIDIA 621.35), rustc 1.99.1. The temporary regression records the sampled texture's shader-read → Temporary two-list WARP regression diffdiff --git a/crates/xcl/src/hle/d3d12x/alias_copy.rs b/crates/xcl/src/hle/d3d12x/alias_copy.rs
index 50e68b76..ab193813 100644
--- a/crates/xcl/src/hle/d3d12x/alias_copy.rs
+++ b/crates/xcl/src/hle/d3d12x/alias_copy.rs
@@ -508,6 +508,89 @@ mod tests {
forget(r);
}
+ #[test]
+ fn gpu_reset_list_does_not_change_another_lists_alias_copy_before_state() {
+ use super::super::real::{adopt, Kind};
+ use windows::Win32::Graphics::Direct3D::D3D_FEATURE_LEVEL_11_0;
+ use windows::Win32::Graphics::Dxgi::{CreateDXGIFactory1, IDXGIAdapter, IDXGIFactory4};
+ unsafe {
+ let skip = || crate::gpu::recomp::runner::skip_test("no WARP device or D3D12 debug layer");
+ let Ok(debug) = crate::gpu::agility::configuration_interface::<ID3D12Debug>(&CLSID_D3D12Debug) else { return skip() };
+ debug.EnableDebugLayer();
+ let Ok(factory) = CreateDXGIFactory1::<IDXGIFactory4>() else { return skip() };
+ let Ok(warp) = factory.EnumWarpAdapter::<IDXGIAdapter>() else { return skip() };
+ let mut device: Option<ID3D12Device> = None;
+ if D3D12CreateDevice(&warp, D3D_FEATURE_LEVEL_11_0, &mut device).is_err() { return skip() }
+ let dev = device.unwrap();
+ let q: ID3D12InfoQueue = dev.cast().expect("debug info queue");
+ let queue: ID3D12CommandQueue = dev.CreateCommandQueue(&D3D12_COMMAND_QUEUE_DESC { Type: D3D12_COMMAND_LIST_TYPE_DIRECT, ..Default::default() }).unwrap();
+ let a_alloc: ID3D12CommandAllocator = dev.CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT).unwrap();
+ let b_alloc: ID3D12CommandAllocator = dev.CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT).unwrap();
+ let a: ID3D12GraphicsCommandList = dev.CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, &a_alloc, None).unwrap();
+ let b: ID3D12GraphicsCommandList = dev.CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, &b_alloc, None).unwrap();
+ let (written_desc, sampled_desc) = (texture(42, 16, 8, 1, 4), texture(67, 16, 8, 1, 0));
+ let committed = |desc: &D3D12_RESOURCE_DESC, state: D3D12_RESOURCE_STATES| {
+ let mut out: Option<ID3D12Resource> = None;
+ dev.CreateCommittedResource(&D3D12_HEAP_PROPERTIES { Type: D3D12_HEAP_TYPE_DEFAULT, ..Default::default() }, D3D12_HEAP_FLAG_NONE, desc, state, None, &mut out).unwrap();
+ out.unwrap()
+ };
+ let read = D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE | D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE;
+ let written = committed(&written_desc, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
+ let sampled = committed(&sampled_desc, read);
+ let (w, r) = (written.as_raw() as usize, sampled.as_raw() as usize);
+ let va = 0x7AC0_0000_5000usize;
+ keep(dev.as_raw() as usize, w, va, &written_desc, D3D12_RESOURCE_STATE_UNORDERED_ACCESS.0 as u32);
+ keep(dev.as_raw() as usize, r, va, &sampled_desc, read.0 as u32);
+ for (list, alloc) in [(&a, &a_alloc), (&b, &b_alloc)] {
+ adopt(list.as_raw(), Kind::CommandList);
+ super::super::list_x::on_create(list.as_raw(), alloc.as_raw() as usize, 0, D3D12_COMMAND_LIST_TYPE_DIRECT);
+ }
+ q.ClearStoredMessages();
+
+ // A's transition is discarded; only B runs on the native queue.
+ let tr = [0, 0, r as u32, (r as u64 >> 32) as u32, ALL, read.0 as u32, COPY_SOURCE, 0];
+ super::super::list_x::resource_barrier_x(a.as_raw(), 1, &tr);
+ let close: unsafe extern "system" fn(*mut c_void) -> i32 = std::mem::transmute(*(*(a.as_raw() as *const *const usize)).add(9));
+ assert!(close(a.as_raw()) >= 0);
+ if std::env::var_os("XCL_ALIAS_SUBMIT_A_CONTROL").is_some() {
+ let raw = a.as_raw();
+ let execute: unsafe extern "system" fn(*mut c_void, u32, *const *mut c_void) = std::mem::transmute(*(*(queue.as_raw() as *const *const usize)).add(10));
+ execute(queue.as_raw(), 1, &raw);
+ let fence: ID3D12Fence = dev.CreateFence(0, D3D12_FENCE_FLAG_NONE).unwrap();
+ queue.Signal(&fence, 1).unwrap();
+ crate::gpu::fence::wait(&fence, 1, &dev, None, 5000).unwrap();
+ }
+ assert!(super::super::list_x::reset_x(a.as_raw(), a_alloc.as_raw() as usize, 0) >= 0);
+
+ let words: [u32; 16] = [0x1000, 0x1000, 0x10, 0x80, 3, 6, w as u32, (w as u64 >> 32) as u32, u32::MAX, 0, 0, 0, 0, 0, 0, 0];
+ let group: [u64; 2] = [1 | 1 << 32, words.as_ptr() as u64];
+ let jobs = plan_enhanced(1, group.as_ptr() as usize);
+ assert_eq!(jobs, [(w, r, 0)]);
+ record(b.as_raw(), &jobs);
+ assert!(close(b.as_raw()) >= 0);
+ let raw = b.as_raw();
+ let execute: unsafe extern "system" fn(*mut c_void, u32, *const *mut c_void) = std::mem::transmute(*(*(queue.as_raw() as *const *const usize)).add(10));
+ execute(queue.as_raw(), 1, &raw);
+ let fence: ID3D12Fence = dev.CreateFence(0, D3D12_FENCE_FLAG_NONE).unwrap();
+ queue.Signal(&fence, 1).unwrap();
+ crate::gpu::fence::wait(&fence, 1, &dev, None, 5000).unwrap();
+ let mut errors = Vec::new();
+ for i in 0..q.GetNumStoredMessages() {
+ let mut len = 0usize;
+ if q.GetMessage(i, None, &mut len).is_err() || len == 0 { continue }
+ let mut bytes = vec![0u64; len.div_ceil(8)];
+ let m = bytes.as_mut_ptr() as *mut D3D12_MESSAGE;
+ if q.GetMessage(i, Some(m), &mut len).is_ok() && matches!((*m).Severity, D3D12_MESSAGE_SEVERITY_ERROR | D3D12_MESSAGE_SEVERITY_CORRUPTION) {
+ let text = std::slice::from_raw_parts((*m).pDescription as *const u8, (*m).DescriptionByteLength.saturating_sub(1));
+ errors.push(String::from_utf8_lossy(text).into_owned());
+ }
+ }
+ forget(w);
+ forget(r);
+ assert!(errors.is_empty(), "only B ran, but its native barriers had debug errors: {errors:?}");
+ }
+ }
+
/// The copy on a GPU (WARP): an R32_UINT array texture with unordered access, 70 layers and
/// two levels (140 parts) holds a pattern; after the enhanced barrier that ends its writing,
/// its R9G9B9E5 pair, read back, holds the same bytes in every level of every layer.AI use: Codex (GPT-6.2 Sol) wrote and ran the temporary GPU regression and checked the debug output; Codex (GPT-6.2 Astra) independently traced the list lifecycle. |
|
A heads-up so we don't duplicate work: I am preparing a PR against main for the same same-address pairs (an R9G9B9E5 view over the R32_UINT texture a compute pass writes), with a different mechanism. Instead of copying, both descriptions share the written texture's pages:
It stays opt-in behind (Claude Code, Claude Opus 5.5, wrote this comment.) |
|
@Pipodi thanks for the heads-up; it does overlap with what we're about to build, so here is where we are, to split the work rather than duplicate it. We went the other way from both the copy and shared pages: one resource, two views, through D3D12's castable-format list. The texture the compute pass writes as R32_UINT is created with a narrow cast list ( Why we didn't take shared pages for this pair: D3D12 doesn't promise that two placed textures of different formats over the same memory see each other's texels with the undefined swizzle layout, even at the same bits per texel; the cast list is the route it does define. Your range cap (0x384000 vs XG's 0x3c0000, so the next placement no longer supersedes the writer) looks needed either way, though: our version needs the reader to find the live writer too. Proposal: you keep the range/alignment part; we put the cast list on top of it, or the other way round if you'd rather. Either way one PR series, not two. What do you prefer? AI use: an agent swarm: Claude Opus 5.5, GPT-6.2-Sol and Gemini 4 Neon. |
|
Follow-up to my note above: the page-sharing approach is up as #3281 (caps the view to the written texture's console size) and #3282 (stacked: puts the GPU-owned texture at the 16 KiB-aligned address on the shared pages), both opt-in behind (Claude Code, Claude Opus 5.5, wrote this comment.) |
AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 3.8 Flash. |
|
@thehollowedone @imnicho on the remaining two-list state issue (7297382882): we'll take the submit-time version on, outside this PR, so #3094 doesn't grow. The plan, in short:
If either of you already has this in progress, say so and we'll test yours instead. thehollowedone, the regression cases are yours: they'll be credited in each PR that uses them. AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 3.8 Flash. |
|
Thanks for taking this on. I have no submit-time state implementation in progress, so please proceed with the split you described. The two-order discriminator on current #3094 head is available for the WARP harness; the important case records B while its texture is in the old state, then submits A before B, so B's already-encoded barriers must be corrected at submission. The reset, repeat-submit, failed-chunk and KickoffX cases you listed are useful boundaries for that model. I can review the focused harness and source once it is posted. AI use: Codex (GPT-6.2 Sol) checked the current discussion and drafted this reply. |
|
Two source-level correctness points on current head
I have not run either schedule on a GPU, so these are source/API-contract findings, not observed title failures. AI use: OpenAI Codex (GPT-6.2 Sol) traced the call and lifetime paths; OpenAI Codex (GPT-6.2 Astra) independently checked the schedules and existing discussion. |
…format is copied from it A retail title packs light as R9G9B9E5 into R32_UINT textures with unordered access and samples the same memory through R9G9B9E5 textures it places at the same addresses. On the console the two are one memory; here the sampled one is a texture of its own that nothing writes. With XCL_ALIAS_COPY=1 (off by default) the title's placed textures are kept by address (alias_copy). Where a written texture leaves RENDER_TARGET / UNORDERED_ACCESS, as the PC list gets the transition in resource_barrier_x (a legacy ResourceBarrier, or an enhanced barrier of list xcl-dev#146 that barrier_groups made a transition of), its texels are copied into each sampled texture of the same shape and texel width and another format at its address, through a buffer made at the pair's first copy. After review of the first version on nvidia-dev: - the copies are planned from the barriers as the PC gets them, not from the console's (thehollowedone); - a pair's buffer is made with the table's lock released (andrewDoing), and goes with the pair: late_release::hold_own lets it go once every queue is past the work submitted before (KDenKC); - what a copy puts into the sampled texture is not read back into the title's memory: it gets no GPU writer in title_textures (claudetools-gh, who found that XG lays the sampled format out in more bytes than the written texture has under it); - on a COMPUTE list a copy is left out, and counted, when a texture is in a state such a list cannot name (KDenKC). The pairs by address and shape and the copy through a buffer are raylitebull's, from xcl-dev#1989. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…t transitions After the review of ee7196a and KDenKC's run on a retail title: - The states the title's transitions leave a kept texture in are kept by subresource. A texture the title moves level by level (barrier_groups names a range that is not the whole one subresource at a time) is copied like any other, each level moved from its own state; before, such a texture was left out (4.7 % of the copies of KDenKC's run). - The first half of a split transition marks what it names as between the halves until the second: no copy is recorded while a texture of the pair is there (D3D12 lets nothing touch it then). Such a copy is left out and counted. Found by thehollowedone. - A pair's buffer holds a reference to the sampled texture. The title's list names the written texture only; the copy XCL adds names the sampled one and the buffer too, and the title may release the sampled texture before it submits that list. Both now go when the written texture goes. Found by thehollowedone. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
New head @KDenKC thank you for the two runs on
Tested on the new head: 13 tests of the module and of One correction to my own process, which the description now carries too: I build several worktrees into one target folder, and today cargo twice called a test binary of another worktree up to date. The test counts I posted here before came from builds whose logs show this worktree compiled; the regression block of Still not run by me: the title's world on AI use: Claude Code with Claude Fable 5.2 wrote the changes and this comment. 🤖 Generated with Claude Code |
|
CI: the "Build and test" failure on #3089, on the same base AI use: Claude Code with Claude Fable 5.2 read the job log and wrote this note. 🤖 Generated with Claude Code |
A recording is a stand-in PC list that keeps the words XCL's hooks send its ResourceBarrier (the title's legacy barriers through resource_barrier_x, its enhanced barriers through uav_barrier_x); a CPU model of the GPU runs recordings in a chosen submission order and reports each transition whose before-state is not the state the texture is in at that point, which is what the debug layer reports as 527 / 538. The debug layer itself is not used: it is one per process, and turning it on would remove the devices of the tests running beside these. The textures are WARP resources (their descriptions are read); nothing runs on the GPU. The cases here hold on main: the model itself, two lists submitted in their recording order (direct and compute), and a list submitted again that ends where it starts. The cases that do not hold (a list recorded before another but submitted after it, a list reset unsubmitted, KickoffX segments) come with the change that makes them hold. Part A of the plan on xcl-dev#3094 (7298369429). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A recording is a stand-in PC list that keeps the words XCL's hooks send its ResourceBarrier (the title's legacy barriers through resource_barrier_x, its enhanced barriers through uav_barrier_x); a CPU model of the GPU runs recordings in a chosen submission order and reports each transition whose before-state is not the state the texture is in at that point, which is what the debug layer reports as 527 / 538. The debug layer itself is not used: it is one per process, and turning it on would remove the devices of the tests running beside these. The textures are WARP resources (their descriptions are read); nothing runs on the GPU. The cases here hold on main: the model itself, two lists submitted in their recording order (direct and compute), and a list submitted again that ends where it starts. The cases that do not hold (a list recorded before another but submitted after it, a list reset unsubmitted, KickoffX segments) come with the change that makes them hold. Part A of the plan on xcl-dev#3094 (7298369429). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
#3340 (stacked on #3281/#3282) targets the same R32_UINT to R9G9B9E5 pairs another way: one PC texture with both formats in its cast list, instead of a GPU copy at the title's barriers. #1989's AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
|
Test report on head Setup: release build of the head as is (no merge needed),
hardware / tool and model: NVIDIA GeForce RTX 3090 24 GB (driver 621.24, wave32 only), Intel Core i5-10600K, 32 GB, Windows 11 Home build 26300, rustc 1.100.0 / Claude Code (Claude Opus 5.5), screen observations by the user, numbers from the logs checked by me |
|
merge-check AI-written and posted by Foniass without a human check of each point. |
|
@Foniass thank you for the read and the second regression run, and @AAsobu for the five runs: the sky drawn in all four runs with the switch on is the first report of that picture from a machine this was not written on. On the findings, on
What I will do, and one thing I would like settled first. The draft #3547 brings amd-dev's Nothing was built or run for this comment. AI use: Claude Code with Claude Fable 5.2 read the review against the code and wrote this comment. 🤖 Generated with Claude Code |
|
A measurement that may help parts B/C. On #3527's head (0d61b2c) I tried following the title's RTX 3090, debug layer, 300 s, same input script, same binary, switch off vs on:
So a legacy discard can't be right until the before-state follows submission order. The native route (an enhanced barrier from UNDEFINED with the flag, as in #3558) wouldn't need a before-state. AI use: Claude Code (Claude Opus 5.5) wrote the switch, ran the runs and drafted this. |
|
On an RTX 5090 in the retail title's first interior scene, a port of this PR's alias copy ( AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 4 Hydrogen. |
Part B of the plan on xcl-dev#3094 (7298369429): recorded, not used yet. barrier_groups and alias_copy take a texture's state from what was recorded last, but the GPU runs lists in the order they are submitted. submit_states keeps, per recording (a PC list between two resets), the state it needs each texture in when it starts and the one it leaves it in, from the words the PC list really gets; and the state each texture is in after the recordings accepted so far, in submission order (one map for all queues: a legacy state is the resource's, whichever queue moves it), advanced only by chunks the driver accepted, from ExecuteCommandLists and from KickoffX. What D3D12 returns to COMMON when the call ends (all a copy queue's list used, a buffer, a simultaneous-access texture) is COMMON there too. What a recording needs and the queue does not have are the fix-ups part C puts before it. A split barrier's begin half leaves the texture pending (neither state, rule 8) at the recording's end; as its first move it gives what the recording needs at its start (its before-state). A move of one subresource makes the texture mixed, which keeps today's behaviour. A recording is forgotten when its list starts another: Reset, a new list at its address, a KickoffX that submitted it, a mid-list split's next list, a segment back in the pool, its release. Off unless XCL_SUBMIT_STATES=1: each hook is one atomic load. The tests force the switch per thread (on and off), whatever the environment says. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Part C1 of the submit-time states plan on xcl-dev#3094. Part B keeps, per recording, the state each texture must be in when the recording starts; a fix-up list makes the moves the queue's states lack, and goes into the same ExecuteCommandLists call right before that recording (part C2). One pool per device and queue type. A slot (allocator + list) is out from record() until submitted(), then busy until the pool's fence passes the value signalled after it: a list is never reset while the GPU may still run it. The slot holds a reference to every resource its moves name until then, since the title may release its last one first (xcl-dev#3094). Not used yet (part C2 uses it). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e recording's own state Part C2a of the submit-time states plan on xcl-dev#3094. barrier_groups turns a move from the undefined layout into a legacy transition from the state the texture was last recorded in, by whichever list recorded it last. Lists recorded side by side and submitted in another order then start from a state the texture is not in. With XCL_SUBMIT_STATES=1 (off by default): - a move from undefined starts where THIS recording left the texture; - a recording's first move of a texture from undefined makes no transition: the recording needs the texture in the move's state when it starts (submit_states::require), and part C2b's fix-up list puts it there; - the queue's states are seeded at creation (the hooks where depth_uav notes new textures) and forgotten at the last release; - rule 7: moves inside a recording from one barrier model to the other are counted as hand-offs (C2b puts them through COMMON); - rule 10: a discard is noted; it runs in the state the recording's own move gave the texture. On its own, with the switch on, the first moves are left to fix-up lists that only part C2b makes: the switch is for C2b's tests until then. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…that need them Part C2b of the submit-time states plan on xcl-dev#3094. At each chunk of an ExecuteCommandLists call, submit_states::plan compares the state each recording needs a texture in when it starts (part B, part C2a) with the state the queue has it in, in the order the queue runs them; where they differ, a fix-up list from the C1 pool goes into the same call right before that recording. The queue's states advance only for chunks the driver accepted; the fix-up lists of a refused chunk go back to the pool. - plan() is pure: (queue states, the chunk's recordings, queue type) -> the fix-up steps before each recording, with thehollowedone's submission-order cases as tests; - rule 7: a move between barrier models is a hand-off through COMMON (legacy -> COMMON, then enhanced LAYOUT_COMMON -> layout, or the reverse); fixup_pool records enhanced steps with Barrier(); - a COMPUTE or COPY queue cannot name every state: such fix-ups are left out (today's behaviour for that texture) and counted; - pools are per device and queue type. Red -> green: a recording that moves a texture out of undefined into a render target, submitted after other work left it in unordered access, starts from a state the texture is not in without the fix-up, and runs clean with it (submit_order_tests, on the harness's state checker). Off by default: every hook is one atomic load. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A texture registered over another range of an older placed one unmaps the older one's tiles. That also hit a GPU-owned texture (render target or UAV) when the title places a sampled texture of another format in its memory and XG sizes the two differently (R9G9B9E5 over R32_UINT at 1280x720: 0x3c0000 against 0x384000 bytes): the written texture lost the tiles under what the GPU had written. Seen with alias copies (xcl-dev#3094) and pair pages on an RTX 3080: flat rectangles in the lighting over part of the picture in 3 of 3 runs without this, in 0 of 2 with it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
With
XCL_ALIAS_COPY=1, a sampled texture the title places in the memory of a written one of another format is copied from it on the GPU. A retail title reads its sky, its light probes and its bounced light through 59 such pairs; they were stale, and with the copies its room, sky and yard are lit. The default is unchanged (off).Rebased onto
mainand reworked for it, with what the reviews asked for. Two commits onmain493dbd3dd: the rework, and what the reviews of that rework (asee7196a76) asked for; the head is8a28d3176. The old head6396870e2(onnvidia-dev) is what the reports below from before 1 December tested.Plan comment: #1989 (comment)
What is in it
The title packs light as R9G9B9E5 into R32_UINT textures with unordered access (a compute program cannot store R9G9B9E5) and samples the same memory through R9G9B9E5 textures it places at the same addresses. On the console the two are one memory. Here the written one is GPU-owned (
vram) and the sampled one is a texture of its own, kept in step with the title's memory (title_textures), which nothing writes.New module
hle/d3d12x/alias_copy.rs:create_placed_resource_xtells it of every placed texture (three places: GPU-owned, kept in step, a resource of its own). A pair is a written texture (render target or UAV) and a sampled one at the same address with the same size, levels, layers and texel width and another format. Buffers, depth buffers, multisampled and block-compressed textures are not kept.resource_barrier_x. Onmainthat one place sees both a legacyResourceBarrierand the title's enhanced barriers of list Compute dispatches: a shader takes no more arguments from user SGPRs than it has (XboxBvhBuilder builds empty BLAS / TLAS) #146, whichbarrier_groups(D3D12.X: translate list #146 enhanced barrier groups into legacy texture transitions #3287) makes transitions of and sends the same way. So the first version's own reading of the Compute dispatches: a shader takes no more arguments from user SGPRs than it has (XboxBvhBuilder builds empty BLAS / TLAS) #146 groups is gone, and the copies are planned from the barriers as the PC gets them, after the console's state bits are dropped (@thehollowedone's first point). WithXCL_BARRIER_GROUPS=0the enhanced barriers move no texture and ask for no copy.list_x::texture_through_buffer, on the PC list past XCL's hooks). The two textures go to the copy states and back from the states the title's transitions left them in. The states are kept by subresource, so a texture the title moves level by level is copied like any other, each level moved from its own state (onee7196a76such a texture was left out: 4.7 % of the copies of @KDenKC's run below). On DIRECT and COMPUTE lists; on a COMPUTE list a copy is left out, and counted, when one of the two is in a state such a list cannot name (@KDenKC). No copy is recorded while a texture of the pair is between the two halves of a split transition, where D3D12 lets nothing touch it; such a copy is left out and counted (@thehollowedone).planof another pair does not wait for the PC's D3D12 (@andrewDoing). It goes with the pair: at the title's last release of one of its textures,late_release::hold_own(new) lets it go once every queue is past the work submitted before (@KDenKC). It also holds a reference to the sampled texture: the title's list names the written texture only, the copy XCL adds to it names the sampled one and the buffer too, and the title may release the sampled texture before it submits that list. Both go when the written texture goes (@thehollowedone).mainreads a texture the GPU wrote back into the title's memory. What a copy puts into the sampled texture gets no GPU writer intitle_textures, so it is still not uploaded over and is not read back: XG lays R9G9B9E5 out in more bytes than the R32_UINT texture has under it (0x3c0000 against 0x384000 at 1280x720), and the read-back went over what the title keeps behind the pair. Found and fixed by @claudetools-gh in the comments; this is that fix with the question asked of the texture's own entry instead of the table of buffers.The pairs by address and shape and the copy through a buffer are @raylitebull's, from #1989.
Size: 7 files, 508 lines of code and 321 of tests. That is more than a PR should be; about 90 lines of it came with the reviews.
Not in it
barrier_groupskeeps the states it starts from. A list recorded and never submitted, and two lists submitted in another order than recorded, are not told apart (@thehollowedone's second point, with the WARP regression that shows it). I have not changed that here: the title's own enhanced barriers name their layouts, and what XCL adds for the copy starts from the last state recorded, asbarrier_groupsdoes for a barrier from the undefined layout. @KDenKC has taken the submit-time state model on as PRs of its own, with @thehollowedone's cases as its tests, and will bring the alias copy's part back here as a suggestion.Create{ShaderResource,UnorderedAccess}ViewAtXat a written texture's address),CopyResourcebetween format families, a copy back from the sampled texture, a skip of a copy whose written texture has not changed.XCL_PAIR_PAGES=1) and the castable-format route @KDenKC describes are other ways to the same pairs; with pages shared the copy goes onto memory the view already has.Tested
On this head (debug, RTX 5080 16 GB, driver 610.47, Windows 10 22H2):
cargo test -p xcl --lib -- --test-threads=1 alias_copy late_release: 13 passed, 0 failed, noSKIPPEDline (the crate's outputs cleaned first: see the note under "Not tested").cargo test -p xcl --lib -- --test-threads=4gives no count on this PC: plainmain(d0832e614) ends the test process partway here. After 1,376 testsalloc_pool::tests::a_reset_that_puts_the_allocator_aside_keeps_what_the_gpu_still_readsfails and the process stops withsparse upload preparation still failed after bounded retries – the title is stopped before its GPU submission(exit 0x80004005); one test at a time (--test-threads=1 hle::d3d12x) it stops the same way insparse::tests::a_buffer_over_a_remapped_tile_reads_the_new_pageafter 739 tests. I did not run this head past that; CI has the whole suite.The tests:
gpu_a_written_textures_texels_reach_its_sampled_pair_at_the_titles_barrier(WARP): an R32_UINT array texture with unordered access, 70 layers and two levels (140 parts) holds a different value in every texel. The title's own call is made on an adopted list:uav_barrier_xwith one D3D12_BARRIER_GROUP whose texture barrier takes it from unordered access to shader resource. After it the R9G9B9E5 pair, read back, holds the same bits in every level of every layer. Then the written texture is released as a title does: no entry is left for the pair, and once the queues are past it the buffer's reference count falls to the test's own and the sampled texture loses the buffer's reference.a_written_textures_transition_out_of_a_written_state_asks_for_the_copy: what asks and what does not (a transition into a written state, the first half of a split one, the sampled one's, UAV and aliasing barriers), the states followed level by level, and the copy's moves for a texture in one state and for one whose levels differ.no_copy_is_recorded_between_the_halves_of_a_split_transition: @thehollowedone's schedule (the sampled texture's split begins, the written one leaves unordered access, the split ends): the copy asked for in between is left out, and after the end one may be recorded again.a_copy_starts_from_states_the_list_can_name: what a copy can start from on a DIRECT and on a COMPUTE list.a_sampled_texture_in_the_memory_of_a_written_one_of_another_format_is_its_pair: the pairs.In the title, on this head: not run by me (see "Not tested"). What there is:
main-based headee7196a76, @KDenKC (RTX 5090, driver 621.40,maind52ff48 with D3D12.X: XCL_PAIR_PAGES=1 caps a texture in a live one's memory to its pages #3281 and one revert,XCL_PAIR_PAGES=1on as well): two runs in the world for 522 s and 254 s at 2.98 and 5.31 fps, 0 device removals, 0 crashes; 32 pairs, 32,768 copies logged in each, about 1,555 left out for a state not known (the level-by-level case this head now copies), none for the COMPUTE-list or uncopyable cases; by eye the left wall of the first interior is lit in run 1.main-based trees with the first version ported, by others in the comments: @claudetools-gh (RTX 5070 Ti,main7a649b0 with other PRs, Series X profile): with the fix of point 5, no crash in 1 run against 3 of 3 before, 32,768 copies recorded, the first interior's window shows the sunset outside where it was black. @CharlyRien (RTX 3090,maind52ff48 with other PRs and D3D12.X: XCL_PAIR_PAGES=1 caps a texture in a live one's memory to its pages #3281): the 1280x720 pairs read the written data and the room behind the window is lit after camera cuts. Neither had D3D12.X: translate list #146 enhanced barrier groups into legacy texture transitions #3287's transitions under this module's trigger as this head has.nvidia-dev), mine (RTX 5080, Series S profile, the tree of my #1989 report with D3D12.X: the depth plane of an R24G8 buffer has a twin, drawn into the plane before its DSV is bound #3089's commit): 59 pairs in every run, all written as R32_UINT with unordered access and read as R9G9B9E5; one run of 600 s with 586 frames after the world's set-up, 2,110,141 draws, 16,384 copies logged by 484 s and no device loss, its room, window with the sunset sky, yard and fence lit; without the copies the room has its direct light only. Of 13 runs with copies 8 ended 67 to 128 frames after the set-up at that tree's GPU hang, where none of 3 without copies did. Others on that version: @vasanex (RTX 3080, Series S): lit room, yard and sky, mean of the settled frames 35 of 255 against 6; @minimalhipster990 (RTX 4090, Series X): the HDR target's median from 0 to 177-191 on matched frames.Regression run
scripts/smoke.ps1, 60 s,XCL_PREPARE=0, each built in release from a clean worktree. The switch is off in these runs, as it is by default.main(d0832e614):This PR (
8a28d3176), its second run (the first run of a new binary fills its caches and is not kept, as formain):Not tested
nvidia-devtree, andmainbuilds every pipeline anew; the 60 s runs above do not reach the world. A run of mine onmainwith this head will follow as a comment.nvidia-devthe textures stayed in the states they were made in. The unit and WARP tests cover the states; a title's lists on DIRECT and COMPUTE queues in the order it submits them are not covered (see "Not in it").crates/xcl/tests(eachd3d12_*one takes about 9 minutes here).AI use
Claude Code with Claude Fable 5.2 wrote the code and the tests, ran the suite and the regression runs, and wrote this description.
🤖 Generated with Claude Code