Repository navigation
shader: lower s_ff1 of a general scalar (#2022 Item F) - #10
Open
SimSalabimse wants to merge 62 commits into
Open
SimSalabimse wants to merge 62 commits into
SimSalabimse wants to merge 62 commits into
Conversation
…ts with CLI suite (R0Y00#2608) Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
…0#2613) X2W_D3D12_VIEW_CENSUS=1 counts new distinct view records by device slot and logs the record vector capacity and hash bucket count before an insertion that is expected to grow either. Record identity, ids and descriptor binding do not change. Refs R0Y00#1199 Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
…Y00#2475) * startup: lower v_pack_b32_f16 with op_sel and neg/abs in gfx2hlsl D[15:0] = S0.f16, D[31:16] = S1.f16 (AMD RDNA 2 ISA, VOP3 V_PACK_B32_F16). op_sel[i] selects the high half of source i (LLVM 15: VOP3_OPSEL); neg and abs act on bit 15 of the selected half, abs first. The halves are copied as bits, as pixel_aot lowers the same instruction; no binary16 denormal flush or NaN quieting is modelled (assumed). Register sources only: an inline float constant on a binary16 operand is a binary16 value. A destination op_sel bit and clamp are refused. Test: tests/startup_gfx2hlsl_pack_b32_f16_check.py evaluates the emitted expression for every op_sel x abs x neg combination over sample register pairs against a bit reference (2304 cases), plus an SGPR source. Negative controls: swapped halves and neg-before-abs are caught by the reference; without the handler the instruction is refused, as on main. * gfx2hlsl: explain the low/high half reads and the strict op_sel spelling in v_pack_b32_f16 (comments only) * tests: verify packed binary16 output words on D3D12 --------- Co-authored-by: Royoo <3230853833@qq.com> Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
…ght with CLI suite (R0Y00#2609) Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
…ta with CLI suite (R0Y00#2616)
…32 (R0Y00#2623) A lane-mask register (a compare result, vcc_lo, exec_lo, a saved EXEC copy) holds only the current lane's bit in the one-lane model, while RDNA 2 reads the whole mask word when the register is a data operand. v_cndmask_b32 (both data operands) and v_mov_b32 (plain, e64 and SDWA DWORD) took such a register through u()/u_src and emitted the lane bit. They now refuse it, after stripping the source modifiers; the lane select of v_cndmask is unchanged. Tests that moved a mask with v_mov_b32 first now expect the new refusal, or read the mask as a lane select instead so they still reach the refusal they test. The SDWA check that accepted a whole-mask move now expects a refusal. AI-assisted.
…R0Y00#2615) * tests: run compute store references on a shared renderer device * tests: compare the descriptor fixture using one device for its reference cases * tests: use one root signature and compute pipeline for the reference batch * tests: retain case labels and 320-word diagnostics in the shared compute run --------- Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com> Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
…0Y00#2617) Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
- Preserve ordinary vector ALU classification and translator refusal. - Exercise the authored encodings and dashboard categories. Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
…2611) An unplaced buffer memory SRV (device slot 70, R0Y00#2395) wrapped the whole allocation holding the view with OpenExistingHeapFromAddress. A 6 KiB view in a ~2.15 GiB title startup block wrapped the block; afterwards each VirtualQuery over it took seconds and DirectStorage requests stalled for ~120 s. Wrap only allocations up to the existing 256 MiB span limit (size from one region-information call); larger ones take the upload copy. Co-authored-by: lukaslw-lab <291379150+lukaslw-lab@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
… with CLI suite (R0Y00#2620) Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
… gfx2hlsl (Part of R0Y00#1723) (R0Y00#2082) * feat: lower image_sample_d to SampleGrad in gfx2hlsl Part of R0Y00#1723. 2D, 2D array and 3D gradient samples; image_sample_c_d is refused by name (needs SM 6.8). * test: register startup_image_sample_d in CMake Part of R0Y00#1723. * startup: keep the guest LOD cap for image_sample_d and document the form in gfx2hlsl * test: WARP and hardware readback for image_sample_d against a CPU reference * tests: build the implicit Sample negative control with two arguments --------- Co-authored-by: Royoo <3230853833@qq.com>
…0Y00#2622) Prove tip translate_mesh57 refuses a back-edge outside the accepted group-memory exchanges by the named loop reason, with a mutant that drops the back-edge and an exact-string oracle. Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com> Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
… gfx2hlsl (Part of R0Y00#1723) (R0Y00#2069) * fix: carry descriptor pointers through s_add_u32/s_addc_u32 in gfx2hlsl A table or root pointer advanced by a literal offset now keeps its source and byte offset, so a following s_load reads the advanced descriptor. A register addend on a pointer is refused instead of silently keeping the old pointer. Part of R0Y00#1723 * shader: refuse descriptor pointer advances across branches and detached s_addc_u32 in gfx2hlsl (Part of R0Y00#1723) * shader: keep the pointer-advance bookkeeping safe for stages without branch state (Part of R0Y00#1723) * fix: keep the branch-join refusal for pointer adds in branching shaders * fix: require the matching high-word add before folding an advanced descriptor pointer * fix: advance 32-bit table pointers without a high word and judge the high operand by content * fix: keep descriptor pointer pair open until its matching s_addc_u32 * fix: let the descriptor pointer pair pass translate's SCC check, add WARP readback case * fix: refuse an untracked-offset pointer as a descriptor, run the pointer check in Linux CI * fix: refuse a root pointer load whose high word was overwritten * Revert "fix: refuse a root pointer load whose high word was overwritten" This reverts commit 0f226c5.
…#2634) shader_cache_rekey.py re-keyed graphics, RTV and slot 67 compute requests and only counted slot 57 mesh requests. mesh57_key hashes the request files under a versioned prefix, so after a revision that changes it a kept cache lost every slot 57 request. The tool now recomputes that key with mesh57_key and copies .ps57, .root and the .m57 ready marker under the new name, with the rules the other kinds follow: everything read first, nothing written on a missing or unreadable part, temporary name then rename, an existing target left alone. Slot 86 is still only counted. AI-assisted.
…shader_census with CLI suite (R0Y00#2437) * shader: extract main(argv), bounds checks, and struct/zlib guards in shader_census with CLI suite * tests: accept Python 3.14+ argparse message in shader_census_cli_check --------- Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
…R0Y00#2636) Track ordinary and oversized compute view heaps separately from the graphics lookup. Keep the table when the same heap is rebound and clear it on changes or unset. Cover the recorder in the CPU checks. Co-authored-by: chasegrindy <302242206+chasegrindy@users.noreply.github.com>
…0Y00#2635) Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com> Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
Merged
5 tasks done
…2638) * shader: lower s_bitset0/1_b32 in gfx2hlsl (R0Y00#2023 Item J) Port the pixel_aot bit set/clear SOP1 forms so ordinary vertex and pixel pipelines that only need an in-place scalar bit update stop refusing at s_bitset1_b32. SCC stays unchanged; lane masks and descriptor SGPRs refuse. Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com> * test: pin sopk descriptor-refusal mutation to sopk-only raise s_bitset0/1_b32 reused the plain-scalar sym allow-list line, so the sopk_accum mutant needle was no longer unique. Match the sopk raise that formats with `base` instead. Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
…0Y00#1974) * feat: record command-list slot 14 Dispatch on the desktop list Part of R0Y00#870. Forward Dispatch only with a desktop compute pipeline and root bound and group counts within 65535 per axis; refuse otherwise. * startup: refuse Dispatch under a compute root with unforwarded arguments, document slot 14 * startup: gate Dispatch on bound compute root SRVs and a pipeline built against the bound root Slot 43 clears a parameter's binding when a replacement is rejected, slot 33 clears all bindings, and the compute pipeline records its root so a mismatched pair is refused. * fix: pass pipeline root out-param in slot86 mesh cached pipeline build * tests: drive native slot 14 Dispatch through the stand-in startup_list_dispatch_native creates a guest device on a desktop adapter (WARP or hardware, debug layer on when installed) and drives command-list slots 86, 25, 33, 43, 148, 14, 9 and 139 of the stand-in. Each refused case must write exactly one "x2w-render Dispatch(x, y, z) refused: <reason>" line, with the expected reason, to X2W_TRAP_LOG: - a root SRV never set; - a rejected (foreign address) or misaligned slot 43 replacement after a valid one; - a root changed and changed back without a new slot 43; - a pipeline built against another root; - a root with a descriptor table, and a root with a static sampler; - an unset root SRV with zero groups; - 65536 groups on X; - a Dispatch on the closed list; - a Dispatch after Reset without new bindings. A forwarded case must write no line. The fixture wraps a pipeline-statistics query around every slot 14 call on an open list, recorded on the underlying desktop list: CSInvocations must be 4 per group when forwarded and 0 when refused. The fully bound call is recorded alone and read back first, so a slot 14 that records nothing fails on its count. All three recordings are executed to a fence and the debug layer must report no error. The skip_srv control drops slot 43 from the first forwarded case and must report it as refused. Each of these one-line changes to d3d12_xs_device.cpp makes the WARP and hardware tests fail: the refusal branch never taken, compute_srv_bound not cleared by slot 33, the bit not cleared by a rejected slot 43, compute_root_has_arguments forced false, root_matches_pipeline forced true, and the slot 14 registration removed. The docs section now names the device fixture and corrects the sentence on which compute root-argument slots have handlers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: list_dispatch header names slot 43 as forwarded --------- Co-authored-by: The Void <mrdominogrm@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Royoo <3230853833@qq.com>
…ews (Part of R0Y00#870) (R0Y00#1975) * startup: record SetComputeRoot32BitConstant(s) (list slots 37, 39) Compute root constants are kept per list next to the graphics ones, in a shared 16 x 8 word store that refuses parameter >= 16 and offset >= 8. A new compute root signature clears them. * fix: track which compute root constant words were set; drop slot 40 claim
…joins (R0Y00#2507) * fix: carry descriptor pointers through s_add_u32/s_addc_u32 in gfx2hlsl A table or root pointer advanced by a literal offset now keeps its source and byte offset, so a following s_load reads the advanced descriptor. A register addend on a pointer is refused instead of silently keeping the old pointer. Part of R0Y00#1723 * shader: refuse descriptor pointer advances across branches and detached s_addc_u32 in gfx2hlsl (Part of R0Y00#1723) * shader: keep the pointer-advance bookkeeping safe for stages without branch state (Part of R0Y00#1723) * fix: keep the branch-join refusal for pointer adds in branching shaders * fix: require the matching high-word add before folding an advanced descriptor pointer * fix: advance 32-bit table pointers without a high word and judge the high operand by content * shader: keep 32-bit table offsets at agreeing forward graphics joins Track a literal table address across copies and forward paths only when the incoming resource and byte offset agree. Exercise the published manifest against two GPU resources and compare all 32 pixels, including the root constant used by the branches. AI-assisted with Codex (GPT-6.2 Astra, xhigh). * fix: keep descriptor pointer pair open until its matching s_addc_u32 * tests: cover vertex-table carries and backward edges in pointer propagation Exercise the two surviving mutations reported on R0Y00#2507 using full source-built programs. AI-assisted with Codex (GPT-6.2 Astra, xhigh). * fix: let the descriptor pointer pair pass translate's SCC check, add WARP readback case * fix: refuse an untracked-offset pointer as a descriptor, run the pointer check in Linux CI * fix: refuse a root pointer load whose high word was overwritten * Revert "fix: refuse a root pointer load whose high word was overwritten" This reverts commit 0f226c5. --------- Co-authored-by: tedin7 <tommasoderosa94@gmail.com> Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com> Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
* runtime: create committed resources through device slot 76 Device slot 76 (Xbox order, +0x260) takes the seven arguments of desktop CreateCommittedResource (heap properties, heap flags, desc, initial state, clear value, riid, ppv); on main the wrapper trapped on it. A console package module creates its resources through it. The slot-127 body becomes create_committed(slot, ...): slot 127 calls it as before, slot 76 without a protected session or castable formats, so both share the per-heap initial state, clear-value retry and title memory. The log line names the slot. New fixture with a negative control: startup_committed_slot76_warp and _hardware (a render target with a clear value and default, upload and readback buffers); the control asks for a 2D texture on an upload heap. * Require exact rejection in the slot 76 control --------- Co-authored-by: Royoo <3230853833@qq.com>
…0Y00#2439) Co-authored-by: Royoo <3230853833@qq.com>
…art of R0Y00#1723) (R0Y00#2002) * startup: translate a stream vertex fetch whose pipeline declares an empty input layout A stream vertex shader that calls the fetch routine was refused whenever the pipeline had no input layout elements. A layout declared with zero elements is now published as 'ia1 0'; the translator reads each fetched register as zero instead of refusing. A stream without a readable layout is still refused. * docs: describe the empty input layout request (ia1 0) and its zero default * test: draw readback for an empty declared input layout * fix: gate zero-element input layout zero-fill behind X2W_STREAM_ZERO_FILL opt-in
Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
R0Y00#2656) * startup: return E_OUTOFMEMORY when a D3D12 wrapper cannot be allocated wrap() used the _aligned_malloc result without a check, so a failed allocation under the job commit limit became a write through a null pointer inside d3d12_xs.dll (seen at the slot 55 derived-pipeline placeholder). wrap() now returns nullptr when the allocation or the registry insert fails. Each of its 16 callers releases the desktop object it created and returns E_OUTOFMEMORY with a null output. startup_wrap_allocation_warp forces the failure through the fixture-only export x2w_d3d12_fail_wraps for device creation and slots 8, 14, 16 and 55; the control never arms it and must report the failure. Fixes R0Y00#2653 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * tests: cover the allocator, command list and committed-resource wrap failures Review follow-up on R0Y00#2653. startup_wrap_allocation now also arms the failure for device slot 9 (CreateCommandAllocator, the shared create_slot path), slot 73 (command list) and slot 127 (committed resource). Each must return E_OUTOFMEMORY with a null output, then succeed. Removing the slot 73 null check makes the test crash at that slot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Preserve the published D3D12 device on wrapper allocation failure --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Royoo <3230853833@qq.com>
…0Y00#2660) A pre-exchange s_cbranch_execz block may hold one s_buffer_load_dword whose result is live after the join, when EXEC there comes from s_mov_b64 exec, -1 then v_cmpx_gt_u32_e32 of a wave-uniform SGPR bound against the proven thread index, with no EXEC write or branch target in between. The guest runs the block for the whole wave when any lane is active, so the HLSL computes wave_any = (tid & ~63u) < bound at the compare, branches around the block only when the wave is empty, and gives the loaded word to every lane of a wave that has an active lane. An empty wave issues no load and keeps the previous value. Vector writes in the block stay predicated per lane. Other compares, non-uniform bounds or offsets, s_load_dword, wider loads and a second live scalar stay refused. AI-assisted.
gfx1013 image atomics covered add, umax and cmpswap only; M200-01 A stops at unsigned image minimum. Allow umin with the shared gfx1030 InterlockedMin lowering, keep it unsigned, and extend the gfx1013 fixture (high-bit operand 0x80000011 vs smin). Other ops stay refused. Refs R0Y00#2618 Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com> Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
…0Y00#2663) Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com> Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
…0Y00#2657) * startup: accept entry-prefix DPP broadcasts when a later loop exists A later uniform loop used to refuse every DPP16 quad broadcast in the same pixel stage via has_branches, even when the broadcast still ran in the entry prefix under s_wqm with EXEC unchanged (M200-01/003). Keep the blocks/exec/wqm gates so a broadcast after a branch target or with divergent EXEC stays refused. Extend the broadcast fixture with a loop case, divergent control, and the same CPU lane reference for draws. Refs R0Y00#2618, R0Y00#2125 Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com> * startup: keep vertex DPP refusal needle for cvt_off Split the non-ps check from the entry-prefix gate so startup_gfx2hlsl_cvt_off_f32_i4_check still matches "straight-line pixel stage" while later loops stay accepted. Refs R0Y00#2618 Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com> * Reject DPP broadcasts when a back edge reaches the entry prefix --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com> Co-authored-by: Royoo <3230853833@qq.com> Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
Fixes R0Y00#1771. Co-authored-by: Royoo <3230853833@qq.com>
cursor
Bot
force-pushed
the
cursor/gfx2hlsl-s-ff1-general-5a9e
branch
from
November 26, 2026 01:33
fdf0743 to
54852e7
Compare
…0Y00#2650) * runtime: add an opt-in console profile for the OEM ConsoleMode read X2W_DEVICE_TYPE (with X2W_RUNTIME_PROXY) answers the title's reads of HKLM\Software\Microsoft\Windows NT\CurrentVersion\OEM\ConsoleMode: 6 = 0x60 (Series S), 7 = 0x64 (Series X), 1 = value missing (PC). Unset, every call goes to the real registry. The proxy rewrites five registry imports of the EXE and package helpers (regular IAT and GetProcAddress by name); visit_imports_with takes a classifier for them and visit_imports keeps its own behaviour. Opening the key and reading the value are logged a few times either way. New fixture with a negative control: startup_console_mode, against fake registry functions; the control leaves the switch unset for the answered cases. * runtime: hook registry imports only from the Windows registry providers Both console-mode routes matched the import name alone, so a package DLL exporting RegQueryValueExW or RegOpenKeyExW could be hooked and, because the first address is kept, become the registry later calls reach. The IAT route now needs the import DLL to be advapi32.dll, kernelbase.dll, kernel32.dll or an api-ms-win-core-registry-* API set, and the bound address to lie in the system-directory copy of one of those modules. The GetProcAddress route needs the module to be one of them. Only addresses inside them are remembered as the real function. startup_console_mode loads a source-built decoy DLL with the same export names and a distinct result. With X2W_DEVICE_TYPE unset and set, its GetProcAddress lookups and synthetic IAT entries naming it (or naming advapi32.dll but bound to it) stay untouched, and the hooks still reach the fake registry. startup_console_mode_provider_control matches by name alone and must fail. startup_runtime_proxy_scope checks the same through the real loader against advapi32.dll. A full 16-entry OEM handle table is now logged once.
) * runtime: composite the presented planes in the output window A console present (CommandQueue slot 32) can carry several planes. The output window showed plane 0 alone; on a two-plane present plane 0 was black and plane 1 held the picture. The window now composites the planes bottom to top: the lowest drawn plane opaque (its alpha ignored), each later plane blended by its own alpha (src-alpha / inv-src-alpha) in plane order. Unreadable or empty records, surfaces the presenter cannot draw and repeats of a surface are left out. X2W_PRESENT_PLANE=<n> shows one plane alone for diagnosis, and the first presents log each plane. The draw (shaders, opaque and blend pipelines, per-plane draws) moves into plane_compositor.h, shared by the window presenter and a new WARP readback fixture. New fixtures with negative controls: startup_present_planes (record layout and order) and startup_present_composite_warp (single-plane baseline, stacked transparent, partly transparent and opaque overlays, skipped repeats; the control composites only the black first plane). * runtime: keep the plane composite opt-in and tighten its control The output window shows plane 0 alone again by default; the multi-plane composite runs only with the experimental X2W_PRESENT_COMPOSITE=1. The baseline capture is restored: the frame capture, the presented signature, the surface dump and the x2w-render presented readback read plane 0's first resource as before. Under the switch the highest plane above plane 0 is sampled separately and logged as "x2w-render raw plane <i> (not composited)". The WARP control is renamed startup_present_composite_overlay_removed_control_warp. It runs the baseline, stacked and skipped cases, then removes the overlays, and passes only on "control ok:", printed when the baseline matched, every fence completed without device removal and the overlay-free picture differs from the stacked expectation in exactly the six overlay cells. Any FAIL line, including setup failure, a fence that does not complete or device removal, now fails it. * Keep the default window presenter single-plane at setup --------- Co-authored-by: Royoo <3230853833@qq.com>
cursor
Bot
force-pushed
the
cursor/gfx2hlsl-s-ff1-general-5a9e
branch
from
November 26, 2026 01:47
d2e4b41 to
b57b674
Compare
… boundary (R0Y00#2631) * startup: give the placed page aliases and the draw dumps the teardown boundary Four function-local statics in the shim own desktop D3D12 objects and are destroyed during the module's CRT teardown, which runs at process exit after Windows has detached the display driver. R0Y00#2590 fixed the two the startup_indirect runs fault in (the indexed-validation pipeline and the rectangle-list converter). This adds the two it did not touch: - the placed page aliases of the translated indirect address route, which the translated-indexed-alias run does populate: a probe reports two placed pages still held when the process exits; - the draw-dump readbacks, which fill only when a dump frame is requested. Both detach their references when DllMain saw a process detach carrying lpReserved, and release them normally on FreeLibrary, through the flag in startup_stubs/d3d12_teardown.h. In the page cache begin()/end() keep the lookup and free-slot scan unchanged; in the readbacks the destructor walks entries_. The heap and page words stay plain addresses, not owned. Neither site is a crash reproduced here: with the detach disabled, the alias run still exits 0 while releasing its two pages at teardown. The boundary is made uniform with R0Y00#2590's, which is where the fault was reproduced. The remaining static of this shape, RedProducers in red_producer_diagnostic.inl, is safe by construction: its live instance is heap-allocated and never destroyed, and the static fallback is built through the Disabled tag and owns nothing. * tests: exercise the placed page aliases and the draw readbacks through unload and exit The review asked for a source-built check of the ownership change: the alias run establishes that the cache is populated, but it exits the same way with or without the guard, and the draw-dump path had no populated test at all. x2w_d3d12_cached_objects_probe grows two bits. Bit 4 creates a heap and a placed buffer on the desktop device, enters it where the translated indirect address route keeps its aliases and answers 1; bit 8 creates the readback buffer and the fence a recorded dump holds and answers 2. startup_teardown_unload now covers four caches. On unload it requires each one to give back what it took: the device reference count for the two original caches, the entry's own object count for the two new ones, which hold no reference on the device. On process termination the child reports through X2W_TEARDOWN_REPORT how many references each cache detached and how many it released, and the parent requires detached=<owned> released=0. The test then re-runs the child once per cache with X2W_TEARDOWN_NO_GUARD=<cache>, which turns that cache's detach into a normal release, and requires the check to fail: without it the guard would be untested, which is what the review said. Two defects surfaced while building it. The probe answered 0 because a fixture created without a parameter block gets a bare D3D12CreateDevice device back, which is not in the shim registry, so as_wrapper() finds nothing -- that device is already the desktop one and is now used as such. And widen() kept the terminating null MultiByteToWideChar writes with -1, so CreateProcessW truncated the child command line. * tests: hand the placed page heap to the fixture so it outlives the buffer The probe kept the heap alive by detaching the creator's reference, which abandoned it: the cache holds only a non-owning heap pointer, so after FreeLibrary nothing owned the heap that backed the placed buffer. The probe now hands the heap over with a reference the fixture owns, and startup_teardown_unload holds it across the unload, checks that the placed buffer was released first, and then releases the heap last: warm placed-pages: backing heap handed over with 1 reference unload placed-pages: heap alive after the unload, 1 reference, placed buffer released first unload placed-pages: heap released last, 1 -> 0 Releasing after FreeLibrary is safe here because the heap is a D3D12 object created on the desktop device, not on the shim: its vtable lives in d3d12.dll, and the fixture still holds that device at that point. The reference-count and process-exit controls for the alias, the readback and the fence are unchanged. * Unload the placed-cache fixture before dropping its backing heap on error --------- Co-authored-by: panam <panam@local> Co-authored-by: Royoo <3230853833@qq.com>
…hed ones (R0Y00#2649) * runtime: give unknown-dimension views a default view and skip mismatched ones Desktop D3D12 removes the device for a view description with ViewDimension 0 (UNKNOWN) or a dimension that does not suit the resource, instead of failing the call. A console package module made such SRVs on 2D RGBA8 textures. Views of device slots 18 to 21 are now checked first (view_dimension.h): dimension 0 gets the resource's default view (null description) where desktop allows one, else the view is skipped; a mismatched dimension is skipped. Both are logged, and a view that still removes the device logs its forwarded description and the resource's shape. New fixture with a negative control: startup_view_dimension; the control swaps the resource dimension of the mismatched cases. * runtime: limit unknown-dimension default views to typed SRVs and null refused SRVs The default view for a view description with ViewDimension 0 replaces the whole description, including its format and component mapping. Only the shader resource view case is measured, so by default only slot 18 views of typed, non-depth textures get it. UAV, RTV and DSV descriptions with dimension 0 are skipped unless the experimental X2W_D3D12_VIEW_DEFAULTS=all is set; =off skips the SRV case too. A refused SRV now writes a null SRV into its destination descriptor. The skipped call used to leave the slot's previous descriptor there, bindable and copied by CopyDescriptors, after the slot's record had dropped the reference that kept its resource alive. New fixture startup_view_dimension_warp (and _hardware) through d3d12_xs.dll: an unknown-dimension SRV samples its texture's colour, an explicit TEXTURE3D SRV of a 2D texture is refused without device removal, and a refused replacement over a valid view reads zero, as does a copy of that slot. startup_view_dimension_off_control_warp runs it with X2W_D3D12_VIEW_DEFAULTS=off and must fail on the missing default view alone, with the device not removed. * Preserve live non-SRV descriptor records when a replacement is refused --------- Co-authored-by: Royoo <3230853833@qq.com>
R0Y00#2606) * startup: write nothing for the null export target in gfx2hlsl The null target carries no channel; its only effect is the vm discard emitted before it. Same change as the open R0Y00#2026, so a rebase onto it drops this commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * startup: translate slot 57 mesh requests with a depth-only pixel stage (Part of R0Y00#2413) A pixel stage whose only export is the null target was refused with 'slot 57 mesh with a depth-only pixel stage is not covered'. It now translates with the pair: the pixel stage has no SV_Target, keeps the vm discard of an alpha test, and the manifest has an empty targets line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * startup: refuse a slot 57 null export mixed with another export (Part of R0Y00#2413) The slot 57 depth-only profile is a pixel stage whose only export target is null. A null export before or after an mrt0, mrtz or param0 export passed the role check and was published; it is now refused in translate_mesh57 before any source or manifest is written. The general pixel path keeps its mixed forms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…#2641) * shader: lower s_flbit_i32_b32 in gfx2hlsl (R0Y00#1723) Port the pixel_aot leading-zero count SOP1 (31 - firstbithigh, -1 if zero). SCC is unchanged. Lane masks and descriptor words are refused. CPU fixture with a negative control. Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com> * docs: note s_flbit_i32_b32 startup lowering (R0Y00#1723) Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com> * test: add D3D12 WARP dispatch readback for s_flbit_i32_b32 Mirror the s_ff1 / s_abs UAV dump pattern. Cover zero (0xffffffff), bit 0, bit 31 and a mid-word bit so firstbithigh is exercised on the adapter. Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com> * docs: note s_flbit_i32_b32 WARP dispatch ctest Document the UAV-readback filter next to the CPU-only command. Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
…ription (R0Y00#1629) (R0Y00#2592) * startup: take pixel input masks from the exact pipeline's stream description (R0Y00#1629) Pipeline lays out the entry VGPRs by SPI_PS_INPUT_ADDR and loads them by SPI_PS_INPUT_ENA, so distinct masks are accepted; an enabled input that is not allocated is refused as contradictory. request_ps_inputs() reads the separately captured description req_<key>.psin and refuses one that names another pipeline (key in the line or recomputed pipeline_key), a missing enable or address mask, or a malformed line. translate_request and request_refusals pass the masks on; no description keeps today's model. tests/startup_packed_position_provenance_check.py: a source-built target (position in v4 from enable 0x8002 / address 0x8003) and a decoy (v2) in one cache directory; pure controls, then the R0Y00#1634 gradient draw on WARP and hardware with a wrong-register control. The R0Y00#1634 check is unchanged. * startup: make the pixel input masks part of the request identity (R0Y00#1629) Two pipelines with identical stage bytes, root signature and input layout but different SPI_PS_INPUT_ENA/ADDR masks hashed to the same pipeline_key(), so they shared every request file name and the second description replaced the first in the cache. - pipeline_key() takes the description's masks (ps_inputs) and hashes b'psin1' + ENA + ADDR (little-endian u32) after the input layout, as the layout itself is hashed. Without a description the key is unchanged, so existing caches keep their keys. - request_ps_inputs() recomputes the key with the masks. A description rewritten with another mask pair under an existing key is refused by name (pixel input description names another pipeline), and the result already published for that key is withdrawn instead of being served. - pending_keys() checks a published result again when its description is newer than its manifest; translate_request() marks the manifest as checked when the description still matches, so the check runs once. - The base and RTV source key check in load_request (R0Y00#2595) and shader_cache_rekey.py hash the masks too; with a description, a base key mismatch is reported as the description naming another pipeline. The re-keyer rewrites the description line under the new key. The provenance check gains same-cache controls: three pipelines with the target's exact bytes and three mask pairs get three keys and each takes its own masks; a different pair after a result exists is translated as its own request and leaves that result untouched; an in-place rewrite is refused and withdrawn. The draw mode adds two same-byte pipelines to the target's cache (0x8003/0x8003 draws the gradient, 0x8002/0x8002 fails at (1,0) as expected) and checks the compiled-result path with FXC. * startup: watch the stream description each translation reads (R0Y00#1629) An RTV variant is translated from its source pipeline's blobs and stream description, but pending_keys compared req_<variant>.psin with the variant's manifest, and a failure was retried only when .a or .rtv changed. A wrong mask pair written into a base description therefore withdrew the base result and left the variant's result published, and a corrected description did not requeue the refused request. request_source() now names the request's source key and the one description its translation depends on (req_<key>.psin for a base request, req_<source>.psin for a variant). load_request, request_ps_inputs and pending_keys all use it: a description newer than the manifest rechecks the result, and a description newer than the .fail retries the request, for base requests and variants alike. Requests without a description keep the legacy key and behaviour. The new control publishes a base and an `rtv1 <base> 28` variant, writes the wrong pair into the base description (both are refused by name and both manifests withdrawn), then restores the valid line (both are republished without touching .a or .rtv). * startup: withdraw results whose stream description was removed (R0Y00#1629) With a published base and an rtv1 variant of it, removing only req_<base>.psin left both manifests in place: pending_keys saw no description and nothing newer, so the watcher kept serving results that a forced translation refuses (shader request source key mismatch and RTV variant source key mismatch). - translate_request writes <key>.psdep, the description line the result is translated with, before the manifest is published, for a base request and an RTV variant alike. A legacy request that never had a description gets no record. - pending_keys queues a published result again when it has a record and the description request_source() names is gone. A request without a record is not read again, so legacy caches keep today's cost. - translate_request refuses such a request by name, "pixel input description missing for a request translated with one", and withdraws its manifest. The refusal is not retried until the description is written again, newer than the .fail. The provenance check keeps the wrong-pair and restore controls and adds: both results record their description line; removing only the base description queues the base and its variant, refuses both by name and withdraws both manifests; nothing is retried while it stays missing; the restored description republishes both; a legacy request publishes without a record and stays done. * startup: recheck a result whose description is gone despite an old .fail (R0Y00#1629) On the manifest-only path a successful translation leaves an earlier .fail in place. A published result whose recorded stream description was later removed then fell through to the failure check, which compared that old .fail only with the request file (no description time is left) and skipped the result, so its manifest stayed published. pending_keys now queues such a result while its manifest exists; the translation refuses it by name and withdraws the manifest, and the new .fail keeps it from being retried until the description returns. The provenance check no longer deletes the failures of the wrong-pair cycle before removing the description, so it covers this order.
…p to R0Y00#2082, Part of R0Y00#1723) (R0Y00#2646) * test: use the wide tuple spelling for image_sample_d fixtures that LLVM 15 assembles Follow-up to R0Y00#2082. The assembler needs the full 8 VGPR (16 for a volume) tuple; the decoder lists the active registers. * ci: run the image_sample_d fixture check against llvm-mc-15
Keep the compute-entry exec_lo fold to lane 0, and add firstbitlow / lo-then-hi scan for ordinary SGPR and immediate sources. Lane masks and descriptor words stay refused. CPU fixture with a negative control. Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
Refuse live s_ff1_i32_b64 SGPR pairs (owned by open R0Y00#2072). Keep zero-extended b64 immediates and add a D3D12 UAV dispatch fixture for the b32 edge words (including firstbitlow(0) == 0xffffffff). Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
Main's SCALAR_BITS install was overwriting Stage.op_s_ff1_i32_b64. Leave the dedicated handler for zero-extended immediates (R0Y00#2022 F / R0Y00#2072). Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
Keep the Stage handler for zero-extended immediates and emit the same 64-bit firstbitlow scan for register pairs so bit_scan CI stays green. Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
…es against a CPU reference)
cursor
Bot
force-pushed
the
cursor/gfx2hlsl-s-ff1-general-5a9e
branch
from
November 26, 2026 02:09
c34ae89 to
ec7ce3b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
Part of #2022 Item F (
s_ff1_i32_b32of a general scalar) intools/startup/gfx2hlsl.py.The compute-entry special case on
exec_lostill folds to lane 0. Ordinary SGPR and immediate sources now lower tofirstbitlow(0xffffffff when the word is zero), matchingpixel_aot/ Mesa. SCC is unchanged. Lane masks and descriptor-bearing sources stay refused. Known constant sources fold.s_ff1_i32_b64of a live SGPR pair stays refused here — that register-pair lowering is owned by open #2072 (@tedin7). This PR only accepts a 32-bit SOP1 literal/inline for the b64 mnemonic, which the ISA zero-extends (high word 0), and folds it. A hi-nonzero 64-bit source needs a register pair and is out of scope.Claim before coding. Base is
main.AI-assisted.
Verification
Commit under test: this PR head.
python3 -B tests/startup_gfx2hlsl_s_ff1_check.py # all ok python3 -B tests/startup_gfx2hlsl_compute_check.py python3 -B tests/startup_gfx2hlsl_handler_arity_check.py python3 -B tests/docs_links_check.pyAll passed on Linux (CPU evaluation). The
dispatchmode needs Windows + DXC +offscreen_check(not run on this Linux agent).Windows verification:
Evidence and follow-up
disasm_rdna2/gfx2hlsl.decode; no retail bytes.firstbitlowdiverges from the ISA reference.startup_gfx2hlsl_pack_absdiff_check) covers b32 inputs0,1,0x80000000,0x00010000and provesfirstbitlow(0) == 0xffffffff; zero-extended b64 immediates are also stored. hi-nonzero b64 is shader: lower 64-bit scalar bit-count and scan ops in gfx2hlsl (Part of #1723) R0Y00/Xbox2Windows#2072.vcc_loas "requires compute exec_lo" now expects the lane-mask refusal from the general path.Checklist