Repository navigation
Conversation
|
A data point from an RTX 5070 Ti (driver 621.40), retail title, Series X profile: with
Both happen on a title thread right after it creates a two-pass argument scratch buffer. Without the switch, 0 of 1 on the same binary: that run reaches the world. The feature itself works here:
Tree:
The same Not tested: driver 621.24 or earlier, other NVIDIA generations, this PR without the rest of the stack. AI use: Claude Code with Claude Opus 5.5 ran the runs and wrote this. AI-assisted. |
|
@claudetools-gh thanks, this is very useful, and the first crash looks familiar: So my reading is that the cast list is not the cause but shifts the timing at world entry enough to hit the race more often. It is a reading, not proof: could you run the same binary with #3317 ( 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. |
|
Follow-up to the crash report above: it was #3317's race, not this change. claudetools-gh reran the same tree with #3317 added and 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. |
|
merge-check AI-written and posted by Foniass without a human check of each point. |
|
Stacked on #3281: the two XCL_PAIR_PAGES commits under it are #3281's, so only the top commit ( AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
|
Follow-up review (head 8a2d751, since b25dbd8, diff read, not a merge-check; checks red):
New:
Fine: with AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
…s pages A title can place two descriptions at one address: a 1280x720 R32_UINT UAV and a 1280x720 R9G9B9E5 SRV. XG sizes them 0x384000 (57 pages) and 0x3c0000 (60 pages), so the one placed second owns 3 pages more than the first, and those are the shared pages of the texture the title put 0x390000 after them. The sampled alias then reads that neighbour's memory (a step in the captured frame), and placements sees it Around the target and supersedes it. With XCL_PAIR_PAGES=1 (off by default) place_on_pages caps a sampled texture placed at the address and tile count of a live mapped texture the GPU writes, and that it is a view of, to the smaller of the two (pair_bytes) and keeps the capped size in its Target, so the later texture shares exactly the written partner's pages and its other tiles are private (va, i) tiles. Placed first, the larger texture is not changed (its tiles are bound already). The cap is made before the range is handed to placements, so a capped pair is Same, not Around. The log line is printed for the first two and powers of two. Only a written texture is a partner (pair_partners), and only while it is the current placement: mapped, held by the title and not superseded in placements (placements::current_view; a superseded target stays mapped in vram until its deferred unmap, late_release::hold_unmap), to a sampled texture with the same size and levels and a texel of the same size (Desc::same_texels, the rule placements keeps the two on one memory by; a texture of another shape with as many tiles is something else the title put in that memory, and keeps its size), with the size CreatePlacedResourceX passes (console_bytes: XG's, or for a 3-D texture XG cannot lay out the bytes of its texels; not the least_texture_bytes lower bound). A sampled texture caps nothing, capped or not. A texture the GPU writes is never capped: on the console it has all of its own size, and its readback into the title's memory (title_textures::publish_download) goes by its whole layout. The registry is asked with PAGES released: its lock is the outer one of the two (placements::unmap_if_superseded). The cap is not the byte layout of the console. Measured with the GDK's XG library: the two layouts (0x102 and 2) put texel (x, y) at different offsets (first difference at (8,0); 920896 of 921600 texels differ), and the SRV's 3-page overrun is real on the console (36864 texels past the UAV's end). The cap is what the PC alias shows. Tests: pair_bytes on targets (a written partner; a sampled one or one of unknown size caps nothing and a written texture is not capped; a superseded partner before and after its unmap), placements::current and current_view on a registry (another shape, other levels and another texel size are not a view), a placements test that the capped pair is Same, and GPU tests with the real descriptions: a neighbour at +0x390000 (80 of 128 neighbour rows are overwritten without the cap, with pair_bytes returning its own size), and a written texture made after a smaller sampled one and then superseded (with every mapped texture a partner it is capped to 0x384000; with the registry not asked, the sampled texture made after it is capped to the superseded one; a sampled 720x1280 texture at the address of a written 1280x720 one has as many tiles and keeps its size). Assisted-by: Claude Code (Claude Sonnet 5.5) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Cache positive and negative R9G9B9E5 volume support queries per device, and only ask for that support after the format/UAV eligibility checks. Add focused tests for cache behavior and query gating. Checked: xcl-dev#3491, xcl-dev#3340.
bmjask
left a comment
There was a problem hiding this comment.
Review of 8a2d7518: 7 finding(s). 7 are inline.
These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
| 0 => D3D12_BARRIER_LAYOUT_COMMON, | ||
| 0x4 => D3D12_BARRIER_LAYOUT_RENDER_TARGET, | ||
| 0x8 => D3D12_BARRIER_LAYOUT_UNORDERED_ACCESS, | ||
| 0x400 => D3D12_BARRIER_LAYOUT_COPY_DEST, |
There was a problem hiding this comment.
The pushed head doesn't match the description. The body describes a later head (b25dbd8) that creates the written texture in COMMON, settles it with Pages::settle and sends read states via read_state, but neither function exists on this branch. Here the texture is created in the layout of its initial state (layout_of maps 0x8 to UNORDERED_ACCESS, plus RENDER_TARGET and COPY_DEST). With XCL_CAST_LIST=1 and the light UAV placed in UNORDERED_ACCESS (the usual case), place_on_pages calls CreateReservedResource2 with that layout, and the title then uses legacy ResourceBarrier on it. That's the debug layer error 1350 / RTX 5090 hang route the body says was fixed. What was tested isn't what would merge.
| D3D12_COMMAND_LIST_TYPE_DIRECT => NPS | PS, | ||
| D3D12_COMMAND_LIST_TYPE_COMPUTE => NPS, | ||
| _ => 0, | ||
| }; |
There was a problem hiding this comment.
Read states are still widened (e.g. SRV|COPY_SOURCE), which are the GENERIC_READ-style layouts the PR body says cause debug layer error 1334. If the writer is moved to NPS on a DIRECT list, it's sent as 0xC0. A later submission that reads it with no barrier expects COMMON at the start, so it gets error 1334, and the driver may skip the decompression or cache flushes the next submission needs.
| } | ||
| // (a texture made with a cast list: its read-only states can be read through the views | ||
| // made on it, `cast_list`; both sides, so every list agrees on its state) | ||
| if super::cast_list::is_writer((b[2] as u64 | (b[3] as u64) << 32) as usize) { |
There was a problem hiding this comment.
widen_state adds NPS|PS on DIRECT lists but only NPS on COMPUTE lists, so the same texture's tracked state depends on list type. If a DIRECT list moves the writer UA->NPS (sent 0x8->0xC0) and a later COMPUTE list moves it NPS->UA (sent 0x40->0x8), the texture is really in 0xC0, so the before-state mismatches. That's a debug layer error, and the PS read state is never flushed. The reverse order mismatches too, and note_other_list only logs it.
| } | ||
| // a texture in the memory of a written one, in a format of its cast list: viewed on that one | ||
| // (`cast_list`; the slot is noted as the written texture's, so its views go with it) | ||
| let res = match super::cast_list::view_on_writer(res as usize, copy.as_ref()) { |
There was a problem hiding this comment.
Views of the sampled (reader) texture are moved onto the writer, but the title's barriers on the reader resource aren't. On the console the title writes the R32_UINT texture as UAV and transitions only the R9G9B9E5 alias to PIXEL_SHADER_RESOURCE before sampling. On the PC that transition goes to the reader object, the writer stays in UNORDERED_ACCESS, and the redirected SRV samples a UA-state resource. That's a debug layer error, and on hardware with compressed or cached UAV data it can read stale texels. Barriers on a redirected reader need to go to the writer.
| if MADE.load(Ordering::Relaxed) == 0 || res == 0 { | ||
| return None; | ||
| } | ||
| let (writer, v) = { |
There was a problem hiding this comment.
The redirect only happens when the SRV is created. If the title places the reader, creates its R9G9B9E5 SRV and only then places the writer, view_on_writer finds no writer and the view stays on the stale reader for good. If the writer is recreated at the same address (resize/reallocation) while the title keeps its reader descriptor, resource_gone(writer) nulls the descriptor and the title samples zeros (black light), where on the console the alias would see the new writer's data.
| } | ||
|
|
||
| impl Shape { | ||
| fn of(d: &D3D12_RESOURCE_DESC) -> Self { |
There was a problem hiding this comment.
Shape::of treats MipLevels 0 ("full chain") as 1, and whole_view builds a null-desc view with that many mips. A reader or writer created with MipLevels=0 gets a 1-mip shape, so a rebuilt null-desc SRV has MipLevels=1 and every lower mip the title samples reads out of range. MipLevels=0 on one side and an explicit full count on the other also fail to match, so no redirect happens. The non-redirected path uses r.MipLevels or u32::MAX.
| ) -> HRESULT { | ||
| note_newer_device_method(127); | ||
| // (the title's cast list: a GPU-written texture on the title's pages is made with it) | ||
| let _casts = super::cast_list::title_list(castable, formats); |
There was a problem hiding this comment.
Not certain about this one: the #127 cast list stays in a thread-local for the whole of dev_create_committed_resource_layout_x. Any GPU-owned texture XCL itself creates through place_on_pages on that thread during the call (display target path, helper or twin textures) picks up the title's cast list via for_writer, gets registered in made, and has its barriers widened, or CreateReservedResource2 is tried with an incompatible list.
The title places an R9G9B9E5 view by address over a live R32_UINT texture (1280x720, 0x384000 bytes). XG sizes the view 0x3c0000 and the title's next resource starts at the view's address + 0x384000. Table::insert saw that resource inside the view's range, called the view superseded by a different range, and vram::unmap_superseded mapped all 60 of its tiles to NULL: the compute pass that read the view got zeros and wrote zeros over the R32_UINT. XCL_PAIR_PAGES=1 capped only the vram extent (pair_bytes), not the table's. The entry of a sampled texture now keeps the capped extent (vram::pair_capped_bytes reads it from the placed Target, so pair_bytes stays the one place that computes it) and insert, retire_range, remove, the source links and the hot range use it. So do the test for written pages (Entry::written_in), the pages a partial upload compares (dirty_on) and the fingerprint of a view whose memory is not watched: a write to the neighbour's first bytes is in a 1 MiB source piece of the view, and with the view's whole size it sent the view up again. Every upload of a capped view, its first whole one too, now stops at its cap (texture_upload::Item::own_tiles from vram::pair_capped_tiles, the tiles owned_pages gives it; texture_upload::owned_parts clips each piece to them). The view's tiles past the cap are the extra pages keyed (va, 57..59) it shares with the R32_UINT, whose last texels they hold: a whole upload of the view wrote the neighbour's bytes over them, and the view's first upload after register is always a whole one (pending; gpu_written is only set on the writer's entry). A level in the packed mips or a 3D level goes up whole when the view owns all of its tiles, else not at all. Each array slice has its own packed mips, D3D12_PACKED_MIP_INFO's start (slice 0's) plus the slice times the tiles of a slice, and a level from NumStandardMips on is packed: WARP gives the packed subresources of slice 1 slice 0's start and no tiles, not D3D12_PACKED_TILE (256x256, 2 slices, 9 mips: start 5, 0x0). A capped view whose tiles vram does not give owns none: nothing of it goes up rather than all of it. The hashes of its pages are still those of the whole layout. A capped view a list writes (gpu_written, as a copy destination) is read back into the title's memory up to its cap only (publish_download): past it is the next texture's memory, and its tiles there are the pages it shares with the written texture. The entry of a texture the GPU writes (register_gpu_owned) has no cap: vram never caps one, and publish_download writes its whole layout back into the title's memory, so its range in the table is its whole size. Only under XCL_PAIR_PAGES=1. Tests: gpu_register_takes_the_cap_from_the_pair (register's range stops at the capped extent, the written texture keeps its own size; skip_test without reserved textures); capped_placed_view_is_not_superseded_by_its_neighbour fails with the cap ignored (the insert at address + 0x384000 returns the view to unmap), and with the whole size in written_in (a written page at address + 0x384000 selects the view); a_capped_views_fingerprint_ends_at_its_cap fails with the whole size fingerprinted, in the baseline (seed_stream_recheck) or in the recheck (a write past the cap, in the end slice of a whole-size fingerprint, queues the view); gpu_a_capped_views_first_upload_leaves_the_tiles_past_its_cap places the pair on pages, registers the view, sends its first upload through upload_all and fails with the clip off or with no own_tiles from upload_all (the view writes 30720 texels of tiles 57..59 of the R32_UINT); gpu_a_capped_arrays_first_upload_stops_at_its_cap_in_a_later_slice caps a 2-slice array with packed mips one tile into slice 1 and fails with slice 0's packed start for every slice, with the packed levels taken from D3D12_PACKED_TILE alone, or with no own_tiles from upload_all (slice 1's packed mips get the view's bytes), and skips on an adapter that makes no reserved array with packed mips (GitHub's runner: E_INVALIDARG); a_capped_view_without_its_tiles_owns_none fails with a capped view without a Target uploaded whole; gpu_a_capped_views_download_ends_at_its_cap fails with the whole layout written back (the bytes past the cap get the GPU's). The GPU tests read a texture back through the one that wrote it, after an aliasing barrier; the 1280x720 one also reads the view's own tiles through the R32_UINT (both 32 bpp, standard tiles: the title's case). Packed mips of two descriptions are not compared: on PC their layout on the same tiles (64KB_UNDEFINED_SWIZZLE) is not guaranteed alike, and reading the view's packed mips through the R32_UINT failed about 2 runs in 30. Assisted-by: Claude Code (Claude Sonnet 5.5) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Preserve the title's resource states, honor zero-mip full-chain views, and bind its cast list to the allocation being created. Exercise repeated reads and writes in the 2D route test. Checked: xcl-dev#3340 review 6143106973; xcl-dev#3491 follow-up 7331505470.
|
@bmjask thanks for the review. The refreshed head is
On the 3090 VM, debug, The cast route is off by default. A title run with AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 4 Hydrogen. |
|
Follow-up review (head 4bb5c9a, since 8a2d751, diff read, not a merge-check; checks red):
New:
Fine: with AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
…9B9E5 one texture The retail title packs light as R9G9B9E5 into R32_UINT textures its compute programs write, and samples the same memory through an R9G9B9E5 texture it places at the same address. On the console that is one memory; here the sampled texture is a PC texture of its own that nothing writes. With XCL_CAST_LIST=1, where the device has relaxed format casting (OPTIONS12), ID3D12Device10 and samples R9G9B9E5, a GPU-written R32_UINT 2D texture on the title's pages is made with CreateReservedResource2 and [R32_UINT, R9G9B9E5_SHAREDEXP] as its cast list (a texture the title gives a cast list of its own, device xcl-dev#127, with that list). A view the title makes of a texture at the same address, of the same shape, in another format of the list, is made on the written texture. Its read-only legacy states (not COMMON) also take the shader-resource states the list type has (DIRECT both, COMPUTE the non-pixel one, COPY none), on both sides of every transition. The views go with the written texture (console_heap::resource_gone); a recycled sampled texture is forgotten before it is parked. It is made only in the initial states whose layout is the same state (COMMON, RENDER_TARGET, UNORDERED_ACCESS, COPY_DEST); a refused create is made as before. Off by default. Tests: the matching and the state widening (cast_list), and a GPU test of the route itself in a child process with the debug layer on: one texture written as R32_UINT through a UAV and read through an R9G9B9E5 SRV, committed and reserved (tiles mapped on a second queue), every texel compared with a CPU decode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Preserve the title's resource states, honor zero-mip full-chain views, and bind its cast list to the allocation being created. Exercise repeated reads and writes in the 2D route test. Checked: xcl-dev#3340 review 6143106973; xcl-dev#3491 follow-up 7331505470.
bmjask
left a comment
There was a problem hiding this comment.
Review of 4bb5c9a9: 3 finding(s).
Re-review at 4bb5c9a9. The state widening is gone, which resolves my earlier points about widened read states and states that differ by list type. Still open from my earlier review: the title's barriers on the reader still don't reach the writer its SRVs now sample (real.rs ~3277). With the widening removed there's now no UAV->SRV transition at all, so the redirected SRV reads the writer in UNORDERED_ACCESS/COPY_SOURCE. Also still open: releasing the writer nulls views of a reader the title still holds (cast_list.rs ~277, via console_heap::resource_gone(writer)). New findings: 3 are inline.
These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
|
|
||
| /// The written texture to make the title's view `view` of `res` on, and the view (None: `res`'s | ||
| /// own): `res` is at a writer's address with its shape, in another format of its cast list. | ||
| pub(super) fn view_on_writer(res: usize, view: Option<&D3D12_SHADER_RESOURCE_VIEW_DESC>) -> Option<(usize, D3D12_SHADER_RESOURCE_VIEW_DESC)> { |
There was a problem hiding this comment.
view_on_writer redirects to any live writer at (dev, va) of the same shape without checking that it's still current in placements. With XCL_CAST_LIST=1 and XCL_PAIR_PAGES unset, the 1280x720 R9G9B9E5 reader (0x3c0000, 60 pages) is placed over the R32_UINT writer (0x384000, 57 pages). The overlap is Around, so the writer is superseded and its tiles go to late_release::hold_unmap, yet the reader's SRV is still made on the writer and samples tiles being unmapped (zeros). The same stale redirect happens when the title has reused that memory for another texture while holding the old writer.
| if t.made.insert(res) { | ||
| MADE.fetch_add(1, Ordering::Relaxed); | ||
| } | ||
| t.writers.insert((dev, va), Writer { res, shape: Shape::of(desc), format: desc.Format.0, casts }); |
There was a problem hiding this comment.
made() overwrites writers[(dev, va)] when a newer cast writer is placed at the same address, and drop_res of the newer one removes the only (dev, va) entry while the older writer is still in made. With writer A at va, writer B placed at the same va, and then B released while A is kept, later R9G9B9E5 readers at va are no longer redirected to A. They fall back to the independent texture, which reads the wrong data.
| }; | ||
| // (asked with `PAGES` released: the registry's lock is the outer one of the two, | ||
| // `placements::unmap_if_superseded`) | ||
| let capped = pair_bytes(&partners, |res| super::placements::current_view(res, desc), console_bytes); |
There was a problem hiding this comment.
The XCL_PAIR_PAGES cap is decided once at placement (Target.capped, Entry.cap) and never lifted when the partner writer is released or superseded. If a view capped to 57 of 60 tiles keeps being CPU-filled after the title releases the writer, written_in/dirty_on still ignore pages past the cap and own_tiles_of still stops every upload at tile 57. The view's last 3 tiles keep whatever the shared extra pages hold for the rest of its life.
Limit cast-list writer selection to the currently placed compatible resource, retain live writers by address, and refresh pair-page upload caps as placements change.
With XCL_CAST_LIST=1 a sampled texture at a written texture's address has its views made on the current live writer there (view_on_writer), so it is read through that writer: on the console a barrier on the reader is one on that memory. Its transitions went to its own PC texture, so a writer the title left in a write state was sampled in it when the title moved only the reader. A reader is noted with the writer its views were last made on; when that writer is released the reader's barriers are its own again until its views are made on another live writer. Per recording the state each writer was left in is kept per subresource, in the title's states, from the writer's own transitions; a recording that has not moved a writer finds it where the recordings closed before it left it (in the order they were closed). A reader's read-only transition becomes the writer's move of the same subresource(s): from a write state to the read state the reader asks for, from a read state lacking it to both; a writer already in it needs nothing. Not known (never moved, a split's first half, all of it asked for while its subresources differ): nothing is added. Each case is counted in a log line. A reader's move into or out of a write state stays on the reader. A split's first half carries the whole move. Tests: a_barrier_on_a_cast_list_reader_moves_its_writer and a_barrier_on_a_reader_of_a_released_writer_stays_on_the_reader (the title's barrier on the reader through resource_barrier_x), a_readers_read_moves_are_its_owners (per subresource, a split, a recording that finds an earlier one's state), a_readers_owner_follows_release_and_a_new_view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@bmjask @Foniass thanks for the follow-ups; this covers both reviews. This revision is rebased on #3281's current head The registry now selects the newest live compatible writer only while it is still current in placements, and retains older live writers so releasing a newer one falls back correctly. It narrows cast-list use to the title's bound #127 address and compatible resource, and checks enhanced-barrier support alongside relaxed casting, sampled-format support, and Device10. Pair-page caps expand when their partner is released or superseded, but only if the tail is free. The barrier-routing commit is included in Regression coverage includes On the RTX 3090 VM, focused results were The independent-resource path remains available when the cast list is unsupported. Related: #3094 #3136 #3282; the copy path in #3094 remains a natural fallback if both land. AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 4 Hydrogen. |
|
Follow-up review (head e435d2d, since 4bb5c9a, diff read, not a merge-check; checks red):
New:
Fine: with AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
What and why
The title writes packed light through an R32_UINT UAV and reads the same console address through an R9G9B9E5 texture. With
XCL_CAST_LIST=1, when the device supports enhanced barriers, relaxed format casting, and the needed sampled format, the written 2D texture is created with both formats and a matching sampled view is made on that resource. This avoids a separate read texture for this pair. The switch is off by default; unsupported devices and unmatched views keep the existing independent-resource path.Stacked on #3281. The two commits underneath add the
XCL_PAIR_PAGES=1placement support; the three commits at the top are this PR's cast-list route, lifecycle fixes, and barrier routing.The follow-ups preserve legacy resource states, handle
MipLevels == 0as the full mip chain, and bind a title-provided cast list to the allocation at its canonical address. The owner lookup selects the newest live compatible writer that is still current in placements, retaining older writers while they remain live. Releasing or superseding a writer updates the view and pair-page cap lifecycle. Barriers submitted on a known cast-list reader are routed to its writer with per-subresource state tracking; after a writer is released, the reader's barriers remain on the reader until a new view establishes another writer. Reader-first resources remain independent. Related: #3094 #3282. The independent-resource path remains available; the copy route in #3094 is a natural fallback if both changes land.What is in it
cast_list.rs: opt-in capability checks, current-writer selection, pair lifecycle, and reader-to-writer barrier routing.vram.rs,placements.rs,title_textures.rs,texture_upload.rs: pair-page placement, view handling, and cap lifecycle.real.rs,list_x.rs, and GPU tests: hook integration and regression coverage.Tested
RTX 3090 VM, Windows, debug,
XCL_NETWORK=0, combined heade435d2d8:cast_list: 9 passed, 0 failed.list_x: 116 passed, 0 failed.vramon parent1f6c4de0: 79 passed, 0 failed, 1 ignored (churn_update_tile_mappings_timing).d3d12x: 1,229 passed, 4 failed, 3 ignored; the four failures are the same title-texture tests that fail on main.1c8b5514on this VM:placed_title_textures_share_vram_and_preserve_pixels, the threestream_recheck_*tests, andtest_title_runs_and_game_folder_is_untouched. The VM skipped 28 tests for unavailable capabilities.Regression run
Pending: the rig is paused. No smoke blocks are claimed for
e435d2d8; older blocks do not validate this head.Not tested
XCL_CAST_LIST=1on this head.AI use
An agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 4 Hydrogen (tools: Claude Code, Codex, Antigravity).
Generated with Claude Code
https://claude.ai/code/session_013oPUFCA9W9F8Qb5MPK33bR