Repository navigation
Conversation
|
merge-check claim |
|
merge-check |
vasanex
left a comment
There was a problem hiding this comment.
Review of e751b212 (code reading and the runs named below, not a merge-check) · 2 findings, 1 question
In short: for textures the new flag, state and clear rules only change combinations the PC refuses today, and the two retries (committed heap properties / flags, reserved resources) run only after a first call failed, so resources that are created fine on main keep their path there. Two places do change behaviour for creations that work on main (inline): a placed buffer the title creates in UNORDERED_ACCESS without the UAV flag, and a committed ALLOW_DISPLAY resource through the older method. Neither was reached by the runs below, and the PR's tests run without unified memory, so they do not pin either.
Measured (RTX 3080, Ryzen 9 7950X, merge of this head onto main 078358a0)
cargo test --workspace --no-fail-fast -- --test-threads=4(debug): 3011 passed, 0 failed, 52 ignored; 25 SKIPPED, the same tests as onmain(22 no wave64, 2 no heap windows, 1 driver cache).scripts/smoke.ps1, 60 s, release, offline: 1674 frames, exit 0x0, 0 device removals, 0 crashes, peak commit 18940 MB (main078358a0, same title and time: 1677 frames, 17992 MB). The start screen only, not the 3D world.- That title creates its two display targets through the newer method (#127) on
mainand here, so finding 2's path was not run; its log has no resource-creation warning on this head.
Not checked: AMD and Intel; a title that takes either path of the findings; the reserved-resource retry on a real title (it needs a call the PC refuses first); whether packed-mip tile counts stay the same on a retried reserved texture.
Review by Claude Code (Claude Fable 5.2), with an independent second read by a subagent (Claude Fable 5.2) whose points were checked before use, posted without a human check of each point. An automated PR review workflow is running at the request of the user.
| // matching resource flag was stripped on the PC are dropped from the sanitized PC flags | ||
| let orig_flags = u32::from_le_bytes(x[0x30..0x34].try_into().unwrap()); | ||
| let flags = u32::from_le_bytes(d[0x30..0x34].try_into().unwrap()); | ||
| let state = pc_initial_state_for_desc(orig_flags, flags, state); |
There was a problem hiding this comment.
Finding 1 (medium, read not run): a placed buffer created in UNORDERED_ACCESS without ALLOW_UNORDERED_ACCESS loses its UAV flag.
sparse::place_buffer_in (untouched here) masks a buffer's flags to ALLOW_UNORDERED_ACCESS and adds that flag back when the state it is handed has UNORDERED_ACCESS or RAYTRACING_ACCELERATION_STRUCTURE. On main this call site hands place_at_title_address the title's state with only the console bits masked (pc_initial_state), so a buffer with flags 0 created in state 0x8 at a title address becomes a reserved buffer with the UAV flag, in UAV state. Here the state goes through pc_initial_state_for_desc first, which drops 0x8 because the description has no flag 4, so place_buffer gets state 0 and the buffer is made without the flag, in COMMON. The same happens in placed_in_heap_x's heap-block path (real.rs, the place_at_title_address call). After that CreateUnorderedAccessView on it takes the no-UAV branch (a null PC view), and the title's barriers to and from UAV name a state the resource cannot have.
place_console_buffer (committed buffers) still passes the unsanitized state and keeps the promotion, so the two paths now differ.
Suggested: keep 0x8 for buffers in pc_initial_state_for_desc (the promotion downstream is what makes it valid), or pass the unsanitized state to place_at_title_address as before. A test of it needs unified memory, which the new tests do not bring up.
There was a problem hiding this comment.
Fixed in 26eaea26: both call sites promote the UAV flag on the sanitized description before the state is sanitized, so the state reaches place_at_title_address as on main. (I cannot mark the thread resolved from this account.)
Checked by reading the delta e751b212..26eaea26, not rerun. Follow-up by Claude Code (Claude Fable 5.2), posted without a human check; an automated PR review workflow is running at the request of the user.
Added 04:00Z: whole suite and smoke now run on this head merged onto main 395405e4 (RTX 3080, Ryzen 9 7950X): cargo test --workspace --no-fail-fast -- --test-threads=4: 3017 passed, 0 failed, 56 ignored, 25 SKIPPED (the same tests as on main); 60 s offline smoke: 1697 frames, exit 0x0, 0 device removals, 0 crashes, peak commit 17983 MB (main: 1689 frames, 18158 MB).
| ); | ||
| crate::xlog_info!(" desc (dwords): {:x?}", (0..16).map(|k| w(4 * k)).collect::<Vec<_>>()); | ||
| } | ||
| if (flags as u32 & D3D12_HEAP_FLAG_ALLOW_DISPLAY.0 as u32) != 0 && desc != 0 && crate::gpu::shader::readable(desc, 0x38) { |
There was a problem hiding this comment.
Finding 2 (medium, read not run): this early return changes what an older-method ALLOW_DISPLAY resource is, and it is not limited to textures.
On main a committed texture with heap flag 0x8 through this method goes on to place_console_texture → create_placed_resource_x: it is placed at a unified-memory address and gets that path's bookkeeping (vram, title_textures, depth_uav::note_created, lut3d::created); only if that declines is it committed with the title's heap flags. With this return it is always a plain committed PC resource with heap flags 0, and:
- none of that bookkeeping runs;
create_display_targetcalls the title's allocation hook (kernelx::runtime_alloc(size, D3D_DISPLAY_TARGET)) for the texture's console size. That was written for the newer method (Runtime: CPU check at start, bounded reads in the exception logger, t… #127); a title that creates display targets through the older method now gets a hook call it did not get before, and nothing gives that memory back when the target is released;- if the one
CreateCommittedResourceincreate_display_targetfails, itshris returned and the path that works onmainis not tried; - there is no dimension test: a committed buffer whose heap flags carry 0x8 also returns here, never reaches
place_console_buffer, ends up outside unified memory, andpc_heap_properties(props, false, …)treats it as a texture.
The description's "Not tested" says no title exercised this. Is there a title where the older method's display target fails on main and this fixes it? If so, a line about it would help; if the aim is only consistency with #127, limiting the return to textures and falling through to the existing path when create_display_target fails would keep what works today.
There was a problem hiding this comment.
Buffers and the failure case are fixed in 26eaea26: a buffer no longer takes the early return, and a failed create_display_target falls through to the existing path. What remains as before: a texture with heap flag 0x8 through the older method that create_display_target creates successfully is still a plain committed resource instead of a placed one (none of the placed path's bookkeeping, plus the allocation-hook call). If that is the intent, as for #127, a line in the description is enough; no title here takes that path, so I cannot measure either way.
Checked by reading the delta e751b212..26eaea26, not rerun. Follow-up by Claude Code (Claude Fable 5.2), posted without a human check; an automated PR review workflow is running at the request of the user.
| // - textures cannot combine ALLOW_RENDER_TARGET with ALLOW_DEPTH_STENCIL: keep DS for depth | ||
| // families and RT for color formats so neither format nor later views break. | ||
| if is_buffer { | ||
| flags &= !(0x01 | 0x02 | 0x08 | 0x20); |
There was a problem hiding this comment.
Question (low): is ALLOW_RENDER_TARGET (0x01) really invalid on a PC buffer? D3D12_RTV_DIMENSION_BUFFER exists, and as far as I know D3D12 refuses only depth-stencil, simultaneous access and deny-shader-resource on buffers. The unit test asserts the strip, but the WARP "raw description is rejected" cases have no buffer with 0x01 alone. If the PC accepts it, stripping it here also drops a RENDER_TARGET initial state and the clear value for such a buffer. Not verified on a device from my side.
There was a problem hiding this comment.
Answered in 26eaea26: the flag stays on buffers, the clear value is still dropped, and the WARP test covers both cases. Thanks for checking it on a device.
Checked by reading the delta e751b212..26eaea26, not rerun. Follow-up by Claude Code (Claude Fable 5.2), posted without a human check; an automated PR review workflow is running at the request of the user.
Unifies console resource description, resource flag, initial state, optimized clear value, and heap property/flag sanitization across CreateCommittedResource(X), display target creation, CreatePlacedResource(X) and its fallbacks, and CreateReservedResource(1). Consolidates and resolves all review findings from xcl-dev#3291, xcl-dev#3414, xcl-dev#3418, and xcl-dev#3376: - pc_resource_desc enforces PC buffer/texture flag invariants (buffer strips DS/DENY_SRV/SIMULTANEOUS_ACCESS while keeping RT/UAV; texture RT|DS resolves by format family; depth strips UAV/SIMULTANEOUS_ACCESS; DENY_SHADER_RESOURCE requires DS or video reference flags; MSAA strips SIMULTANEOUS_ACCESS; textures strip ALLOW_CROSS_ADAPTER). - pc_initial_state_for_desc derives initial state from sanitized PC flags and drops RENDER_TARGET, DEPTH_WRITE/READ, and UNORDERED_ACCESS when the matching PC flag is absent; placed console buffers created in UNORDERED_ACCESS or RAYTRACING_ACCELERATION_STRUCTURE promote ALLOW_UNORDERED_ACCESS before pc_initial_state_for_desc so place_at_title_address / sparse::place_buffer_in keep the UAV flag and state. - pc_clear_for_resource_desc handles buffers/non-targets before reading the pointer, maps depth families (including typeless/partially-typeless formats) to their typed DSV clear format, resolves typeless/UNKNOWN clears on concrete RTs, and is used across every creation and fallback path. - dev_create_committed_resource_x routes non-buffer ALLOW_DISPLAY resources through create_display_target (falling through to the existing path if it fails), retries sanitized heap properties (preserving CPU-visible console buffers as CUSTOM+L0) and heap flags only on failure, and logs both raw and tried values on failure. - dev_create_reserved_resource(1) adds a console-only fallback (skipping own_work and PC-native invalid calls) that maps console layouts (0 or >3) to 64KB_UNDEFINED_SWIZZLE, refuses bytes-per-texel-changing format promotions, and propagates the actual PC state to lut3d/reserved_3d. Assisted-by: Antigravity (Gemini 4 Neon) Assisted-by: Claude Code (Claude Opus 5.5)
e751b21 to
26eaea2
Compare
|
Thanks @vasanex for the careful review! All three points are fixed in
Re-verified on
|
|
merge-check In short: The PR merges four earlier PRs into one commit: it cleans up console resource flags, initial states, optimized clear values and committed heap properties/flags, and adds retry paths for committed and reserved resources; the push since e751b21 keeps ALLOW_RENDER_TARGET on buffers, gives placed buffers back their UAV flag, and limits the older-method ALLOW_DISPLAY path to textures, trying the existing path when it fails. Reading the code shows no bug that blocks merging: the new rules only change descriptions the PC refuses today, and the retries run only after a first call failed. Still open: one default-path reroute for older-method display-target textures, the size and mixed scope, the meaning conflict with open #3141, unguarded RTV/DSV calls on the flag that gets dropped, and missing caller-level tests. Medium
Nit
Checked and fine
How this was tested
Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point. |
|
Thanks @Foniass for the thorough merge-check and 234 s title run! Leaving HEAD at 26eaea2 untouched to preserve the verified run — the red PR description check is the repo-wide pull_request_target startup_failure currently hitting all open PRs (python scripts/pr_check.py --local passes with description ok on 26eaea2). |
Unifies console resource description, resource flag, initial state, optimized clear value, and heap property/flag sanitization across D3D12.X resource-creation and fallback paths.
Consolidates and replaces #3291, #3414, #3418, and #3376 into a single consistent change (417 changed runtime lines across
device_x.rsandreal.rs), addressing every open review finding from those four PRs and follow-up review feedback on this PR.What is in it
device_x::pc_resource_desc): strips buffer-illegal flags (ALLOW_DEPTH_STENCIL,DENY_SHADER_RESOURCE,ALLOW_SIMULTANEOUS_ACCESS) while keepingALLOW_RENDER_TARGET(valid on PC buffers forD3D12_RTV_DIMENSION_BUFFER, without an optimized clear value) andALLOW_UNORDERED_ACCESS; resolves textureRT | DSconflicts by format family (depth families keepDS, color formats keepRT); stripsALLOW_SIMULTANEOUS_ACCESSon depth and MSAA textures; keepsDENY_SHADER_RESOURCEonly whenALLOW_DEPTH_STENCILor video reference flags (0x40 | 0x80) are set; stripsALLOW_CROSS_ADAPTERon textures forced toTEXTURE_LAYOUT_UNKNOWN.device_x::pc_initial_state_for_desc,promote_placed_buffer_uav): derives initial state from the sanitizedpc_flagsinstead of raw console flags and dropsRENDER_TARGET(0x04),DEPTH_WRITE | DEPTH_READ(0x10 | 0x20), andUNORDERED_ACCESS(0x08) whenever the matching PC resource flag is absent; placed console buffers created inUNORDERED_ACCESS(0x08) orRAYTRACING_ACCELERATION_STRUCTURE(0x40_0000) promoteALLOW_UNORDERED_ACCESS(0x04) beforepc_initial_state_for_descincreate_placed_resource_xandplaced_in_heap_xsoplace_at_title_address/sparse::place_buffer_inkeep the UAV flag and state.device_x::pc_clear_for_resource_desc): checks buffer/non-target flags before reading the pointer (returning null even for unreadable pointers), adds21 | 22 | 46 | 47tois_typeless_format, mapsALLOW_DEPTH_STENCILclears unconditionally viadepth_clear_format, resolvesUNKNOWN/typeless clears on concrete render targets, drops the unusedclearargument fromplace_console_bufferandplace_at_title_address, and wirespc_clear_for_resource_descthrough every creation and fallback path (create_placed_resource_x,dev_create_committed_resource_x,create_display_target,placed_in_heap_x,own_memory_if_larger_on_the_pc,create_reserved_with_fallback).ALLOW_DISPLAYrouting (real.rs): routes non-bufferALLOW_DISPLAYtextures indev_create_committed_resource_xthroughcreate_display_target(which now sanitizes desc, heap props, clear value, and initial state), intentionally matching slot Runtime: CPU check at start, bounded reads in the exception logger, t… #127's committed display-target path (allocating console memory viakernelx::runtime_alloc(D3D_DISPLAY_TARGET)as a plain committed resource rather thanplace_console_texture) and falling through to the existing path ifcreate_display_targetfails; retries sanitized heap properties (pc_heap_properties, preserving CPU-visible console buffers viaCUSTOM + L0with the sameCPUPageProperty) and committed heap flags (pc_committed_heap_flags, stripping console bits,ALLOW_DISPLAY, tier-1DENY_*,HARDWARE_PROTECTED,ALLOW_WRITE_WATCHon non-CUSTOM, andALLOW_SHADER_ATOMICSwithoutSHARED) only onhr < 0, logging both raw and tried values on failure.real.rs): addscreate_reserved_with_fallbackforCreateReservedResourceandCreateReservedResource1(skipping XCL'sown_workand purely PC-native invalid calls), maps console texture layouts (0or> 3) to64KB_UNDEFINED_SWIZZLEwhile keepingROW_MAJORrejected, refuses bytes-per-texel-changing format promotions (85/86/115,116/117,118..=120) soUpdateTileMappingstile counts cannot diverge, masksreserved_3dstate withPC_RESOURCE_STATES, and propagates the actual created PC state fromplaced_in_heap_x/own_memory_if_larger_on_the_pctolut3d::created.device_x::testsandreal::resource_creation_fallback_testscovering all invariants, placed-buffer UAV promotion,ALLOW_RENDER_TARGETbuffers on WARP,ALLOW_DISPLAYbuffer bypass, and prior review regressions.Tested
rustc 1.99.0 (b940084d7 2026-09-28), DXC 1.9.2609, debug + release.cargo build --release -p xcl: ok, 39 warnings (matchesorigin/main5ad98adbc: 39 warnings, 0 new warnings)..\scripts\test.ps1(with DXC 1.9.2609):3010 passed, 0 failed, 52 ignoredacross 44 targets (SKIPPEDGPU tests on this adapter: 24 — 22no wave64, 2no heap windows), including all 25hle::d3d12x::device_x::testsand all 3hle::d3d12x::real::resource_creation_fallback_tests(WARP D3D12 coverage for reserved, placed, committed, and display-target fallbacks).Regression run
Not tested
XCL_SAMPLE_*environment variables (52 ignored).place_at_title_addressend-to-end execution of a placed buffer created inUNORDERED_ACCESSwithoutALLOW_UNORDERED_ACCESS(verified bypromote_placed_buffer_uav+pc_initial_state_for_descunit tests and code inspection ofsparse::place_buffer_in, not an end-to-end UMA unit test).CreateReservedResource1,CUSTOM+L0CPU-visible console buffers, orALLOW_DISPLAYcommitted targets beyond the WARP integration tests and theea3b5e4dsmoke run.AI use