Repository navigation
shader: lower pixel structured-to-raw buffer loads - #3100
SimSalabimse wants to merge 7 commits into
Conversation
Track the structured-to-raw descriptor conversion in a pixel stage and lower a non-indexed buffer load as a raw byte-address read bounded by the converted byte count. Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
R0Y00
left a comment
There was a problem hiding this comment.
Independent Debug and Release /O2 each passed 3/3 (ctest --test-dir <build> --no-tests=error -j 1 -V -R '^startup_gfx2hlsl_ps_raw_descriptor', built offscreen_check), on 551708c4 integrated over 300b93f0 (tree 23601ed0692b940e59b6f2515077a0734a34099a). The ordinary address case and the existing bound-drop mutant behaved as expected.
Two added source-built probes expose gaps:
- The generated manifest contains
ud 5andudsrc 4 numrecords 0.load_translationinsrc/startup_stubs/d3d12_draw.inlskips the unrecognized source and sizes the root constants from the four accepted entries. I reproduced that exact omission with the offscreen fixture by callingdraw_once(..., constants[:-1], expected_words()). The draw succeeded through PSO creation with no debug warnings or errors. WARP returned four zeros, and RTX returned3f800000,40800000,41000000,deadbeefinstead of3f800000,40800000,41000000,00000000. Please bind the count or keep the unsupported ordinary draw on an explicit refusal path. A synthetic regression should exercise one of those two outcomes through the manifest loader. - The new range check detects wrap in
a + payloadafterahas already been truncated. In the same fixture, replace the instructionv_mov(0, 0)withstruct.pack('<I', 0x7e0002c4)to makev0=0xfffffffc. At immediate offsets 12, 28 and 32, the generated HLSL wraps the byte address to 8, 24 and 28 before testing it. Both WARP and RTX then read40400000,40e00000,41000000from the wrong portion of the view. Please check overflow when forming the initial byte address and add a guard for this case. The RDNA 2 ISA, §8.1 and Table 35 describes the immediate-plus-VGPR offset and raw bounds check.
Windows 26200.9974, SDK/DXC 10.0.26100.0, WARP 10.0.26100.9818, RTX 4060 Laptop driver 32.0.16.1656, D3D12 debug layer enabled.
tedin7
left a comment
There was a problem hiding this comment.
Reviewed head 551708c42 (Linux, Python only: no Windows run on my side).
What works:
python3 -B tests/startup_gfx2hlsl_ps_raw_descriptor_check.pypasses at the head: the four controls are refused by name and the CPU model gives3f800000,40800000,41000000,00000000.- Running
raw_descriptor_alu()in the pixel stage is the right fix. The conversion words are tagged the same way as in compute and vertex stages, andraw_conversion_shapes()keeps the clamped and unclamped products apart. - The bound for
buffer_load_dword*matches the raw out-of-range rule for OOB_SELECT 3. The "RDNA 2" ISA guide, 8.1.8 Table 37 and 8.1.5, describes the converted NUM_RECORDS as a byte count.
One more gap, besides the two already reported (the numrecords entry the runtime drops, and the wrap after truncation):
-
tbuffer_load_format_*now gets through unbounded.tbuffer()reachesload_descriptor()throughbuffer_address(), so a pixeltbufferread through the converted descriptor now passes the check and setsraw_load_bound. But onlyop_buffer_load_dwordreads that bound. Source-built case: in your fixtureprogram(conversion()), replace the fourbuffer_load_dwordreads with onetbuffer_load_format_x v1, v0, s[16:19], 0 format:[BUF_FMT_32_FLOAT] offen offset:32. That is the word right pastNUM_RECORDS * stride = 32.- At the parent
db28a796, it is refused:buffer load through a modified descriptor. - At
551708c42, it translates asa = v0 + 32; v1 = r0.Load(a);. There is no bound and nostride/numrecordsentry, so it reads0xdeadbeefwhere the hardware returns 0.
Two ways to fix it. Apply the same bound in
tbuffer()(andload_format()), with one byte count per element. Or keepraw_conversion_ok=Falsefor the MTBUF path, so it stays refused as before. A control for this case in the existing check would lock it in. - At the parent
Commands run:
git fetch origin pull/3100/head
python3 -B tests/startup_gfx2hlsl_ps_raw_descriptor_check.py # at 551708c42: pass
python3 -B probe_tbuffer.py <tree at 551708c42> # translates, unbounded r0.Load(a)
python3 -B probe_tbuffer.py <tree at db28a796 + this PR's check file> # refused: buffer load through a modified descriptor
(probe_tbuffer.py imports your check module and builds the program above: smem_load_x4(DESC, 8) + conversion() + v_mov(0, 0) + <MTBUF word> + s_waitcnt + exp_mrt0(1, 1, 1, 1). The MTBUF word is op 0, FORMAT 22, offen, offset 32, srsrc s[16:19], soffset inline 0.)
AI-assisted; commands listed were executed locally.
rasptum
left a comment
There was a problem hiding this comment.
Review of 551708c4. Comment only.
The translator part is good. It turns the pixel structured-to-raw descriptor conversion into a raw load with a bound. Everything else that touches those words still refuses. I tried 17 bad variants locally (wrong masks, wrong constants, words from a second descriptor, steps out of order) and all of them refused.
Blocking: the draw never fills numrecords. The new stage asks for udsrc N numrecords <srv>. The udsrc parser in d3d12_draw.inl only knows rect, basevertex, startinstance, rootconst, stride, d16unorm16, descword3 and mrtbits. So the entry is never added, and because of the i == tr.uds.size() check, every udsrc after it is dropped too. In a real draw that means either the root signature doesn't match the shader, or the limit reads 0 and every converted load returns zero, with no warning. Fix: fill numrecords from words[2] of the table SRV, the way stride is filled, or refuse unknown udsrc kinds. The --startup-raw-buffer test fills its constants by hand, so it can't catch this.
Should fix:
- test an x2 or x4 load that crosses the limit, stride 0, a non-zero
soffset, and the out-of-place (s_movcopy) form; - add a few of the bad variants above as negative controls, especially the second-descriptor ones;
- "in-place" in the text and in the control name is misleading: the accepted fixture rewrites the registers in place too.
Nits: unaligned addresses lose their low two bits without a refusal. The DW1 swizzle bits, ADD_TID and the DW3 format are kept but never checked; one line in the docs would cover it.
Ran on this head: tests/startup_gfx2hlsl_ps_raw_descriptor_check.py passes, with all 4 controls refusing. tools/run_checks_parallel.py over tests/checks/python-linux passes 235/235. CI is green.
Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
|
Review of Beyond what is already reported here (the dropped
I also checked two things that are not problems in this PR:
AI-assisted. |
A pixel load through the structured-to-raw conversion adds each address term with an overflow check before the range compare. A typed buffer load through that descriptor stays refused. The draw stand-in stores numrecords from dword 2 of the table descriptor and refuses an unknown udsrc line. Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
pigalot
left a comment
There was a problem hiding this comment.
I tried to review 327d134c merged over main 4b0350ea. The merge is clean (tree 90ef8851) and git diff --cached --check is clean, but the stand-in does not compile. This matches the Build and test on Windows failure on this head.
Finding: IndirectBufferView initialisers don't match the new field order.
- The struct: it now declares
stride, records, upload, withUINT records = 0;added beforebool upload = false;. - The initialisers: the brace-initialisers in
indirect_table_bufferpass the values in the other order, as{..., stride, true, records},{..., stride, false, records}and{native, offset, bytes, stride, upload, records}. - Result: MSVC rejects all three as narrowing:
. .\tools\dev.ps1; cmake --preset dev; cmake --build --preset dev --target d3d12_xs_shimsrc\startup_stubs/d3d12_draw.inl(2365): error C2397: conversion from 'UINT' to 'bool' requires a narrowing conversion
src\startup_stubs/d3d12_draw.inl(2377): error C2397: conversion from 'UINT' to 'bool' requires a narrowing conversion
src\startup_stubs/d3d12_draw.inl(2407): error C2397: conversion from 'UINT' to 'bool' requires a narrowing conversion
Even with narrowing allowed, records would land in upload and the upload flag in records.
Suggested direction: declare records after upload, so the existing initialisers line up. Or swap the last two values in the three initialisers. The draw path that reads records should then be covered by the numrecords manifest case you added.
Earlier findings. I read 327d134c against the requests on 551708c4. Because the stand-in doesn't build, I couldn't run the Windows fixture, so none of these is confirmed yet:
numrecordsdropped by the loader (R0Y00 1, rasptum):accept_udsrc_linenow acceptsnumrecords, and an unknownudsrcmakesload_translationrefuse the manifest instead of skipping it.- Wrap after truncation (R0Y00 2): the pixel raw path now adds each address term with an overflow check before the range compare.
- MTBUF without the bound (tedin7 3):
tbufferpassesraw_conversion_ok=False, so a typed load through the converted descriptor stays refused.
I'll run the fixture and the 0xfffffffc and MTBUF probes once the stand-in builds.
Verdict: request changes on 327d134c, because the head does not compile.
Environment: Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Windows SDK 10.0.28000.0.
CI: Build and test on Windows fails on 327d134c with the same C2397 errors.
This reply was AI-assisted.
|
Follow-up to the changes-requested review on A second blocker: CI never reaches this step because the build fails first. Possible directions (unconfirmed): skip the driver when The translator fixes run clean. With only the
Still open (non-blocking): Leyukaka's limit. This reply was AI-assisted. |
|
One more blocking item on
Possible directions, none of them tried:
This reply was AI-assisted. |
Brace initialization put the upload flag in records and narrowed the record count into the bool. The view is filled by member name, including the compute root returns. Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
The parser cases live in a small C++ target the Windows build compiles with MSVC. The Python check runs that binary, and compiles the same source with cl or g++ when CTest has not handed it one. Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
pigalot
left a comment
There was a problem hiding this comment.
Retested 587a3dec integrated over main 2e12dd8e (tree 8448e705). The merge is clean and git diff --cached --check is clean.
My changes-requested review on 327d134c.
IndirectBufferViewfield order: addressed. All six construction sites now go throughindirect_buffer_view(resource, offset, bytes, stride, records, upload), which assigns by member name. That covers the three inindirect_table_bufferand the alias return that only passed four values. It also covers the two incompute_root_srv_buffer, where{..., 0, true}had been compiling silently withtrueinrecordsanduploadleft false.d3d12_xs_shimbuilds indevandrelease.g++on Windows: addressed. The udsrc cases are nowtests/startup_udsrc_line_check.cpp, built as the CMake targetstartup_udsrc_line_checkand registered asstartup_gfx2hlsl_ps_raw_descriptor_udsrc. The Python check gets the built binary throughX2W_UDSRC_CHECK. A direct run compiles the same source withclon Windows andg++elsewhere.- Earlier translator findings. The wrap check, the MTBUF refusal and the
numrecordsloader fix are covered by the mutants below.
What I traced. In a pixel stage the full conversion now matches either byte_count or byte_count+min1. The load is bounded per dword by a + 4(i+1) <= lim, where lim is the 32-bit product of the view's stride (or max(stride, 1)) and numrecords entry constants. Each address term is added with an unsigned carry check. tbuffer passes raw_conversion_ok=False. On the stand-in side, records is filled from descriptor word 2 in both branches and copied into record_counts[i], and the numrecords udsrc reads it. An unknown udsrc kind or an index gap now makes load_translation refuse the manifest; it used to skip the line.
What I ran. I built d3d12_xs_shim offscreen_check startup_udsrc_line_check in dev and release, then ran
ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^(startup_gfx2hlsl_ps_raw_descriptor(_udsrc|_warp|_hardware)?|startup_flat_param_(controls|warp|hardware)|startup_gfx2hlsl_buffer_store|startup_gfx2hlsl_load_desc_controls)$'All 9 pass in Debug and in Release /O2, with no skips. Both startup_gfx2hlsl_ps_raw_descriptor_hardware runs read back 3f800000,40800000,41000000,00000000 for DXC and for FXC. startup_flat_param_hardware reports debug_errors=0 debug_warnings=0 for every case. I also ran the 155 startup_gfx2hlsl_* tests that have no _warp/_hardware suffix, plus startup_flat_param_controls, in dev: 156/156 pass.
Negative control and mutants. Each mutant was run against the tests above. The C++ ones were rebuilt in dev.
| Mutant | Result |
|---|---|
tools/startup/gfx2hlsl.py back to main |
killed: _ps_raw_descriptor, _warp and _hardware fail; _udsrc still passes |
| pixel load ignores the bound | killed (udsrc stride manifest expectation) |
| no carry check on the address terms | killed (bounded-load text and the draw) |
typed tbuffer accepts the conversion |
killed (typed buffer load: translated) |
<= lim → < lim |
killed |
numrecords constant reads strides[] |
killed (source assertion in check_udsrc) |
| udsrc index gap accepted | killed (udsrc driver exit 4) |
stride and records swapped in the desktop-buffer indirect_buffer_view call |
survives |
compute_root_srv_buffer passes records 1, upload false |
survives |
Restored and rebuilt afterwards; the restored build passes again and git diff --quiet is clean.
Non-blocking.
- The stand-in's
recordspath has no runtime test. The draw fixture binds throughoffscreen_check, not the stand-in. On the stand-in side onlycheck_udsrc()'s source assertions cover it, so a wrong argument order at anindirect_buffer_viewcall site still passes. The same holds for thecompute_root_srv_bufferfix, which is a real behaviour change:uploadused to be false on that path. A CPU-side check ofindirect_table_bufferorcompute_root_srv_buffer, or an indirect-draw case throughd3d12_xs_shim, would pin it. - Leyukaka's limit is still open.
run_startup_raw_bufferandcheck_startup_raw_bufferaccept up to 64 entry constants. With the descriptor table that is 65 DWORDs, over the 64-DWORD root-signature limit. The fixture itself uses far fewer. - The description is stale. "Commit under test" is still
551708c4. It also says the stand-in "does not yet publishnumrecords", but this head does.
Verdict: approve on 587a3dec. This supersedes my changes-requested review on 327d134c. R0Y00's changes request on 551708c4 still needs its own sign-off, so I'm not merging.
Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088, Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; SDK 10.0.28000.0 DXC and FXC (the ones CTest picked up); Python 3.12.10; D3D12 debug layer on in startup_flat_param_hardware.
CI: Build and test on Windows passes on 587a3dec; Run platform-independent Python checks on Linux passes too, so the g++ path builds there.
This reply was AI-assisted.
pigalot
left a comment
There was a problem hiding this comment.
Retested 587a3dec integrated over main 2e12dd8e (tree 8448e705). The merge is clean and git diff --cached --check is clean.
My changes-requested review on 327d134c.
IndirectBufferViewfield order: addressed. All six construction sites now go throughindirect_buffer_view(resource, offset, bytes, stride, records, upload), which assigns by member name. That covers the three inindirect_table_bufferand the alias return that only passed four values. It also covers the two incompute_root_srv_buffer, where{..., 0, true}had been compiling silently withtrueinrecordsanduploadleft false.d3d12_xs_shimbuilds indevandrelease.g++on Windows: addressed. The udsrc cases are nowtests/startup_udsrc_line_check.cpp, built as the CMake targetstartup_udsrc_line_checkand registered asstartup_gfx2hlsl_ps_raw_descriptor_udsrc. The Python check gets the built binary throughX2W_UDSRC_CHECK. A direct run compiles the same source withclon Windows andg++elsewhere.- Earlier translator findings. The wrap check, the MTBUF refusal and the
numrecordsloader fix are covered by the mutants below.
What I traced. In a pixel stage the full conversion now matches either byte_count or byte_count+min1. The load is bounded per dword by a + 4(i+1) <= lim, where lim is the 32-bit product of the view's stride (or max(stride, 1)) and numrecords entry constants. Each address term is added with an unsigned carry check. tbuffer passes raw_conversion_ok=False. On the stand-in side, records is filled from descriptor word 2 in both branches and copied into record_counts[i], and the numrecords udsrc reads it. An unknown udsrc kind or an index gap now makes load_translation refuse the manifest; it used to skip the line.
What I ran. I built d3d12_xs_shim offscreen_check startup_udsrc_line_check in dev and release, then ran
ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^(startup_gfx2hlsl_ps_raw_descriptor(_udsrc|_warp|_hardware)?|startup_flat_param_(controls|warp|hardware)|startup_gfx2hlsl_buffer_store|startup_gfx2hlsl_load_desc_controls)$'All 9 pass in Debug and in Release /O2, with no skips. Both startup_gfx2hlsl_ps_raw_descriptor_hardware runs read back 3f800000,40800000,41000000,00000000 for DXC and for FXC. startup_flat_param_hardware reports debug_errors=0 debug_warnings=0 for every case. I also ran the 155 startup_gfx2hlsl_* tests that have no _warp/_hardware suffix, plus startup_flat_param_controls, in dev: 156/156 pass.
Negative control and mutants. Each mutant was run against the tests above. The C++ ones were rebuilt in dev.
| Mutant | Result |
|---|---|
tools/startup/gfx2hlsl.py back to main |
killed: _ps_raw_descriptor, _warp and _hardware fail; _udsrc still passes |
| pixel load ignores the bound | killed (udsrc stride manifest expectation) |
| no carry check on the address terms | killed (bounded-load text and the draw) |
typed tbuffer accepts the conversion |
killed (typed buffer load: translated) |
<= lim → < lim |
killed |
numrecords constant reads strides[] |
killed (source assertion in check_udsrc) |
| udsrc index gap accepted | killed (udsrc driver exit 4) |
stride and records swapped in the desktop-buffer indirect_buffer_view call |
survives |
compute_root_srv_buffer passes records 1, upload false |
survives |
Restored and rebuilt afterwards; the restored build passes again and git diff --quiet is clean.
Non-blocking.
- The stand-in's
recordspath has no runtime test. The draw fixture binds throughoffscreen_check, not the stand-in. On the stand-in side onlycheck_udsrc()'s source assertions cover it, so a wrong argument order at anindirect_buffer_viewcall site still passes. The same holds for thecompute_root_srv_bufferfix, which is a real behaviour change:uploadused to be false on that path. A CPU-side check ofindirect_table_bufferorcompute_root_srv_buffer, or an indirect-draw case throughd3d12_xs_shim, would pin it. - Leyukaka's limit is still open.
run_startup_raw_bufferandcheck_startup_raw_bufferaccept up to 64 entry constants. With the descriptor table that is 65 DWORDs, over the 64-DWORD root-signature limit. The fixture itself uses far fewer. - The description is stale. "Commit under test" is still
551708c4. It also says the stand-in "does not yet publishnumrecords", but this head does.
Verdict: approve on 587a3dec. This supersedes my changes-requested review on 327d134c. R0Y00's changes request on 551708c4 still needs its own sign-off, so I'm not merging.
Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088, Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; SDK 10.0.28000.0 DXC and FXC (the ones CTest picked up); Python 3.12.10; D3D12 debug layer on in startup_flat_param_hardware.
CI: Build and test on Windows passes on 587a3dec; Run platform-independent Python checks on Linux passes too, so the g++ path builds there.
This reply was AI-assisted.
pigalot
left a comment
There was a problem hiding this comment.
Correction: the changes-requested review at 23:28 on 587a3dec was posted by mistake. It is a second copy of the 23:23 approval, sent with the wrong state, so please disregard it. The verdict on 587a3dec is approve, as written in the 23:23 review.
A second, independent run over main 9345c21f agrees with that review:
- Tests: the
ps_raw_descriptortests and their neighbours (indirect, root-SRV and compute dispatch) pass in Debug and Release, on WARP and on hardware, with no skips.startup_compute_dispatch_native_*fails with "left ['revision.txt'] in the cache", and it fails the same way onmainfad97f47. - The untested stand-in path (non-blocking 1 in that review): this run confirms it. Swapping
recordsand the upload flag at any of the threeindirect_table_buffercall sites survives every test. A stand-in case whereNUM_RECORDSis not 1 would pin it.
R0Y00's changes request on 551708c4 still needs its own sign-off, so this isn't being merged from here.
This reply was AI-assisted.
|
Thanks for the reviews, all three points are fixed on 327d134. @R0Y00, overflow and numrecords The draw stand-in now keeps a numrecords constant. It reads that count from dword 2 of the table descriptor, and an unknown udsrc line refuses the translation instead of dropping every line after it. The bounded pixel load also checks each address term for overflow before the range compare, so a vgpr of 0xfffffffc plus 12, 28 or 32 stays zero instead of wrapping into the buffer. I ran python3 -B tests/startup_gfx2hlsl_ps_raw_descriptor_check.py. Mutants that drop the overflow check, the numrecords kind, or the record-count store each fail, and the restored check passes. python3 -B tests/startup_tools_lint_check.py tools/startup exited 0. The Linux Python suite from the CI list, python3 -B tools/run_checks_parallel.py --from-dir tests/checks/python-linux plus the listed scripts, passed 246 checks and exited 0. @tedin7, typed buffer load A typed tbuffer load through the converted descriptor is refused again, with the same message as before this change. The control is one float load at offset 32, the first word past the record count times the stride. A mutant that lets that load through fails the check, because the shader translates with no bound. I ran python3 -B tests/startup_gfx2hlsl_ps_raw_descriptor_check.py, python3 -B tests/startup_tools_lint_check.py tools/startup (exit 0), and the Linux Python suite python3 -B tools/run_checks_parallel.py --from-dir tests/checks/python-linux plus the listed scripts (246 checks, exit 0). @rasptum, runtime bound and extra controls The runtime parser knows numrecords now and fills it from dword 2 of the table descriptor, the same place stride comes from. An unknown kind or a gap refuses the manifest, so a later udsrc line is not dropped. The check covers a dwordx2 and a dwordx4 that cross the limit, stride 0, a non-zero soffset, and a conversion that runs on an s_mov copy. The old in-place control is renamed to a word overwritten with zero. Extra refusals cover a wrong stride mask, OOB select 2, a constant scale, steps out of order, and a stride taken from a second descriptor. Unaligned addresses, the swizzle bits, ADD_TID and the format field stay unchecked; that is noted in the experiment writeup. Each of those new checks failed when I took out only its fix, then passed again after restoring it. python3 -B tests/startup_gfx2hlsl_ps_raw_descriptor_check.py passes. python3 -B tests/startup_tools_lint_check.py tools/startup exited 0. The Linux Python suite, python3 -B tools/run_checks_parallel.py --from-dir tests/checks/python-linux plus the listed scripts, passed 246 checks and exited 0. Windows test PC: at 587a3de, the ps_raw_descriptor tests passed twice (4/4, ctest exit 0) and startup_gfx2hlsl_ 389/389 passed, ctest exit 0. AI-Assisted |
Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
pigalot
left a comment
There was a problem hiding this comment.
Retested 130d32cb, your merge of main 7fcde81f, integrated over current main fdb6faaa. The merge is clean (tree d7bf28d8) and git diff --cached --check is clean.
Your merge. git show --remerge-diff 130d32cb shows one conflict, in src/startup_stubs/d3d12_draw.inl, on Translation. It keeps this branch's UdKind enum, whose values are tied to the udsrc_* constants and include num_records, together with main's Srv comment that adds kind 5 (cube) from #2938. That is the right combination. Apart from that hunk, the PR's diff over main is byte-identical to 587a3dec's diff over its own base. So the earlier review of 587a3dec, including the traced behaviour and the mutants, still applies to this code.
What I ran.
-
Builds: full
devandrelease/O2. -
The PR's tests:
ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^(startup_gfx2hlsl_ps_raw_descriptor(_udsrc|_warp|_hardware)?|startup_flat_param_(controls|warp|hardware)|startup_gfx2hlsl_buffer_store|startup_gfx2hlsl_load_desc_controls)$'
9/9 pass in Debug and in Release, with no skips.
startup_flat_param_hardwarereportsdebug_errors=0 debug_warnings=0for every case. -
Full suite:
ctest --test-dir out/build/dev --no-tests=error -j 8 -E '(startup_audio|_hardware$)'gives 2002 tests: 1945 pass, 0 fail, 57 capability skips.
Still open (non-blocking, unchanged since 587a3dec).
- The stand-in's
recordspath has no runtime test. A wrong argument order at anindirect_buffer_viewcall site still passes. - Leyukaka's limit is still open. 64 entry constants plus the descriptor table make 65 DWORDs.
- The description is stale. It still names
551708c4as the commit under test.
Verdict: approve on 130d32cb. R0Y00's changes-requested review on 551708c4 still needs R0Y00's own sign-off, so I'm not merging.
Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; SDK 10.0.28000.0 DXC and FXC (the ones CTest picked up); Python 3.12.10; D3D12 debug layer on in startup_flat_param_hardware.
This reply was AI-assisted.
|
I tested a local reconciliation of Release /O2 passed 6/6 with no skips: the parser, raw descriptor controls, WARP and physical pixel readbacks, and both adjacent Compute input snapshot fixtures. cmake --build --preset release --target d3d12_xs_shim startup_stream_consumer offscreen_check startup_udsrc_line_check
ctest --preset release --no-tests=error --output-on-failure -j 1 -R '^startup_(gfx2hlsl_ps_raw_descriptor|compute_dispatch_input_)'Windows 11 26200.9974, inbox WARP 10.0.26100.9818 and RTX 4060 Laptop driver 32.0.16.1656. The source-built readbacks cover the first word past the converted range and the named refusal controls. Please refresh this source with current main before the hosted checks rerun. |
|
Merged current main (only d3d12_draw.inl conflicted; kept the cube comment and the num_records enumerator) and retested 130d32c on Windows: startup_gfx2hlsl_ps_raw_descriptor 4/4 passed, twice. No startup_udsrc test exists in this tree. AI-Assisted |
|
Thanks for the fixes on Must fix
Should fix Still open: Leyukaka's constant limit is unchanged ( What I ran: This comment was AI-assisted. |
Every indirect buffer view is built by the named constructor, so records and the snapshot source stay in their own fields. A buffer view the title created publishes its element count, and the raw-buffer fixture leaves one root dword for its descriptor table. Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
pigalot
left a comment
There was a problem hiding this comment.
Retested 445abdf7 integrated over main ec71c290 (tree 7b6c6606). The trial merge is clean and git diff --cached --check is clean.
What changed since 130d32cb. 445abdf7 is a merge of main 3926a289, and git show --remerge-diff 445abdf7 shows it also carries new work beyond the conflict resolution. I read all of it:
- Conflict in
d3d12_draw.inl(R0Y00 04:16Z, JohnConnorNPC 1): resolved as asked.IndirectBufferViewis nowIndirectBufferViewOf<ID3D12Resource>in the newindirect_buffer_view.h, withstride, records, upload, source. All seven construction sites (five inindirect_table_buffer, two incompute_root_srv_buffer) go through the named constructor with bothrecordsandsource.main's snapshot option is kept; the null return passes source 3 and the snapshot return source 2. No brace-initialised return is left. - Zero bound on title-created views (JohnConnorNPC 2): addressed. Both view-token branches now set the count from
view.Buffer.NumElements(recordsinindirect_table_buffer,record_counts[i]indraw_translated). - Wrap guard never drawn (JohnConnorNPC 3): addressed.
check_drawnow draws thev0 = 0xfffffffcprogram and expects0,0,0,0, with DXC and FXC. - Loader refusal (JohnConnorNPC 4): addressed by a source assertion that the text after
x2w-draw unsupported udsrchasreturn;and nocontinue;. - Stale bound (JohnConnorNPC 5): addressed. A two-descriptor control expects
v2 = r1.Load(a + 0);for the untouched descriptor. - Leyukaka's limit: addressed. Both fixtures now cap the entry constants at 63.
What I ran. Full dev and release /O2 builds, then
ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^(startup_gfx2hlsl_ps_raw_descriptor(_udsrc|_warp)?|startup_flat_param_(controls|warp)|startup_gfx2hlsl_buffer_store|startup_gfx2hlsl_load_desc_controls|startup_compute_dispatch_input_warp|startup_slot67_indirect_dispatch_warp|startup_indirect_translated_(draw|indexed|indexed_upload|indexed_alias)_warp)$'
ctest --test-dir out/build/<preset> --no-tests=error -j 1 -V -R '^(startup_gfx2hlsl_ps_raw_descriptor_hardware|startup_flat_param_hardware|startup_compute_dispatch_input_hardware)$'13/13 and 3/3 pass in Debug and in Release, with no skips. On hardware, both compilers read back 3f800000,40800000,41000000,00000000 and "a wrapping address reads four zeros". startup_flat_param_hardware reports debug_errors=0 debug_warnings=0 for every case.
Negative control and mutants. Each was rebuilt in dev and run against the seven ps_raw_descriptor, indirect_translated, slot67_indirect_dispatch and compute_dispatch_input tests (WARP). The unmodified tree passes 7/7.
| Mutant | Result |
|---|---|
tools/startup/gfx2hlsl.py back to main |
killed: _ps_raw_descriptor and _warp fail |
drop self.raw_load_bound = None |
killed (two-descriptor control) |
| no carry check on the address terms | killed (bounded-load text) |
unsupported udsrc: return; → continue; |
killed (source assertion) |
constructor drops source |
killed (udsrc driver exit 9; startup_compute_dispatch_input_warp also fails) |
constructor puts stride in records |
killed (udsrc driver exit 10) |
| stride and records swapped at the desktop-buffer return | killed (source assertion, and startup_indirect_translated_draw_warp fails at run time) |
| snapshot return reports source 0 | killed (source assertion, and startup_compute_dispatch_input_warp) |
records = 0; added after records = view.Buffer.NumElements; |
survives |
record_counts[i] = 0; added after record_counts[i] = view.Buffer.NumElements; |
survives |
record_counts[i] = view.stride; added after record_counts[i] = view.records; |
survives |
offscreen_check accepts 64 constants again |
survives |
No equivalent mutants. The files were restored afterwards and git diff --quiet is clean.
Non-blocking.
- The record count the stand-in publishes is pinned by text only. The three surviving count mutants keep the asserted source lines and change the value, and no test notices. This is the same gap as non-blocking 1 in my review of
587a3dec, now narrower: the constructor and the argument order are covered, the value that reachesud<numrecords>in a stand-in draw is not. A stand-in draw through a converted descriptor withNUM_RECORDSother than the stride would pin it. - A raw title-created view gets a count in elements, not bytes (read from the code, not run). For a raw view, both token branches use
stride 0andbytes = NumElements * 4, and nowrecords = NumElements. The table-descriptor branch treats stride 0 as one byte per record (bytes = (stride ? stride : 1) * words[2]). With the clamped conversion the shader's limit ismax(0, 1) * NumElements, a quarter of the view, so loads from the upper three quarters would read 0. With the plain conversion the limit is 0. Suggested direction, unconfirmed: publishbytesas the count when the view is raw, or refuse anumrecordsconstant on a raw token view. - The 63-constant cap has no test. A 64-constant control in either fixture would pin it.
- The description is stale. It names
551708c4as the commit under test and says the stand-in "does not yet publishnumrecords". The fixes for the latest review are inside a commit titled as a merge ofmain; a line in the description listing them would help the next reader.
Verdict: approve on 445abdf7. The findings from my earlier reviews and the ones from R0Y00's 04:16Z comment and JohnConnorNPC's 07:34Z comment are addressed at this head as listed above. R0Y00's changes-requested review on 551708c4 is still recorded and needs R0Y00's own sign-off, so I am not merging this.
Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10; D3D12 debug layer on for the hardware runs (X2W_TEST_DEBUG_LAYER=1).
CI: Build and test on Windows passes on 445abdf7.
This reply was AI-assisted.
|
The five review items are fixed on
Windows test PC (NVIDIA 32-lane), head ctest --preset dev --no-tests=error -j 1 -R '^startup_gfx2hlsl_ps_raw_descriptor' -E 'startup_audio_output|startup_audio_pacing|startup_audio_provider'
ctest --preset dev --no-tests=error -j 1 -R '^startup_compute_dispatch_input_' -E 'startup_audio_output|startup_audio_pacing|startup_audio_provider'
ctest --preset dev --no-tests=error -j 1 -R startup_gfx2hlsl_ -E 'startup_audio_output|startup_audio_pacing|startup_audio_provider'
AI-Assisted |
Change
Since #2910, a non-indexed MUBUF load in a pixel stage through the standard structured-to-raw descriptor conversion is refused as
buffer load through a modified descriptor.load_descriptor()already accepts that shape, butraw_descriptor_alu()only ran for compute and vertex stages.This change:
raw_descriptor_alu()in a pixel stage as well, so the four conversion words are tracked the same way as for compute and vertex stages.NUM_RECORDS * stride(NUM_RECORDS * max(stride, 1)when the stride extract was clamped). A wrapped address reads as zero.byte_count+min1tag when that extract was clamped. Stores already accepted either product; they now match both tags explicitly.idxenloads refused under their current messages.A stride-only clear still lowers as an unbounded raw load, as in compute and vertex stages. Compute and vertex load emission is unchanged.
The graphics stand-in fills
strideand does not yet publishnumrecords, so a completed title pipeline still needs that constant before a draw applies the bound. The offscreen fixture supplies both.Verification
Commit under test:
551708c42ba15bb8eddc4b5fc4be97bf5d7a7c91, on top of upstream maindb28a796.A source-built pixel fixture converts a table descriptor and reads it with
buffer_load_dword ... offenat four offsets, including one word pastNUM_RECORDS * stride. Negative controls, each refused by name: byte count missing, OOB step missing, in-place word rewrite, and anidxenload. A clamped extract usesmax(stride, 1) * NUM_RECORDS. A draw readback is compared with a CPU model of the same product. Dropping the bound must read the word past the limit.Windows test PC (RTX 4070 Ti, driver 621.35, Windows 11 25H2, MSVC 19.44):
startup_gfx2hlsl_ps_raw_descriptor,startup_gfx2hlsl_ps_raw_descriptor_warpandstartup_gfx2hlsl_ps_raw_descriptor_hardwarepassed twice (3/3, ctest exit 0, no skips; 3.00 s and 2.76 s). The same worktree then ran the fullstartup_gfx2hlsl_list: 379/379 passed, 0 failed, 0 skipped, ctest exit 0, 1158.04 s.The fixtures are hand-assembled gfx1013 words. No game files or captured programs.
Checklist
Fixes #3064
AI-assisted (Cursor)