Repository navigation
startup: size device view descriptions by the title record - #3552
Conversation
|
The Linux job's failure is inherited from That is the entry #3546 adds. #3535, #3538 and #3546 are green because their branches predate #3471; this PR is based on current I will rebase this branch on |
|
Audited the rest of the shim for this class, so the answer to "is this the last one" is measured rather than assumed. Compiled a probe that prints sizeof and �lignof for every struct the shim sizes or forwards, once against the in-box headers and once with -I out/build/warp-agility/agility-headers/build/native/include. Of 63 structs, exactly one differs: Everything else agrees: D3D12_SHADER_RESOURCE_VIEW_DESC, D3D12_RENDER_TARGET_VIEW_DESC, D3D12_DEPTH_STENCIL_VIEW_DESC, the blend/rasterizer/depth-stencil descriptions, D3D12_GRAPHICS_PIPELINE_STATE_DESC, D3D12_COMPUTE_PIPELINE_STATE_DESC, the indirect argument and draw/dispatch argument structs, root signature and descriptor range descriptions, D3D12_RESOURCE_DESC, heap, barrier, rect, viewport, copy-location and subresource structs. Cross-check of every remaining use of a UAV description in the shim:
| So the 40/48 split has no remaining instance. The probe is untracked scratch right now; I can add it under ools/ with the two compile lines if you would rather future SDK bumps be re-measured than re-audited by reading. |
lukaslw-lab
left a comment
There was a problem hiding this comment.
Reviewed a07bf2df by reading the diff; not built or run.
Verdict: changes requested. The SRV/UAV part is right. The RTV/DSV widths it reuses are too short, and since the copy is now always forwarded, array views lose fields.
-
MUST
view_bytestakes 20 for slot 20 and 16 for slot 21 (src/startup_stubs/d3d12_xs_device.cpp:5655). Line 5664 now forwards that zero-filled copy for every view; before, it was forwarded only when the format was remapped, and then withsizeof(24) bytes.In the public
d3d12.hlayout (24 bytes in both the in-box and Agility headers, as your audit found),D3D12_DEPTH_STENCIL_VIEW_DESChasFlagsat byte 8 and the union at 12. So the first 16 bytes stop afterMipSlice. Under this PR:Texture1DArray/Texture2DArrayDSVs reach the desktop withFirstArraySlice = 0andArraySize = 0;Texture2DMSArrayDSVs getArraySize = 0;- an RTV
Texture2DArraylosesPlaneSlice(bytes 20-23).
An
ArraySizeof 0 is an invalid description, so shadow-map cascades or cube depth views break where they worked before. Fix: usesizeof(D3D12_RENDER_TARGET_VIEW_DESC)andsizeof(D3D12_DEPTH_STENCIL_VIEW_DESC)(24/24; the split is only 40/48 for UAVs) and keep thestatic_asserts. -
SHOULD The same 20/16 comes from
record_view(:5558, older than this PR), so recorded RTV/DSV views lack those fields too. That's worth fixing in the same line change. A test case with aTexture2DArrayDSV ofArraySize > 1through slot 21 would pin it. Today nothing creates an array RTV/DSV through the device slots, which is why the dev suite stayed green. -
Checked, no finding:
- Slots 18/19 at 40 bytes match
ViewRecord. - The null-view adaptation now reads the copy, and with no readable description it is skipped as before.
desc_copyis zero-filled before the copy, so the 8 Agility-only UAV bytes are 0.- The format remap still writes into the same buffer.
- Slots 18/19 at 40 bytes match
Tests: (e) and (f) put a slot 19 description at a page edge. (e) proves the range check now reads 40 bytes; (f) proves the forwarded copy keeps the device alive. Neither reaches slots 20/21. CI did not run them: the Windows job uses the pr test filter, which leaves out startup_view_dimension_*. The in-box headers also could not show the 40/48 split, as the PR says.
view_slot() took the length of a slot 18-21 description from the desktop header and forwarded the title's pointer to the desktop. With the Agility SDK 1.620.2 headers D3D12_UNORDERED_ACCESS_VIEW_DESC is 48 bytes where the title supplies a 40-byte record: a description ending at a readable page failed the 48-byte readability test, the 3D mip range check was skipped, and the desktop then read its own struct from a 40-byte record and removed the device with DXGI_ERROR_INVALID_CALL. A valid description at the same boundary removed it too. Size the shim's own checks by the record width, as the compute dispatch path already does, and forward a zero-filled desktop-sized copy of the record instead of the title pointer, so the desktop can never read past it. startup_view_dimension_device gains two cases that place the description at the end of a readable page with an unreadable page after it.
The forwarded copy and the recorded width for slots 20 and 21 took 20 and 16 bytes, from record_view. D3D12_RENDER_TARGET_VIEW_DESC and D3D12_DEPTH_STENCIL_VIEW_DESC are 24 bytes each in both header sets, with ArraySize at offset 16 and PlaneSlice at 20, so a truncated copy reaches the desktop with ArraySize 0: an array RTV or DSV loses its slice range and the device is removed. The copy is now always forwarded, so this would have regressed views that worked before. Use sizeof for both widths and assert the 24-byte layout.
a07bf2d to
386db60
Compare
|
Both points are fixed at Measured layout, both header sets:
Verification at this head, after rebasing onto The three Agility failures are On the suggested test: I could not get an array-DSV case to work in |
lukaslw-lab
left a comment
There was a problem hiding this comment.
Reviewed 386db609 by reading the diff; not built or run.
Verdict: approve. Slots 20/21 now copy and forward all 24 bytes in both view_slot paths, so array RTV/DSV fields survive. No MUST.
- SHOULD
docs/experiments/agility-compute-views.md:60still says "20 for a render target and 16 for a depth-stencil view". The code now uses 24 for both (src/startup_stubs/d3d12_xs_device.cpp:5754,:5852). A one-line doc fix; it can go in this PR or follow. - NIT The header comment of
tests/startup_view_dimension_device.cpp:17lists (e) but not (f). - On the array-DSV case you could not get working: if that fixture made its texture from
uav_descas (e) does, the resource hasALLOW_UNORDERED_ACCESSand a colour format. A DSV on that is invalid whatever the shim forwards.startup_clear_depth_stencilusesD32_FLOATwith onlyALLOW_DEPTH_STENCIL. With thestatic_asserts in place, this test does not block. - Checked, no finding:
record_viewand the forwarded copy use the same widths for slots 18-21.- Both
static_assert(... == 24)hold for the in-box and Agility headers, as your layout probe showed. - The null-view adaptation now reads
desc_copy.desktop_formatremaps only formats 116-120, and the packed check needs a resource. SoB5G5R5A1/B4G4R4A4null views reachadapt_null_viewwith the title's format, as before. desc_copylives until the desktop call and the removal dump.
Tests: (e) and (f) still reach only slot 19 at a page edge. No case covers slots 20/21; the static_asserts pin their width. CI did not run (e) or (f): the pr test filter leaves out startup_view_dimension_*, and the in-box headers cannot show the 40/48 split.
The Agility note still said 20 for a render target and 16 for a depth-stencil view after the widths became 24 and 24, and the fixture header listed (e) without (f).
R0Y00
left a comment
There was a problem hiding this comment.
Re-reviewed be173937: since the previous approval only the experiment note and fixture header comment changed. The note now matches the 24-byte RTV/DSV code and 40-byte guest SRV/UAV records. Independently built the device fixture in Release and ran ctest --preset release --no-tests=error -R '^startup_view_dimension_(warp|hardware|off_control_warp)$'. All three passed, including inbox WARP, RTX and the disabled-default-view control. This local check used inbox headers; the Agility size split is covered by the author's separate report.
Change
view_slot()sized its own checks on a slot 18-21 description from the desktop header, and forwarded thetitle's pointer to the desktop for the desktop to read at its width. The title supplies a 40-byte record;
the Agility SDK 1.620.2 header makes
D3D12_UNORDERED_ACCESS_VIEW_DESC48 bytes. A description endingexactly at a readable page therefore failed the 48-byte readability test, the 3D mip range check was
skipped, and the desktop then read its own struct from a 40-byte record and removed the device with
DXGI_ERROR_INVALID_CALL(0x887a0001).Two changes:
ViewRecord::srv_desc_bytes,ViewRecord::uav_desc_bytes, 20 fora render target, 16 for a depth-stencil view), which is what
note_view()already records for the sameslots, with
static_asserts holding each desktop struct to at least that width.never read past the title's record. The null-view adaptation reads the same copy rather than the title
pointer.
startup_view_dimension_devicegains two cases that place the description at the end of a committed pagewith a
PAGE_NOACCESSpage after it.Verification
Base
44a3ad5aa. Agility SDK 1.620.2, WARP 1.0.22, NVIDIA GeForce RTX 4070 Ti SUPER (driver 32.0.16.2101).0x887a00010x887a0001The same three rows hold on
warpand onhardware. The control row is what separates a working rangecheck from a skipped one; the middle row is the refusal the fixture expects.
Negative control: with the source change stashed and the fixture rebuilt, both boundary cases fail on
both adapters:
No regression. The change touches every view creation, so:
All five in-box failures are on
mainalready and unrelated:native_cvt_f16_i16_{ir,controls}andnative_sdwa_profiles_{ir,dxil}(issue #3547) andstartup_triage_run(#3546). Eachstartup_view_dimension_*,startup_null_views_*andstartup_present_view*entry passed.Why CI cannot see this
In-box headers already report 40 bytes, so the check succeeded before and after and the fixture passes in
both Windows jobs. The reproduction needs the Agility configuration. The three earlier instances of this
40/48 split are #3510 and #3523 (merged) and #3536 (issue); this closes the device-slot instance.
Measured detail and the case table are also recorded in
docs/experiments/agility-compute-views.md.Fixes #3536.
Follow-up at
386db6092sizeof(D3D12_RENDER_TARGET_VIEW_DESC)andsizeof(D3D12_DEPTH_STENCIL_VIEW_DESC)(24 each) instead of 20 and 16, which truncatedArraySizeat offset 16 andPlaneSliceat 20.record_view's width for those slots is the same 24, so recorded array RTV/DSV views keep their fields.static_asserts pin both to 24 bytes, so the truncation cannot return silently.844e57d.Verification at this head:
The three Agility failures (
startup_memory_srv_diag_{warp,hardware},startup_compute_comparison_srv_warp) fail identically with this change stashed, so they are not from it.