Repository navigation
tests: add source-built mesh57 loop refusal fixture (#2413 T6) - #6
Closed
SimSalabimse wants to merge 247 commits into
Closed
SimSalabimse wants to merge 247 commits into
SimSalabimse wants to merge 247 commits into
Conversation
Remove the duplicate mul_hi_u32 definition introduced during rebase so v_mul_hi_u32 reuses the shared helper from R0Y00#2176.
startup_build_rev_check.py ran every git command with "-c core.hooksPath=" so that a contributor's hooks could not run in its scratch repositories. Some git builds reject the empty value with "fatal: The empty string is not a valid path" (seen with git 2.47.2.vfs.0.1 on Windows), so the test failed before checking anything. It now points core.hooksPath at an empty folder inside the test's temporary directory, which disables hooks the same way. Test: ctest --preset dev -R '^startup_build_rev_controls$': passed. Before the change: failed with the error above on the same git. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t-snapshot shader: check the paired LDS read address snapshot on the host
build: point the build-rev test's hooksPath at an empty folder
…oat2 shader: expand packed D16 XY stores into FLOAT2 heap views
docs: link 9 GPU coverage reports from #1
…0Y00#2314) Replace the blanket refusal of scalar instructions in a block that s_cbranch_execz skips with a liveness rule: the block is translated unchanged when every scalar register, mask and SCC it may define is dead where it joins. Exec writes that cannot reactivate an inactive lane are accepted in straight-line blocks only: no branch in the block and no branch into it, a proven calculated s_setpc_b64 jump included. Only a 32-bit restore from a 32-bit copy of exec is trusted. A v_cmpx source taken as a destination and in-block exec copies tracked across a branch are refused and pinned. Pin the branch out of the block, vcc live at the join, a proven s_setpc_b64 inside the block, and a calculated jump onto the restore that bypasses the copy. Refs R0Y00#2274 Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> Co-authored-by: Royoo <3230853833@qq.com>
…ript_state_probe with unit suite (R0Y00#2352)
* startup: expose provider method tracing through run.ps1 -TraceApi * tests: check the TraceApi opt-in on text-only hosts --------- Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
…2hlsl (R0Y00#2345) Refs R0Y00#2274, R0Y00#1541. Extends check_lds_exchange and Stage in tools/startup/gfx2hlsl.py (building on R0Y00#2327) to support bounded 64-bit group-shared LDS exchanges (ds_write_b64 and ds_read_b64) across s_barrier in 1D compute groups: - Requires ds_write_b64 vaddr, v[d0:d1] [offset:k] with v_lshlrev_b32 addr, 3, v0, contiguous 2-VGPR data pair in v0..v255, 4-byte aligned offset, and offset + group[0] * 8 <= lds_words * 4 (RDNA 2 ISA Ch. 9 DS, LLVM 15 AMDGPUUsage COMPUTE_PGM_RSRC2.GRANULATED_LDS_SIZE). - Requires ds_read_b64 v[r0:r1], vaddr [offset:k] matching the 64-bit fill width (mixed b32/b64 exchanges stay refused), completed s_waitcnt lgkmcnt(0) before s_barrier and after each read, exact 2-VGPR pair, and literal or literal-masked byte addresses proving [a + offset, a + offset + 8) lies 4-byte aligned inside [first, first + group[0] * 8). - Computes a = (addr + offset) >> 2 before reading/writing dwords so vdst[0] == vaddr aliasing stays safe and preserves little-endian pair order. Adds tests/startup_compute_lds_b64_check.py wired in CMakeLists.txt, .github/workflows/windows.yml, and docs/experiments.md.
…#2343) The by-address lookups in d3d12_memory_srv.inl walked every noted resource under the shared note_lock on each slot 70 call. resource_address_index.h keeps resources by the title memory they start at and only narrows the candidates; each lookup still applies its own live-reference filter and predicate, so released and re-referenced wrappers give the scan's answer. - Entries stay as long as the canonical record does (the table is never pruned). Nothing is erased at release and no reference path changes. - note_resource stores the record and the index entry as one step (store_indexed): the index node is allocated first, the record update follows, and a failure leaves both as they were. Slot 133 does the same through publish_placement's hook. - X2W_RESOURCE_INDEX_CHECK=1 checks every memory SRV call that each live resource is indexed; =2 skips the inserts as the negative control. - Test startup_resource_address_index compares the index with the full scan across release, re-reference, address reuse, overlapping ranges, re-notes, unaligned bases, the span-end edges, and injected allocation failures. The skip and unsync controls must fail. Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Accept Texture3D placed memory SRVs with D3D12_TEXTURE_LAYOUT_UNKNOWN and matching D3D12_SRV_DIMENSION_TEXTURE3D views in device slot 70. Refuse console swizzled layouts, depth formats, mismatched view dimensions (including Texture2D views on 3D resources and Texture3D views on 2D resources), non-multiple-of-4 block extents for block-compressed formats, out-of-bounds mip ranges, and explicit non-zero LOD clamps. Compute volume byte sizes considering all mip levels and block texel dimensions, use SliceFootprints footprint size in device runtime for row pitch and placement alignment, and upload 3D placed texture footprints before draw execution. Add startup_memory_srv_volume with mutation negative controls (layout, 2d-view, 3d-view, mips-overflow), add 3D view checks to startup_gfx10_layout, and add startup_address_volume_srv_warp / startup_address_volume_srv_hardware to verify 3D volume draws across depth slices, mip levels, and refusals.
… empty list (R0Y00#2360) `op_buffer_load_dword` and `tbuffer` read `ops[0]` before `buffer_address()` reaches its own operand-count check, so `buffer_load_dword` or `tbuffer_load_format_xyzw` with no operands at all came back as `translator crash in ...: IndexError` instead of a refusal. That marker is the batch translator's label for a translator defect, not for an instruction it does not lower. Both bodies now refuse an empty operand list; everything longer is still left to the shared check, which sees a modifier first and must keep refusing on it (the `lds` form decodes to three operands). Measured through the real `Stage` entry point: before: buffer_load_dword -> translator crash in buffer_load_dword: IndexError after: buffer_load_dword -> buffer load with 0 operands, expected 4 buffer_load_dword v4 -> buffer load with 1 operands, expected 4 tbuffer_load_format_xyzw -> buffer load with 0 operands, expected 4 `startup_buffer_address_check.py` still passes, including its `buffer modifier lds` case, so the modifier precedence is unchanged. All 57 `tests/startup_gfx2hlsl_*_check.py` exit 0. Co-authored-by: ChazY11 <246129015+ChazY11@users.noreply.github.com>
…0Y00#2373) `image()` reads vdata, an address and a descriptor, but it indexed them without checking how many operands it was given, so a shorter list reached `ops[1]` or `ops[2]` and came back as `translator crash in <op>: IndexError` instead of a refusal. Seven handlers share that body: `image_sample`, `image_sample_l`, `image_sample_lz`, `image_sample_b`, `image_get_lod`, `image_load` and `image_load_mip`. One guard, before the first index: if len(ops) < 3: raise Unsupported('image instruction with %d operands, expected at least 3' % len(ops)) Measured through the real `Stage` entry point: image_sample v[8:11], v0 before: translator crash in image_sample: IndexError after: image instruction with 2 operands, expected at least 3 image_load v[8:11] before: translator crash in image_load: IndexError after: image instruction with 1 operands, expected at least 3 The three-operand forms are untouched: `image_load v[8:11], v0, s[16:19]` still reports the descriptor operand, so the guard only replaces the crash. `tests/startup_gfx2hlsl_image_arity_check.py` is a new, focused check rather than an addition to `startup_gfx2hlsl_handler_arity_check.py`, which an in-flight PR is editing; it asserts the refusal at one and two operands for all seven forms and that the refusal is not `translator crash`. Registered in `CMakeLists.txt`, listed in the Linux CI check list and in AGENTS.md. Fail-first: removing exactly the guard fails the check with `('image_sample', ('v[8:11]',), [('translator crash in image_sample: IndexError', 'ps')])`, and restoring it returns exit 0. All 58 `tests/startup_gfx2hlsl_*_check.py` exit 0. Co-authored-by: ChazY11 <246129015+ChazY11@users.noreply.github.com>
…robe_roots with unit suite (R0Y00#2365)
…window with unit suite (R0Y00#2374)
…2364) * shader: name where a gfx2hlsl translation failed in its .fail Two .fail reasons did not say where to look, because they leave out the program that hit them: - An unexpected translator error ("translator error: TypeError: ...") now ends with the function, file name and line that raised it: "(in scalar_select, gfx2hlsl.py line 1234)". - An operand refusal ("operand '-v30'") does not say which lowering refused it. The translation loop now records the instruction on the refusal, and the graphics and compute .fail writers end the text with "in v_and_b32_e64". The exception message is unchanged for every other caller, including the refusal census. Test: startup_gfx2hlsl_watch_check.py checks the location on its injected ZeroDivisionError. It also checks a graphics pair whose pixel shader refuses -v30 on v_and_b32_e64: translate_to's result and .fail name the instruction, while Pipeline still raises "operand '-v30'". Negative control: with the translator change reverted, both checks fail. ctest --preset dev -j 8 -R 'gfx2hlsl|pixel_aot_check|rdna2_tools|compute|translator|startup_run|triage|scan_unsupported' -E '_hardware$|startup_audio_': 195 passed, on main fe0c822. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shader: locate a library-raised translator error at its caller Review follow-up. A translator error raised inside a standard-library call named the library frame (for example json's decoder) in its .fail. The location now skips standard-library frames and falls back to the last frame. The comment no longer calls the text a grouping key, since the line number moves with unrelated edits, and fail_reason's docstring says a refusal without the recorded instruction gives the message alone. Test: startup_gfx2hlsl_watch_check.py adds a json.loads error that must be located at its caller, and takes its own file name from __file__. Negative control: using the last frame again fails that case. --------- Co-authored-by: lewisalex86 <lewisalex86@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* pe: report the pe_map main EXE as the process image Under a Windows launch the EXE is the process image: the PEB's ImageBaseAddress holds its base, GetModuleHandle(NULL) returns it and FindResource(NULL, ...) searches its resources. A mapped EXE found the host there instead, so it read the host's headers and resources. The docs listed GetModuleHandle(NULL) and the PEB as not covered. pe_map_run_main now writes the mapped EXE's base into ImageBaseAddress before the process-attach callbacks, keeping the host's value, and an accepted pe_map_release writes the host's value back. Only one image is reported at a time: a second pe_map_run_main is refused while one is. The PEB loader list is not changed, so GetModuleFileName(NULL) still names the host. cpu_exe_process_image is a CRT-free EXE with one RCDATA resource that checks its process image, its headers through that handle and its own resource. cpu_native_process_image compares a Windows launch, pe_run_package.py, an in-process pe_map_run_main host (which also checks the restore after release), a pe_map_run negative control and the second-image refusal. cpu_exe_io!finish_exe took GetModuleHandleW(NULL) == image_base to mean "launched by Windows". It now also requires the loader to know the image, so a reported pe_map main image returns its code to the host instead of ending it (cpu_package_shim_lifetime runs two packages in one process). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * tests: pin the pe_map process image at the TLS lifecycle boundaries The slot-0 fixture's process-attach callback now records whether GetModuleHandleW(nullptr) is its own __ImageBase, so the Windows launch, pe_map_run_main and pe_run_package must agree (m1=yyy) and plain pe_map_run must not (m1=n-n, X=9). Its host reads the process image right after the start, after a refused release and after the accepted release: iih in paused (worker c inside the image at the refusal), alive and untracked, i-h without a refusal, h-h under pe_map_run. Local mutations to pe_map.cpp each fail: no restore at the accepted release (i-i), a restore before the refusal (ihh), and a report after the process-attach callbacks (m1=yyn). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…an (R0Y00#2370) Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
* tests: run compute load-format draw cases on a small thread pool * tests: keep the renderer output of passing load-format dispatches in the log
…t and CLI suite (R0Y00#2358) * pe: harden atomic temp cleanup and error paths in intake_exe with unit and CLI suite * pe: document inside() root normalization and expand path refusal table
…unloaded (R0Y00#2590) The indexed-validation pipeline and the rectangle-list converter own a device, root signatures and pipeline states for as long as the shim is loaded. They are function-local statics, so they are destroyed during the module's CRT teardown, which runs at process exit as well as on FreeLibrary. At process exit the display driver is already detached, and releasing a pipeline state from the destructor reaches a stopped driver (amdxc64, 0x35f2a19, through D3D12Core!CPipelineState::FinalRelease), which ends the process with __fastfail(7). DllMain now records which of the two detaches is running, and both destructors detach their references on the terminating path and release them otherwise. Device keying is unchanged. tests/startup_teardown_unload.cpp loads the built d3d12_xs.dll by path, warms both caches through a probe, unloads it and checks that the objects come back, then leaves a second load to process termination. Co-authored-by: panam <panam@local> Co-authored-by: Royoo <3230853833@qq.com>
…_build with CLI suite (R0Y00#2586) * build: harden atomic report writes and path/IO error guards in verify_build with CLI suite * tests: forward *args/**kwargs in verify_build_cli_check glob mocks --------- Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
…e_authentihash with CLI suite (R0Y00#2593) Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
…O guards in shader_cache_rekey with CLI suite (R0Y00#2594)
* tests: run six descriptor load format launches at once * test: drop stale launch counts from comment
… 33 and 35) (R0Y00#1803) * feat: record the compute root signature and descriptor tables (slots 33 and 35) Header-only state in list_compute_root.h with a Linux-testable check. Dispatch (slot 14) is not handled here; the state is exposed through ready() and table() for it. Refs R0Y00#870. * feat: record compute descriptor tables (slot 35) and clear them on a root or heap change --------- Co-authored-by: tedin7 <tedin7@users.noreply.github.com>
* tests: split startup_debug into parallel ctest cases * docs: select every startup_debug group with the unanchored -R pattern
…0#2595) Co-authored-by: chasegrindy <302242206+chasegrindy@users.noreply.github.com> Co-authored-by: Royoo <3230853833@qq.com>
…be with CLI suite (R0Y00#2597) Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
…00#2589) Lower the VOP3A-only 32-to-16-bit saturating integer pack pair (`0x36a` and `0x36b`) in `tools/startup/gfx2hlsl.py`: - `v_cvt_pk_u16_u32`: clamp `S0` and `S1` as unsigned 32-bit integers to `[0, 65535]` and pack `S0` in `[15:0]` and `S1` in `[31:16]`. - `v_cvt_pk_i16_i32`: clamp `S0` and `S1` as signed 32-bit integers to `[-32768, 32767]` and pack `S0` in `[15:0]` and `S1` in `[31:16]`. - Accept VGPRs, SGPRs, inline constants, and 32-bit literals across `Pipeline` and `ComputePipeline` (including explicit `_e64` spelling), propagate scalar uniformity through `UNIFORM_VALU` for `v_readfirstlane_b32`, require whole-32-bit source definitions, and clear `low16_only_v` on the destination VGPR. - Refuse VOP3A source `abs`/`neg` bits and non-zero unused `src2` in `check_encoding` before disassembly, and refuse `clamp`, `omod`, `op_sel`, lane-mask sources, non-VOP3 spellings (`_e32`, `_sdwa`, `_dpp`), and invalid operand counts or widths in `Stage`. Add `tests/startup_gfx2hlsl_cvt_pk_int16_check.py` covering LLVM 15 `llvm-mc` / `libLLVM` round-trips, 676 `(S0, S1)` boundary pairs per opcode, `ComputePipeline`, `UNIFORM_VALU`, `low16_only_v`, encoding and Stage refusal controls, and WARP / hardware D3D12 draws with four mutated-HLSL negative controls per opcode across FXC `ps_5_1` and DXC `ps_6_0`. Part of R0Y00#1723. AI-assisted.
…n_checks_parallel with CLI suite (R0Y00#2598)
…compile_time with CLI suite (R0Y00#2581) * shader: harden atomic report writes and path/collision guards in dxc_compile_time with CLI suite * tests: bound dxc_compile_time_cli_check timeout and replace fake exe spawn --------- Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
…ards in fetch_addrlib with CLI suite (R0Y00#2600)
--continue-asserts steps over main-image INT3s one debug event at a time. A retail mapping loop can trap once per 8 KiB chunk, so one 158 MiB mapping costs about 19,000 events and exhausts any fixed budget. Raising the budget only postpones the stop. X2W_NOP_SOFT_ASSERTS=1 writes 0x90 over the cc after the debugger continues the site for the first time. DBG_CONTINUE already bypasses the image's handler, so the guest sees the same continuation; later executions no longer raise an exception. The patch lasts for the life of the process and only covers main-image RVAs; X2W_STOP_AT sites are excluded. Once patched, a site no longer increments asserts_seen, so the --continue-asserts budget no longer measures real hits there. Extend tests/startup_debug_probe.cpp with a repeated site behind STARTUP_DEBUG_PROBE_ASSERTS (default 0, so existing cases are unchanged), and check the patched and unpatched counts in tests/startup_debug_check.py. The patched case asserts one repeated-site hit relative to the baseline sites, and the control without the switch logs every hit.
…in live_view with CLI suite (R0Y00#2602) Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
…0Y00#1723) (R0Y00#2057) * fix: accept descriptor s_load into s[104:107] s106/s107 are vcc; a descriptor load emits no code, so it may end there. Root constant-buffer loads and destinations past s107 stay refused. * fix: refuse vcc reads after a descriptor s_load into s106/s107 * test: add WARP/hardware draw for s_load into s[104:107] with vcc compare/select --------- Co-authored-by: Codex <codex@openai.com>
… (Part of R0Y00#1723) (R0Y00#2073) * shader: lower 16-bit vector ALU and i16/u16 conversions in gfx2hlsl Part of R0Y00#1723. Adds v_add/sub/subrev/mul/min/max/fmac/fmamk/fmaak_f16 and v_cvt_f16_i16/u16, v_cvt_i16/u16_f16, with a unit test registered in CMakeLists.txt. * fix: round the 1/(2*pi) inline constant to binary16 in 16-bit VALU * test: draw the 16-bit vector ALU lowering on WARP against a binary16 reference * fix: decode 16-bit VALU inline constants and negated literals at half width, round f16 results to nearest even * test: tag integer results in the 16-bit ALU draw so FXC keeps denormal-range words * test: anchor the ubyte2 mutation to the byte mask so the f16 rounding helper is not matched The always-emitted f16rn helper contains '>> 16)', so the unanchored pattern matched five times instead of four lanes. * fix: round v_fmac_f16 family once, TwoSum plus round to odd before the binary16 rounding The binary32 sum a*b + c was rounded and then rounded again to binary16, one unit off on about 2e-5 of triples. Add the four measured counterexample triples to the Python check and to the real draw fixture. * fix: lower v_fmac/fmamk/fmaak_f16 with integer fma16_rne (R0Y00#2073)
…00#2357) * tests: add opt-in X2W_DXC_CACHE compile cache for Python shader checks * fix: DXC cache runs uncached when the compiler is not a file A stub name or a bare name on PATH made os.stat raise. The compiler is now resolved (file, else PATH); if unresolved the call goes through subprocess.run unchanged. The cache key uses the resolved path. * fix: include the DXC libraries in the compile cache key * fix: never replay output files for a cached failed compile * fix: skip output restore for cached failures and bump DXC cache key version * fix: never cache DXC failures and bypass Wine launchers * tests: preserve DXC missing output directory failures with a warm cache --------- Co-authored-by: Royoo <3230853833@qq.com>
…Y00#2479) * shader: omit unused ordinary integer temporaries after validation Retain all used values and validate operands and instruction ordering before elimination. * tests: require live pixel temporaries to precede their consumers --------- Co-authored-by: Royoo <3230853833@qq.com>
* pixel_aot: lower 13 SDWA cvt, frexp_exp, and pkrtz forms * tests: align sdwa_cvt_reference flr/rpi NaN and negative-subnormal rules with R0Y00#1772 --------- Co-authored-by: KomaGuy <265821007+KomaGuy@users.noreply.github.com> Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
…pt-in) (R0Y00#2218) * gpu: back slot 133 linear buffers by sharing or a submit-time copy (opt-in) X2W_D3D12_LINEAR_BUFFERS=1 (or =copy) gives device slot 133 buffers in COMMON state (row-major or unknown layout) a backing that keeps the title's bytes visible to the GPU. Unset, slot 133 is unchanged. - Share only after D3D12_FEATURE_EXISTING_HEAPS reports support (queried once, before any open), for a buffer inside one committed private allocation at a 64 KiB-aligned offset. The heap is cached by base, which the open heap keeps from being released. - An XMem view is not shared: a heap opened from a view makes XMem's unmap of those pages fail with error 87 (measured), and desktop resources live for the process. Sharing reports 0x80070032 and the buffer is copied. - Copy into a committed default buffer at each submission through the queue wrapper, before the title's lists run, never at bind or record. Only changed bytes are copied, through staging buffers that are reused only after their submission's queue fence completes. - Refuse with a defined HRESULT where the copy cannot keep the guarantees: a GPU-written use returns the sharing HRESULT (or DXGI_ERROR_UNSUPPORTED when sharing was not attempted), no submit fence returns E_NOT_VALID_STATE, and a submission whose refresh cannot be staged is not executed. tests/linear_buffer_backing_check.cpp drives slot 133, wrapper lists and the queue wrapper in d3d12_xs.dll over XMem pages and a private range with the R0Y00#1942 cases and sentinels: default (old behaviour asserted), share, copy, host sharing refusal (EXISTING_HEAPS forced to 0) and a copy without a submit fence, plus four mutants that each remove one guarantee inside the DLL and must fail their case. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * gpu: keep slot 133's default backing where the linear path refuses A title run with X2W_D3D12_LINEAR_BUFFERS=1 faulted at 1.76 s: the first eligible placement, a GPU-written buffer across XMem views, was refused with 0x80070057, and the title, for which CreatePlacedResourceX never fails on the console, used the null object. - Where neither sharing nor the copy keeps its guarantees (a GPU-written use that is not shared, no submit fence, no copy buffer), slot 133 now keeps the default backing and returns what it returns with the switch off. The refusal HRESULT is appended to the slot 133 log line, kept in x2w_d3d12_linear_buffer_info (path 3, refusal_hr) and counted in the totals (kept_default, last_refusal_hr). - A submission whose refresh cannot be staged now runs. The buffer keeps its last upload and is reported stale (info: stale, refresh_failures, last_refresh_hr; totals: refresh_failures, last_refresh_hr) until a later refresh succeeds; the first failures are logged. The fixture asserts the old behaviour and the reported refusal for every kept default (the log line read back through X2W_TRAP_LOG), adds a stale path (X2W_TEST_LINEAR_REFRESH_FAIL) and a refusal-silent mutant that drops the report and must fail. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * gpu: refresh linear buffers without holding their lock across waits Review of R0Y00#2218: - before_submit snapshots the copied buffers' work under mutex_, then takes, creates or waits for staging (a full pool waits up to 5 s for the oldest fence), fills it, resets and records a refresh list and runs ExecuteCommandLists without the lock, and publishes the result under it again. A release(), the fixture exports or another queue's submission no longer wait behind a fence wait or ExecuteCommandLists. Staging is still reused only after its fence, the refresh still runs at submit, and a buffer whose staging fails is still marked stale. - In render mode the refresh runs before queue_execute takes draw_lock and allocator_lock, so a staging wait does not stall list recording. - x2w_d3d12_linear_buffer_info returns false for a wrapper without a desktop object. The fixture adds a contention path (X2W_TEST_LINEAR_STAGING_LIMIT=1): while a refresh waits for the only staging buffer behind a gate, the info export, release() and a second queue's submission must finish, and a hold-lock mutant that keeps the lock across the wait must fail. The copy path also refreshes on COMPUTE and COPY queues, read by a dispatch and by CopyBufferRegion. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * gpu: note why concurrent linear-buffer publishes only cost a refresh Two submissions that snapshot the same copied buffer can publish `uploaded` in either order, so it may briefly lag the GPU copy. The next diff is then redundant or larger than needed, never one that misses a change. Comment only (tedin7's review nit on R0Y00#2218). Refs R0Y00#1914 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * gpu: refresh linear buffers on an internal queue that consumers wait for Review of R0Y00#2218 (R0Y00): one copied buffer, one CPU write, then a list on queue 1 behind an unsignalled gate and a list on queue 2. Queue 2 read the old bytes: queue 1's refresh was enqueued behind its gate but recorded as uploaded, so queue 2 skipped its own. - Every refresh now runs on one internal COPY queue per device, which never waits on a title fence, and signals an internal fence value. Each copied buffer remembers the value of its last refresh. - Every submission through a queue wrapper first makes its queue wait for the highest such value among the live copied buffers that has not completed. A consumer on any queue runs after every refresh enqueued before it, and no title queue waits on another, so title-owned cross-queue fences cannot form a cycle with a refresh. - Staging is reused once its copy's internal fence value completes. The per-title-queue fences, after_submit and linear_submitted go. - If the internal queue or fence cannot be created, copied placements keep the default backing with that HRESULT recorded. - x2w_d3d12_linear_buffer_internal_queue lets fixtures hold refreshes. The fixture adds gate2q (both reads see the CPU write), gate2q.held (the second queue waits for a held refresh), xq (queue 1 waits on a fence queue 2 signals: no deadlock, both read the write) and a skip-consumer-wait mutant that must fail gate2q.held. Case c and contention hold the internal queue so staging stays in flight. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * gpu: count linear-buffer backings in the D3D12 budget With X2W_D3D12_BUDGET=1, slot 133's linear buffers are counted as the default backing counts its own: a shared buffer as a placed resource whose heap (opened once per private range) has a backing-heap ticket in use while a buffer on it is held, a copied buffer as a committed default buffer. The pool's staging buffers are counted as upload memory when they are created; they live for the process. The fixture enables the budget and checks, on the share and copy paths, that one placement goes live in its category, the heap is live for a shared one, and the title's release moves it to retained, with nothing unmeasured. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * gpu: defer slot 133 linear buffers to the XMem lease path The mesh XMem lease path (R0Y00#2280; X2W_MESH86_XMEM_SRV or X2W_MESH_INDIRECT_XMEM) takes the default copied placements of XMem pages whose console flags are 0: it mirrors their GPU writes into a leased view of the section and publishes that to mesh readers. Those are exactly the GPU-read XMem buffers the linear copy path would back. While the lease path is on, slot 133 now keeps the default backing for such a placement and records the deferral as a refusal, HRESULT_FROM_WIN32(ERROR_BUSY), in the log line, the info and the totals, so one placement never has two owners. Other placements are unaffected, and nothing changes while the lease path is off. The fixture adds a lease path (=copy with X2W_MESH86_XMEM_SRV=1): an XMem buffer keeps the default backing with the deferral reported, and a private one is still copied. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * gpu: stop refreshing a copied linear buffer that a list copy writes Main now forwards CopyBufferRegion and CopyResource into slot 133 placed buffers (list_copy.inl), so a copied linear buffer can be written by the GPU. Those bytes never reach the title memory, and a later refresh whose changed span covers them copied the title's older bytes over them. A copied buffer that a recorded copy writes now keeps the GPU's bytes from that recording on and is no longer refreshed, as the default backing behaves for it. The info (gpu_written) and the totals report it, and the first few are logged. The fixture adds gpuw on the copy path: a list CopyBufferRegion (list slot 15) writes G into the buffer, the title changes the words on both sides, and the next read must still see G. The refresh-gpu-written mutant keeps refreshing and must fail it. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: record linear-buffer budgets, list-copy holds and the lease deferral Describe, for slot 133's opt-in linear buffers on current main: the refresh and consumer Wait ahead of red_producers and split mesh submissions, the D3D12 budget categories, a copied buffer that a list copy wrote, and the deferral to the mesh XMem lease path. Record the budget, gpuw and lease cases, the refresh-gpu-written control and the results at ff06794 on WARP and an RX 9070 XT (driver 32.0.32029.2010), and note sharing XMem views through the section lease (R0Y00#2280) as a follow-up. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * gpu: mark a copied linear buffer GPU-written when its copy is submitted A list copy into a copied linear buffer changed the backing when the copy was recorded. A recording that was closed and then reset without being submitted therefore stopped the buffer's refreshes for good: the next read saw the old upload instead of the CPU's later bytes, on XMem and private memory alike (review repro on WARP and an RTX 4060). The write is now pending on the recording, next to the texture writes that list_copy.inl already tracks: commit_list_gpu_writes marks the buffer GPU-written after the recording's ExecuteCommandLists, and a Reset or a failed Close (discard_list_gpu_writes) drops it. The recording's own submission still refreshes the buffer first, and its queue waits for that refresh before the copy runs. The gpuw-at-record mutant restores the recording-time mark. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * gpu: order linear-buffer refreshes behind earlier submissions A refresh's copy into a copied linear buffer was ordered only before later consumers (their queues Wait for the internal fence). An earlier submission that still reads or writes the backing, on any queue, could run at the same time as the internal COPY queue overwrote it. Simultaneous access allows concurrent operations on one buffer only on disjoint ranges. Each queue wrapper now signals a user fence of its own after the title's lists (render and plain submissions). Before a refresh's copy executes, the internal queue Waits for every queue's latest user fence value that has not completed (totals: producer_waits). The wrappers cannot tell which buffers a submission reads, since titles bind them by GPU virtual address, so every earlier submission counts as a user of every copied backing. A queue whose latest submission sits behind a title Wait (queue slot 17) on a fence that has not been reached is not waited for (totals: producer_wait_skips, logged): a later submission that waits for this refresh may be the one that signals that fence, and waiting would deadlock both queues. That submission has not started and reads the CPU's newer bytes once it runs. A fence reached while the copy still executes can still overlap the read; the header says so. A submission now also waits for the refresh it enqueued itself, even if the title released the buffer meanwhile; before, such a refresh was left out of the consumer Wait. The contention case asserts the new order: S1, gated, reads B because C's copy waits for it; S2 reads C. The gate opens before the internal queue is drained. The skip-producer-wait mutant removes the wait. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * gpu: publish linear-buffer uploads in the order their copies execute Two submissions on different threads could snapshot one copied buffer against the same upload record, stage the title's bytes at different times, execute their copies in one order and publish the upload record in the other. With X staged first, the CPU then writing Y and Y staged second, Y's copy could take the lower internal fence value and X's the higher, so the backing held X while the record said Y. No later submission refreshed the buffer until the title changed those bytes again. The comment that called this a redundant copy at worst was wrong. A copied buffer now remembers the internal fence value of its newest applied publish. A newer refresh applies its span; an older one that arrives after it drops the record (totals: reordered_publishes), and the next submission copies the whole buffer. An unknown record is set again only by a copy of the whole buffer. The publish-out-of-order mutant applies every publish in lock order, as before. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * gpu: probe and guard title memory right before staging a linear buffer before_submit snapshots every live copied buffer, not only those the submitted lists read, and probes its title memory under the lock. refresh() then copied that memory into staging without the lock. If the title released one of those buffers on another thread and freed or unmapped its pages in between, the copy faulted inside d3d12_xs.dll. The title memory is now probed again right before it is staged, and the copy runs under a fault guard (access violation or in-page error). A buffer whose memory is gone is skipped and counted (unreadable), as the snapshot already does; a read that faults anyway is counted (copy_faults) and fails that buffer's refresh. A buffer released after the snapshot whose pages are still mapped is staged for that submission, which may read it (the contention case does). The wrappers cannot tell which buffers a submission's lists read, so the snapshot still covers every live copied buffer. The copy-after-retire mutant skips the second probe; the guard then catches the faulting read. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * tests: drive discarded copies, earlier reads and refresh races in linear_buffer_backing New cases on the copy path, on XMem and private memory: - gpuw.discard (the review repro): a list copy into a copied buffer is recorded, closed and reset without a submission; after the CPU writes B the next read must see B, with gpu_written 0. - war: a read of A on queue 1 behind a title gate; the CPU writes B and queue 2 submits a read. Queue 2 must not complete while the gate is closed, queue 1 must read A, queue 2 B, and producer_waits must grow. - xq.write: queue 1 waits through its wrapper (slot 17) on a title fence and submits a read; after the CPU writes B, queue 2's read must complete while queue 1 still waits (no deadlock), both read B, and the skip is counted. - order: two threads refresh one buffer, parked through a new fixture hook (x2w_d3d12_linear_buffer_test_pause) so that the older copy publishes last; the next submission must refresh and read D. - retire: a submission parks after its snapshot while the title releases X and frees its pages; X must be skipped as unreadable, with no copy fault and no failed refresh, and Y must read C. Four controls run on WARP with WILL_FAIL, each failing its own case: gpuw-at-record, skip-producer-wait, publish-out-of-order and copy-after-retire. The totals line prints the new counters. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: record the linear-buffer submit-time GPU write, producer wait and refresh races Describe the review fixes for slot 133's copied linear buffers. A list copy marks a buffer GPU-written only when its recording is submitted. A refresh's copy waits for every queue's earlier submission, except one that sits behind an unreached title Wait, which is skipped so that title fences cannot close a cycle. Uploads are published in the order their copies execute. Title memory is probed again and read under a fault guard right before it is staged. Add the gpuw.discard, war, xq.write, order and retire cases, the changed contention expectation (S1 reads B), the four new controls, and the results at 981b519 on WARP and an RX 9070 XT (driver 32.0.32029.2010) in the dev and release presets. Note the remaining overlap window and the cost of treating every submission as a user of every backing. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * gpu: refuse a linear-buffer submission whose refresh has no safe completion order A refresh no longer skips a queue whose latest submission sits behind an unreached title Wait (slot 17). Skipping did not prove that the fence stays blocked until the copy finishes: another producer can reach it meanwhile and the copy then overlaps that read. Instead, right before the refresh would be enqueued (under internal_mutex_), a refresh that would have to wait for such a submission, or for one without a user fence value, refuses the whole submission: no refresh, consumer Wait, title lists or user fence Signal is enqueued. Staging buffers and the refresh list are freed, no upload record or refresh state changes, and recorded GPU writes stay pending on their recordings. The title's own Signal/Wait paths are untouched, so a later Signal still releases the earlier queue. Counted as unsafe_refresh_refusals (replacing producer_wait_skips) and logged. A title wait that cannot be stored now blocks the queue until the next submission behind it completes, instead of being forgotten at that submission. xq.write now gates queue 1 on a title fence with a read of A, writes B and expects queue 2's read to be refused (slot keeps P), queue 1 to read A after the title's Signal through queue 2's wrapper, and the refused recording to read B when resubmitted. New control accept-unsafe-refresh restores the skip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: record the linear-buffer refusal of a refresh with no safe completion order Replace the producer-wait skip in the runtime notes with the refusal: when it applies, what a refused submission leaves in place, its log line and the unsafe_refresh_refusals counter. In the experiment notes, rewrite the xq.write oracle, drop the skip results and the overlap caveat, and record the c6a0c8a runs and the accept-unsafe-refresh control. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * gpu: order a queue's title waits and user fence values under one lock A title Wait (queue slot 17) and ExecuteCommandLists on the same queue from two threads could be recorded in the opposite order to the desktop queue: a submission behind the desktop Wait took its user fence value before note_title_wait ran, so the Wait was recorded as preceding only later submissions. Another queue's refresh was then accepted and waited for the blocked submission, and that queue's own Signal of the fence sat behind the refresh. Each queue's linear-buffer record now has an order lock (SRWLOCK; users_ becomes a deque so records never move). Slot 17 holds it from the desktop Wait through note_title_wait; a submission holds it from the title's ExecuteCommandLists through after_submit, taken before draw_lock and allocator_lock in render mode and with no other lock held. It is not held across the refresh, nothing under it waits on the CPU for the GPU, and the title's Signal does not take it. The fixture adds xq.race: the Wait is parked through a new pause point (3) between the desktop Wait and its record while another thread submits the read of A on queue 1. Queue 2's read must still be refused and queue 2 must still signal the fence; waits are bounded with a CPU Signal of the fence as cleanup. Control unlocked-title-wait skips the lock in slot 17 and reproduces the review's pending lanes with zero refusals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…s in bcpack_symbols with CLI suite (R0Y00#2604)
…#2601) * mesh: preserve a scalar shift across a wave64 EXEC-zero branch Prove the post-count thread-prefix mask, then test the partial and empty waves against the CPU image and a per-lane control. * tests: use the wave64 VCC operand in the mesh assembly fixture --------- Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
* shader: lower compute buffer_store_format_d16_x in gfx2hlsl Refs R0Y00#2274. Adds compute-stage MUBUF buffer_store_format_d16_x (opcode 0x84) lowering to tools/startup/gfx2hlsl.py: - Validates four untouched descriptor words from a fixed native table entry (refusing modified descriptors including stride clears, shared load/store descriptors, missing local table provenance after branches, non-compute stages, lane-mask soffset, illegal binary lds/reserved MUBUF bits, bad operand shapes, and unsupported modifiers glc/slc/dlc/tfe/lds). - Emits uav <slot> table <param> <offset> plus udsrc entries uav_descword3, uav_stride (unmasked DW1 >> 16, so stride > 0x3fffu rejects DW1[31:30] CACHE_SWIZZLE/SWIZZLE_ENABLE) and uav_numrecords, under an if (exec & 1) guard when EXEC is not proven entry-full. - Supports 1-channel formats BUF_FMT_32_FLOAT (22), BUF_FMT_16_FLOAT (13), BUF_FMT_16_UNORM (7), BUF_FMT_16_SNORM (8), BUF_FMT_16_UINT (11) and BUF_FMT_16_SINT (12) in both GFX10 unified and legacy DFMT/NFMT encodings, checking DST_SEL_X == 4, zero reserved/swizzle/ADD_TID_ENABLE/TYPE flags, and RDNA 2 ISA §8.1.5 Table 35 bounds modes: OOB_SELECT 0 (structured, stride != 0, rec_off = voff + imm_off checked against stride while soffset adds to base) and OOB_SELECT 3 (raw, stride == 0, soffset + rec_off + elem_bytes <= num_records). OOB_SELECT 1/2, mismatched stride/OOB_SELECT, 32-bit overflow, misaligned addresses, unsupported formats/flags and OOB lanes are no-ops. - Uses 4-byte aligned Store for BUF_FMT_32_FLOAT and a lock-free InterlockedCompareExchange CAS loop for 2-byte aligned 16-bit formats. Adds tests/startup_compute_store_d16_x_check.py wired in CMakeLists.txt, .github/workflows/windows.yml and docs/experiments.md. AI-assisted: implementation and tests drafted and verified with an AI coding assistant. * shader: guard buffer_store_format_d16_x against host UAV bounds * shader: lower compute buffer_store_format_xyzw in gfx2hlsl Refs R0Y00#2274. Depends on R0Y00#2478, whose descriptor, entry-constant, bounds and EXEC handling this reuses. Lowers compute MUBUF buffer_store_format_xyzw (0x07) in the idxen form with a non-negative inline soffset and optional offset:. FORMAT, stride and num_records are read at dispatch from uav_descword3, uav_stride and uav_numrecords, with the OOB_SELECT 0/3 bounds of buffer_store_format_d16_x (the bounds lines are checked identical). Only the 4-channel formats of tools/compute_store_aot.py write (32x4 UINT/FLOAT, 16x4 FLOAT through pack16_rne, 8_8_8_8 and 2_10_10_10 UNORM, unified and legacy encodings, identity DST_SEL); as in that tool, a format of another channel count writes nothing. offen, off, register soffset, cache/tfe/lds modifiers and non-compute stages are refused by name. Adds tests/startup_compute_store_format_xyzw_check.py, registered in CMakeLists.txt, .github/workflows/windows.yml and AGENTS.md, and a docs/experiments.md entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shader: keep the unknown-op refusal for xyzw stores outside compute Outside a compute stage buffer_store_format_xyzw keeps the bare mnemonic, as buffer_store_format_d16_x and buffer_store_dword do. The index and data are evaluated before the UAV and its entry constants are registered. The experiments entry drops a claim about captured programs and names the prebuilt WARP runner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shader: guard buffer_store_format_xyzw against host UAV bounds The xyzw helper now takes the host-view check that R0Y00#2478 added to the d16_x helper: after the guest bounds and the alignment check it reads the bound view size with GetDimensions and drops an element that would pass its end. The expected helper text and the experiments entry follow; the entry also corrects the case count to 19. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: dispatch xyzw stores through sized descriptor-table views The helper reads the bound view size with GetDimensions, which has no defined result on a root descriptor. Dispatch through --compute-store-sized-case, as the d16_x check does. The experiments entry records which runner mode produced the local WARP result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Vladimir <39053957+Vladimir-Human@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
…ling in exe_aot with CLI suite (R0Y00#2605)
* tests: run the six integer-format MRT cases in parallel private caches Part of R0Y00#448 * tests: check legacy cache hits in the populated integer-format session --------- Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
…0#2567) * fix: let the heartbeat test accept a peak commit that rose between samples * test: shorten the heartbeat and storage worker waits The heartbeat thread reads X2W_HEARTBEAT_INTERVAL_MS (1000 to 10000, default 10000) so startup_heartbeat_commit takes about 3 s instead of 30 s. The storage worker test polls every 1 ms instead of 5 ms. * test: check the heartbeat interval override takes effect * test: add negative controls for the heartbeat peak check * test: keep the storage worker poll interval (no measured gain) On Win2025 the test took 37.5 s with 5 ms polls and 37.1 to 40.4 s with 1 ms polls, so the change is dropped.
…sl (Part of R0Y00#1723) (R0Y00#2077) * feat: translate 24-bit multiplies, v_xnor_b32 and the funnel shifts in gfx2hlsl Part of R0Y00#1723. Adds v_mul_i32_i24, v_mul_hi_i32_i24, v_mul_hi_u32_u24, v_mad_i32_i24, v_xnor_b32, v_alignbit_b32 and v_alignbyte_b32 with a CPU-evaluated check against an unbounded-integer reference. * test: draw 24-bit multiplies, xnor and funnel shifts on D3D12 WARP against an integer reference * fix: read the unsigned 24-bit fields with a shift pair so FXC keeps the high product * fix: simplify the high 24-bit product lowering * fix: build the unsigned 24-bit high product from the signed shift pair; run both compilers before failing * fix: refuse v_mul_hi_u32_u24 instead of translating it to a zero that FXC folds; document the 24-bit multiplies * docs: record the FXC denormal float-output fold behind the v_mul_hi_u32_u24 refusal * fix: keep main's v_mul_i32_i24/v_mad_i32_i24 lowering so the i24 mutation test still matches --------- Co-authored-by: Royoo <3230853833@qq.com>
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: SimSalabimse <SimSalabimse@users.noreply.github.com>
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
Refs R0Y00#2413 (item T6, loop refusal fixture only).
Adds a source-built gfx1013 mesh program (
tests/startup_mesh57_loop_refusal.s) that keeps the accepted skeleton group-memory exchanges and inserts one deliberate back-edge (s_nop+s_branch -2) after the count exchange. Tiptranslate_mesh57must refuse it with:slot 57 mesh: a loop outside the group-memory exchanges is not coveredThe mutant replaces that back-edge with a second
s_nopand must not stop on the loop refusal (it translates through the source-only path). The oracle is an exact string match; a stub that only checks for anyunsupported:result would accept a wrong reason and is rejected by the check.No R1 runtime, no loop lowering, no other translator rows.
Verification
Commit
5366e34don Linux (host-only; no DXC/WARP):CTest name:
startup_mesh57_loop_refusal(registered inCMakeLists.txt). Also listed inAGENTS.mdand the Linux Python CI job; optionalbinary <llvm-mc-15>arm wired in the Ubuntu assemble step.Evidence and follow-up
.ms57/.ps57sources underX2W_FXC=''.Checklist
AI-assisted.