Repository navigation
startup: publish single-element 2D and 3D textures by address in device slot 70 - #2157
Conversation
…ce slot 70
A 1x1 2D or 1x1x1 3D texture with one mip, one sample and a plain colour format keeps its only
texel at offset 0 for layout UNKNOWN, linear and the swizzle modes without pipe/bank XOR, so the
memory SRV call publishes it like the address-only tiled views and the draw uploads that texel
through the footprint path, with the same change detection. XOR layouts, larger shapes, mip chains,
arrays, multisampling, block-compressed formats, R8 (placed path) and GPU-written flags stay refused.
startup_single_element_srv checks the descriptions without a device (an XOR-layout mutation is the
negative control); startup_address_single_element_{warp,hardware} draws eight columns per dimension,
including a texel rewritten and published again and ten refused descriptions.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…resource lookup A live render-target, depth or UAV resource at the view's address is written on the desktop side, so a flagless single-element view there must not read title memory; it keeps the existing lookup, which needs the same description and otherwise refuses as before. The fixture adds that refused call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…address_srv Keeps its CMake hunk away from the neighbouring BC address-view timeout line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Accept only the layouts AMD addrlib defines (0, 0x100, 0x101, 0x102, 0x105, 0x106, 0x109, 0x10A) and default or 64 KiB alignment; refuse a view over a GPU-written resource that covers the address (base, or inside a known allocation size) with its own reason, gpu_written_resource; rehash the texel on every bind. The draw fixture points its refusals at memory holding another texel and reads a same-frame rewrite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…U-written refusal, limits Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…riptor unchanged The consumer compares the destination's 32 bytes after each of the fifteen refused calls and exits with 60 plus the call's position when one changed them. Accepting 2x1 now fails with 61. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tedin7
left a comment
There was a problem hiding this comment.
Review of head acdc50e84a8428eaabd2bd06b301a616f4b7e249 (comment only, no approval).
Result: no P1, no P2. Two nits.
What I checked
git diff --stat origin/main...HEAD: 12 files, +451/-7. Title and body are neutral. Mergeable, not draft.- CI on this head: Linux Python checks pass, gfx1013 fixtures pass, "Build and test on Windows" passes (3m42s). The /O2 job and the chart job were skipped.
python3 tests/docs_links_check.py: self-test passed, 18 files, 391 links.python3 tests/bidi_controls_check.py: self-test passed, 1407 files, no bidi controls.git diff --check origin/main...HEAD: clean (rc=0).- Read
single_element_srv.h, thed3d12_memory_srv.inlhunks (gpu_written_at,publish_tiled_texture, the slot 70 branch) and theupload_texturehunks ind3d12_draw.inl.
Logic
- The accepted layouts (0x100, 0x101, 0x102, 0x105, 0x106, 0x109, 0x10A, plus UNKNOWN) put the only texel at offset 0. Reserved and XOR layouts are refused. This matches the stated addrlib reasoning.
- The
!singleguards inupload_texturekeep the BC/tiled plan checks and the surface size unchanged for existing paths.single_element_bytesreturns 0 for BC, so the old paths are not affected. recheck = single || ...rehashes at most 16 bytes per bind. The cost is fine and the "write between two draws" case is covered by column 3 of the consumer test.- The refused calls leave the destination descriptor unchanged, and the consumer checks this.
Not run locally
- The C++ test, the consumer test and the XOR negative control need the Windows D3D12 headers and WARP. This host has only g++ and no
d3d12.h. I relied on the Windows CI job for them. I did not run a Win2025 job or a mutation of the new logic.
Nits (not blocking)
d3d12_memory_srv.inl,gpu_written_at: a GPU-written texture whose allocation size is unknown (info.bytes == 0) is only matched at its exact base. An address inside it is not caught. The PR body already says so. A one-line comment next to thebytesfallback would help the next reader.single_element_srv.h, format switch: it duplicates a part of theFETCH_FORMATSandFETCH_DXGIknowledge. A short comment saying why these formats were chosen (same bytes on desktop) would keep the sibling tables easier to keep in step.
AI-assisted; commands listed were executed locally.
|
I tightened the publication-time check to test the full texel range against live GPU-written backing, even if the texel starts before the resource. In the new control two bytes lie on each side of a UAV buffer base. The descriptor stays unchanged. All six Windows Release tests passed on the candidate, including the existing address SRV and single-element WARP and RTX 4060 Laptop draws and the XOR refusal. |
tedin7
left a comment
There was a problem hiding this comment.
Review of head 84c66897860d9aef3b2d879e89b773099905577b (comment only, no approval).
Result: no P1, no P2.
What I checked
git diff --stat origin/main...HEAD: 12 files, +453/-7. Title and body are neutral, mergeable, not draft.- CI on this head: Linux Python checks, gfx1013 fixtures and "Build and test on Windows" all pass (the /O2 and chart jobs are skipped).
python3 tests/docs_links_check.py: self-test passed, 18 files, 391 links.python3 tests/bidi_controls_check.py: self-test passed, 1407 files, no bidirectional controls.git diff --check origin/main...HEAD: clean.python3 tests/startup_triage_run_check.py: 0 failed.tests/startup_single_element_srv_check.cppbuilt with mingw and run under wine:50 cases, 12 accepted, 38 refused, 0 mismatches. The--mutate xornegative control returns 1 as intended.- The
.pydraw test needs the Windows consumer and a D3D12 device, so I did not run it. I did not run a Windows WARP job either.
Mutations (reverted with git checkout -- .)
- Added
0x115(XOR layout) to the accepted layouts insingle_element_srv.h: killed ("4 KiB S with XOR 0x115", 1 mismatch). - Replaced the
r.MipLevels != 1check withfalse: killed ("zero mips" and one more case, 2 mismatches).
Code read
single_element_bytesandsupports_single_element_srv: the accepted layout set, flags, formats and whole-texture view checks match the description. The only texel is at offset 0 in every accepted layout.gpu_written_overlap: both overlap branches (address at or below the base, address inside the known size) are right. A resource of unknown size only counts at its base, as the comment says.upload_texture: thesinglepath skips the tiled plan and size checks and reuses the footprint upload. The rehash on every bind is fine for at most 16 bytes.
Nit
d3d12_draw.inlsingleis derived fromtiled_address_srvplussingle_element_bytes(desc). A comment saying that a 1x1 BC or R8 texture can never take this branch would help the next reader. No change needed for merge.
AI-assisted; commands listed were executed locally.
Change
Device slot 70 (the memory SRV call) now publishes a 1×1 2D or 1×1×1 3D texture by address, without a resource object. Until now such views were refused with
unsupported_description, and the destination descriptor kept stale bytes. The only texel is read from offset 0 of guest memory, so no detiling is needed.Accepted:
0x100), plus the GFX10 swizzle modes AMD addrlib defines without pipe/bank XOR (0x101,0x102,0x105,0x106,0x109,0x10A).Still refused:
0x103,0x104,0x107,0x108,0x10B) and XOR layouts (0x110and up);A view over a live render-target, depth or UAV resource that covers the address (its base, or inside its known allocation size) is refused with a new reason,
gpu_written_resource. It is listed intools/startup/triage_run.py.The translated draw uploads the texel through the existing footprint path. It rehashes the texel (at most 16 bytes) on every bind, so a write between two draws in the same frame is seen.
Code touched:
src/startup_stubs/single_element_srv.h(acceptance and element size).src/startup_stubs/d3d12_memory_srv.inl: acceptance, size and an early publish block.src/startup_stubs/d3d12_draw.inl,upload_textureonly: thesingleflag in theuploadablecheck, three!singleguards, and the recheck line.Verification
Code under test:
acdc50e8:bf652854merged withmainat442d289e, plus one test-only commit.main(94337881) is clean and has not been re-tested.a289585b), which changes the same file.Environment: Windows 11 build 26300, debug layer off. Hardware is NVIDIA GeForce RTX 5090 (driver 32.0.16.2135); WARP is 10.0.26100.10068. Adapter names come from the consumer's output.
Result at
bf652854: 20 passed, 0 failed, 0 skipped.startup_single_element_srv(50 descriptions),startup_single_element_srv_xor_control(WILL_FAIL), 5startup_memory_srv*,startup_image_3d_controls,startup_triage_run,startup_tools_lint.startup_address_single_element,startup_address_srv,startup_address_buffer_srv,startup_address_bc_view,startup_image_3d.Result at
acdc50e8:ctest --preset release --no-tests=error -R '^startup_address_single_element_(warp|hardware)$'gives 2 passed, 0 failed, 0 skipped.Read-back pixels.
startup_address_single_element_{warp,hardware}draws 8 columns per dimension (2D and 3D) and reads back the target. All 32 RGBA pixels per dimension match on both adapters. The columns are:0x105;Descriptor unchanged on refusal. The same test makes fifteen refused calls before column 3:
0x115, layout0x10B, 4 MiB alignment;After each refused call the consumer compares the destination descriptor's 32 bytes and exits with 60 plus the call's position if they changed. Column 3 must then still read the previously published texel. Each refused call names memory holding a different texel, so any call wrongly accepted changes the image.
Negative controls, each rebuilt and run on WARP, each failing:
00000000;0x115: column 3 readsdeadbeef;5aa53cff, the previous texel;deadbeef.Evidence and follow-up
Fixtures. All inputs are source-built: literal texel bytes in
tests/startup_address_srv.cpp. The device-free check istests/startup_single_element_srv_check.cpp. The reproduction command is indocs/experiments.md, section "Single-element 2D and 3D textures published by address".Assumptions.
0x100, offset 0 is exact.5c142e46), not run: a single mip sits at offset 0 (Gfx10Lib::ComputeSurfaceInfoMacroTiled), and the coordinate pattern of a non-XOR mode is zero at the origin.Local run of a console executable (a run of the title's executable, not a fixture; counts only):
Limits.
upload_textureandd3d12_memory_srv.inl. That PR handles 2D tiled textures and does not cover this slice.Checklist
AI-assisted (Claude Code).
🤖 Generated with Claude Code