shader: merge current main into the native shader module stack #3243

Manually merged
github merged 99 commits from github-bot/gh-3241 into codex/native-shader-modules 2026-11-28 14:26:03 +00:00 AGit
Owner

@⁠lambirou on GitHub · 2026-11-28 01:22 UTC · original
lambirou:merge/native-shader-main-current → codex/native-shader-modules · +25122 −1440 · 299 files · 99 commits · merged 2026-11-28 13:42 UTC

Updates #3091's codex/native-shader-modules branch to current main 7e5c378d, on top of the current base 71e23baf, without modifying either target branch. This is a merge-only PR; R0Y00 can merge it to refresh #3091. Conflict resolutions: - Base merge (#3140/#3308): keep #3138's sidecar_changed invalidation together with the branch's compute dependency_changed/lost checks in the watch gate; keep #3310's reviewed address-only mesh pixel inputs. - src/shader_compute_request.cpp: use the shared graphics_request_key/compute_request_key helpers, and keep read_pixel_inputs so both .psin and .ps57in records are read. - src/gfx1013_direct_compute.inl: keep the BCNT64 block alongside main's combine_scalar_mask, both output shapes (virtual waves 64x1x1, flat compute-derivative quads x*y*z), the exact_store/indexed gates, WREXEC and the virtual-wave derivative refusal. - src/gfx1013_compute_native.cpp: accept main's raw-store cache-policy naming while keeping the branch's direct-compute paths. - tools/startup/compile_dxil.cpp: keep both --rekey and --prepare-compute-pack in the usage text, and both watch invalidations. Validation at 48b2027c, Windows 11 build 26300, WARP 10.0.26100.10068 and RX 9060 XT 32.0.32029.2010: Debug: 18/18 selected controls pass, zero skips. Release /O2: 18/19; the only failure is native_ldexp_f16_hardware on this RX 9060 XT, and unmodified main 3926a289 fails it identically (got beef7c00, expected beef0200), so it is upstream #3125. The set covers direct container/mesh, pack/frozen, the compile watcher, interface/WQM, request cache, SALU shift64, image cache flags, WREXEC64, #3264 EXEC/VCC and the packed virtual-wave derivative control. The (8,4,1) native_compute_implicit_lod_hardware mismatch also still reproduces on unmodified main and remains #3257. The D3D12 debug layer is unavailable (0x887a002d). This does not change the flag fix in #3141; it only refreshes the compiler base and keeps both merged features.

**@⁠lambirou** on GitHub · 2026-11-28 01:22 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3241) `lambirou:merge/native-shader-main-current` → `codex/native-shader-modules` · +25122 −1440 · 299 files · 99 commits · merged 2026-11-28 13:42 UTC Updates #3091's `codex/native-shader-modules` branch to current `main` `7e5c378d`, on top of the current base `71e23baf`, without modifying either target branch. This is a merge-only PR; R0Y00 can merge it to refresh #3091. Conflict resolutions: - Base merge (#3140/#3308): keep `#3138`'s `sidecar_changed` invalidation together with the branch's compute `dependency_changed`/`lost` checks in the watch gate; keep #3310's reviewed address-only mesh pixel inputs. - `src/shader_compute_request.cpp`: use the shared `graphics_request_key`/`compute_request_key` helpers, and keep `read_pixel_inputs` so both `.psin` and `.ps57in` records are read. - `src/gfx1013_direct_compute.inl`: keep the BCNT64 block alongside main's `combine_scalar_mask`, both output shapes (virtual waves `64x1x1`, flat compute-derivative quads `x*y*z`), the `exact_store`/`indexed` gates, WREXEC and the virtual-wave derivative refusal. - `src/gfx1013_compute_native.cpp`: accept main's raw-store cache-policy naming while keeping the branch's direct-compute paths. - `tools/startup/compile_dxil.cpp`: keep both `--rekey` and `--prepare-compute-pack` in the usage text, and both watch invalidations. Validation at `48b2027c`, Windows 11 build 26300, WARP 10.0.26100.10068 and RX 9060 XT 32.0.32029.2010: Debug: 18/18 selected controls pass, zero skips. Release `/O2`: 18/19; the only failure is `native_ldexp_f16_hardware` on this RX 9060 XT, and unmodified `main` `3926a289` fails it identically (`got beef7c00, expected beef0200`), so it is upstream #3125. The set covers direct container/mesh, pack/frozen, the compile watcher, interface/WQM, request cache, SALU shift64, image cache flags, WREXEC64, #3264 EXEC/VCC and the packed virtual-wave derivative control. The `(8,4,1)` `native_compute_implicit_lod_hardware` mismatch also still reproduces on unmodified main and remains #3257. The D3D12 debug layer is unavailable (`0x887a002d`). This does not change the flag fix in #3141; it only refreshes the compiler base and keeps both merged features.
The runtime writes <cache>/revision.txt with its first request. Two native-path
checks still compare the whole cache directory, so a release build that reaches
that write reports the metadata file as a published shader.

Filter revision.txt from the request-set assertion and from the publication
check. The other native checks already do this.
Co-authored-by: RonLogic <[email protected]>
Add packed_f16_inline_constant() in DirectCompute and share it between packed_f16_alu() (v_pk_add_f16, v_pk_mul_f16, v_pk_fma_f16) and packed_minmax() (v_pk_min_f16, v_pk_max_f16, v_pk_min_{i,u}16, v_pk_max_{i,u}16). Inline binary16 float constants 240..248 decode with bits [31:16] zeroed per gfx1013 hardware, inline integers 128..208 decode to 32-bit sign-extended values, and vcc/m0/exec/scc/float-on-int/clamp refusals stay intact.

Fixes #3226

Refs #2935

Refs #3224

AI-assisted.

Co-authored-by: legacy-code-archaeologist <[email protected]>
Port of #3006 onto main.

Bit 20 of .sa dword 4 now sets ComputeRequest::wave32 (set: wave32,
clear: wave64). The direct DXIL route compiles a wave64 request with
more than 32 threads per group through the existing wave64 path; a
wave64 group of at most 32 threads stays on the wave32 model. Request
keys and the revision-29 / revision-28 archive handling are unchanged.

Native compute manifests end with 'native <revision>'
(src/native_compute_output.h). The stand-in refuses a native manifest
from another revision, or an unmarked one without the Python
translator's <key>.cs.hlsl, and looks again on the ManifestRetry
schedule of an absent manifest. compile_dxil --watch rebuilds both, and
a native publish removes a leftover <key>.cs.hlsl.

Source-built fixtures that relied on the wave32 default now set the
bit, and fixtures that copy a Python translation also copy its
sidecar.

AI-assisted.
* runtime: name each refused condition of a compute output buffer

The refusal "an output is not an aliased placed buffer range with unordered
access" covered nine conditions. Each now has its own reason in the log and
the census: a view token, zero records, a range over 16 MiB or not whole
dwords, a range crossing a placed buffer's end, memory outside any placed
buffer, a copied placement, a resource not created in the common state, an
offset not 16-byte aligned, and no unordered access. What is bound and what
is refused do not change.

tests/startup_compute_dispatch_output_check.py produces each condition on
case A and checks its reason, the census line and an untouched output.
dispatch-swapped now expects "an output buffer has no unordered access".

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test: copy the output texture token into its table entry

Creating the view at heap byte 16, which is not a descriptor of the heap,
ends the consumer; the view is created at byte 64 and its token words copied.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: record the output reason fixture results

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: per-reason counts from one start-up run

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: the token keys with #2961 merged

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: label start-up counts as first-refusal buckets

The census keeps one first refusal per key and counts all of the key's
untranslated dispatches under it, so the run tables are first-refusal
buckets, not counts per condition.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Source op_sel bits 0-2 read the high half [31:16] of a VGPR source;
op_sel bit 3 writes the binary16 result to D[31:16] and keeps D[15:0].
Without bit 3 the result still goes to D[15:0] with D[31:16] kept.
op_sel on an SGPR or constant source, with clamp, on v_fmac_f16, DPP and
SDWA stay refused.

New test native_fma_f16_opsel (IR and hardware) covers the six source and
destination selections against tests/f16_packed_model.py, with a
sentinel in the kept half, plus three refusal controls.
Bring main 57e94668 into #3091's 247530b0 head. Resolve the five overlapping
areas by retaining both features:

- keep compute request shape validation and derive wave32 from the packed state;
- serialize both sampler_heap and stride_srvs in the compute frontend cache;
- keep the current wave-size selection plus the packed-state virtual-wave path;
- prepare descriptor strides once and keep a single initialize call;
- keep the sidecar dependency retry and the native compute manifest revision check.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 01:25:43 +00:00
Author
Owner

@⁠lambirou on GitHub · 2026-11-28 01:26 UTC · original

@⁠R0Y00 this is the merge-only refresh of #3091 onto main 57e94668. It is ready to merge into codex/native-shader-modules.

Validation at cead019e: 12/12 selected compiler/compute/sampler tests in Debug and 12/12 in Release, zero skips. No source changes beyond the conflict resolution. AI was used.

**@⁠lambirou** on GitHub · 2026-11-28 01:26 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3241#issuecomment-7231663170) @⁠R0Y00 this is the merge-only refresh of #3091 onto `main` `57e94668`. It is ready to merge into `codex/native-shader-modules`. Validation at `cead019e`: 12/12 selected compiler/compute/sampler tests in Debug and 12/12 in Release, zero skips. No source changes beyond the conflict resolution. AI was used.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-28 01:38 UTC · original · requested changes

Thanks for preparing the merge-only PR. I found one correctness issue at cead019e. In read_compute_request(), sa[18] is evaluated before validate_compute_request_shape() enforces the 28-byte .sa. check_compute_extents() only checks that the companion length agrees with the descriptor, so an internally consistent short request can reach that access. #3006 validated the length first.

Please construct ComputeRequest with its default wave32 value, call validate_compute_request_shape(request), then read request.sa[18] into request.wave32. A source-built request with correctly keyed, short state A should return the existing “compute state block A is not 28 bytes” diagnostic in Debug and Release. The other reconciliations match the intended sampler, stride, and manifest revision behavior.

**@⁠R0Y00** on GitHub · 2026-11-28 01:38 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3241#pullrequestreview-6094934707) · **requested changes** Thanks for preparing the merge-only PR. I found one correctness issue at cead019e. In read_compute_request(), sa[18] is evaluated before validate_compute_request_shape() enforces the 28-byte .sa. check_compute_extents() only checks that the companion length agrees with the descriptor, so an internally consistent short request can reach that access. #3006 validated the length first. Please construct ComputeRequest with its default wave32 value, call validate_compute_request_shape(request), then read request.sa[18] into request.wave32. A source-built request with correctly keyed, short state A should return the existing “compute state block A is not 28 bytes” diagnostic in Debug and Release. The other reconciliations match the intended sampler, stride, and manifest revision behavior.
read_compute_request indexed state block A for the wave-size bit before validate_compute_request_shape enforced its 28-byte length. Build the request with the default wave32 value, run the shape check, and only then decode the bit.

Add a source-built request with a correctly keyed 24-byte state A to native_compute_clear and require the existing shape diagnostic.
Author
Owner

@⁠lambirou on GitHub · 2026-11-28 01:44 UTC · original

Fixed at cf19be36. read_compute_request() now constructs ComputeRequest with its default wave32, calls validate_compute_request_shape(), and only then decodes request.sa[18].

Added the requested regression to native_compute_clear_check.py: a source-built request with a correctly keyed 24-byte state A must return compute state block A is not 28 bytes and write no shader.

Validation, Debug and Release, 5/5 each (no skips):

native_compute_clear
native_compute_pack
startup_compute_request_warp
startup_compute_translate_requests
startup_compute_request_offline

The other reconciliations are unchanged.

**@⁠lambirou** on GitHub · 2026-11-28 01:44 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3241#issuecomment-7231889173) Fixed at cf19be36. `read_compute_request()` now constructs `ComputeRequest` with its default `wave32`, calls `validate_compute_request_shape()`, and only then decodes `request.sa[18]`. Added the requested regression to `native_compute_clear_check.py`: a source-built request with a correctly keyed 24-byte state A must return `compute state block A is not 28 bytes` and write no shader. Validation, Debug and Release, 5/5 each (no skips): ~~~ native_compute_clear native_compute_pack startup_compute_request_warp startup_compute_translate_requests startup_compute_request_offline ~~~ The other reconciliations are unchanged.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-28 02:04 UTC · original · approved these changes

Re-reviewed cf19be3651. The state length is now validated before the first access to byte 18. The new correctly keyed 24-byte fixture preserves the existing diagnostic and prevents publishing a shader. I also ran a correctly keyed 16-byte state through both builds, so the request ends before byte 18. Both refused it with the expected shape diagnostic.

I independently tested on main 50e4f763, with cf19be36 integrated in trial tree 0d0868d58b43ad9bd1f5cd696ef2984ef41b00ee:

ctest --test-dir <build> --no-tests=error --output-on-failure -j 1 -R "^(native_(compute_clear|compute_pack|frozen_request|direct_(container|mesh)|graphics_(interface_library|wqm_ir|sampler_heap_.*)|compile_dxil_watch|startup_request_cache_controls|rtv_variant_controls)|startup_compute_(request_warp|translate_requests|request_offline|dispatch_native_hardware))$"

Debug and Release /O2 each passed 16/16, zero skips. Windows 11 26200.9974, RTX 4060 Laptop (32.0.16.1656), and inbox WARP 10.0.26100.9818. The selected suite exercised the WARP and hardware graphics paths and hardware slot-67 Dispatch.

This review covers the compiler-branch refresh. #3091 is the main integration PR and still needs its own review and required Windows check on the resulting head.

**@⁠R0Y00** on GitHub · 2026-11-28 02:04 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3241#pullrequestreview-6095097055) · **approved these changes** Re-reviewed cf19be365119. The state length is now validated before the first access to byte 18. The new correctly keyed 24-byte fixture preserves the existing diagnostic and prevents publishing a shader. I also ran a correctly keyed 16-byte state through both builds, so the request ends before byte 18. Both refused it with the expected shape diagnostic. I independently tested on main 50e4f763, with cf19be36 integrated in trial tree 0d0868d58b43ad9bd1f5cd696ef2984ef41b00ee: ``` ctest --test-dir <build> --no-tests=error --output-on-failure -j 1 -R "^(native_(compute_clear|compute_pack|frozen_request|direct_(container|mesh)|graphics_(interface_library|wqm_ir|sampler_heap_.*)|compile_dxil_watch|startup_request_cache_controls|rtv_variant_controls)|startup_compute_(request_warp|translate_requests|request_offline|dispatch_native_hardware))$" ``` Debug and Release /O2 each passed 16/16, zero skips. Windows 11 26200.9974, RTX 4060 Laptop (32.0.16.1656), and inbox WARP 10.0.26100.9818. The selected suite exercised the WARP and hardware graphics paths and hardware slot-67 Dispatch. This review covers the compiler-branch refresh. #3091 is the main integration PR and still needs its own review and required Windows check on the resulting head.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-28 02:55 UTC · original

After #3245 and #2981 landed, integrating cf19be36 onto main c827d8ba now conflicts in four files. The original short-state fix remains correct. I checked this reconciliation locally (tree 91399a6f3e12cd06062928ae111abb48cfdd976e):

  • In CMakeLists.txt keep both the exact-width texture cases and the compiler stack's new cases.
  • In gfx1013_compute_native.h keep main's three exact-width kinds in their current numeric positions, append packed_d16_x_uav and indexed_raw_srv, and keep both exact_texture_uav_channels and accepts_cbv_window. Use indexed_raw_srv for the decode upper bound in direct_compute_cache.cpp. The generated native shader revision already hashes the two source files.
  • In gfx1013_direct_compute.inl keep both exact_store and indexed. The store gate needs the exact_store exception and the descriptor gate needs the indexed exception.

The local Release /O2 trial gives 9/9, no skips. This includes pack/frozen request, direct mesh compilation, exact-width RGB and R store plus RGBA/sparse refusals on RTX, and #2981's now-main cold/warm and retry paths on WARP and RTX. Windows 11 26200.9974, RTX 4060 Laptop driver 32.0.16.1656, WARP 10.0.26100.9818, debug layer enabled for the graphics/texture fixtures.

ctest --test-dir <release-build> --no-tests=error --output-on-failure -j 1 -R "^(native_(compute_pack|frozen_request|direct_mesh|image_store_exact_width_hardware_(r|rgb|rgba|sparse))|startup_native_graphics_draw_(warp|hardware))$"

Please carry the current-main reconciliation on the refresh PR's source branch so #3091 can use it in its next review. The local trial did not change either target branch.

**@⁠R0Y00** on GitHub · 2026-11-28 02:55 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3241#issuecomment-7232676919) After #3245 and #2981 landed, integrating cf19be36 onto main c827d8ba now conflicts in four files. The original short-state fix remains correct. I checked this reconciliation locally (tree 91399a6f3e12cd06062928ae111abb48cfdd976e): - In CMakeLists.txt keep both the exact-width texture cases and the compiler stack's new cases. - In gfx1013_compute_native.h keep main's three exact-width kinds in their current numeric positions, append packed_d16_x_uav and indexed_raw_srv, and keep both exact_texture_uav_channels and accepts_cbv_window. Use indexed_raw_srv for the decode upper bound in direct_compute_cache.cpp. The generated native shader revision already hashes the two source files. - In gfx1013_direct_compute.inl keep both exact_store and indexed. The store gate needs the exact_store exception and the descriptor gate needs the indexed exception. The local Release /O2 trial gives 9/9, no skips. This includes pack/frozen request, direct mesh compilation, exact-width RGB and R store plus RGBA/sparse refusals on RTX, and #2981's now-main cold/warm and retry paths on WARP and RTX. Windows 11 26200.9974, RTX 4060 Laptop driver 32.0.16.1656, WARP 10.0.26100.9818, debug layer enabled for the graphics/texture fixtures. ``` ctest --test-dir <release-build> --no-tests=error --output-on-failure -j 1 -R "^(native_(compute_pack|frozen_request|direct_mesh|image_store_exact_width_hardware_(r|rgb|rgba|sparse))|startup_native_graphics_draw_(warp|hardware))$" ``` Please carry the current-main reconciliation on the refresh PR's source branch so #3091 can use it in its next review. The local trial did not change either target branch.
The SDWA decoder refused clamp on v_cvt_f32_f16 because the op is in
neither the float ALU nor the conversion list. The SDWA form now takes
clamp with the integer clamp v_ldexp uses: a set sign bit or NaN gives
+0, values above 1.0 give 1.0. The direct VOP3 form, omod and the other
SDWA modifiers stay refused.

native_sdwa_f16_hardware reads back the clamped conversion from both
halves for negative, above-one, NaN, -0.0, denormal and in-range inputs.

AI-assisted.
DPP8 was decoded only for graphics, and only for quad-local selections.
Direct compute now takes DPP8 (src0 233, and 234 with FI) on the VOP1/
VOP2 ops the DPP16 path accepts: lane L reads src0 from lane
(L & ~7) | sel[L & 7] with waveReadLaneAt, within the 32-lane wave or
the physical half of a split wave64. An inactive source lane gives zero
unless FI is set (assumed rule: DPP8 has no BOUND_CTRL; checked against
the test's CPU model only). Binary16 ops keep refusing DPP8.

native_dpp8_hardware reads back min/add/max with the [4,5,6,7,0,1,2,3]
swap, a mov with an asymmetric pattern, and sparse-EXEC add with and
without FI and min without FI, against a CPU reference.

AI-assisted.
The binary16 SDWA VOP2 arithmetic (add, sub, subrev, mul) accepts an
SGPR or an inline constant as src0/src1, as GFX10 SDWA allows (extension
bits 23 and 31). The source selection applies to the 32-bit scalar
word; an inline float is materialized as its binary16 value first. A
WORD_1 selection of an inline constant stays refused because its other
half is not modelled here. Literals stay refused (SDWA has none).

New test native_sdwa_f16_scalar (IR and hardware): SGPR DWORD/WORD_1,
inline 1.0 and integer 0, with distinct halves in every source and the
preserved/padded destination half, plus refusal controls.
Fixes #3238

Refs #2935

AI-assisted.

Co-authored-by: legacy-code-archaeologist <[email protected]>
D = old EXEC, EXEC = old EXEC | S0, SCC = (EXEC != 0), like
s_and_saveexec_b32 with OR. As with s_mov_b32 exec_lo, EXEC keeps every
bit, including bits past the group; a lane runs only if its own bit is
set. An EXEC destination is refused.

native_or_saveexec_hardware covers -1, an SGPR aliasing the destination,
a literal, vcc_lo, an empty mask and a bit past the group, in 8- and
32-thread groups, with the saved EXEC, the new EXEC, SCC and a restore.

AI-assisted.
Co-authored-by: sm5 <sm5@x>
Co-authored-by: lewisalex86 <[email protected]>
Non-D16 image_store with dmask 0x1, 0x3 or 0x7 (2D, 2D array, 3D) is
lowered as a typed UAV store of float, float2 or float3 with every
component written, as the D16 path already does for masks 1 and 3. The
manifest carries the channel count (`channels 1|2|3`, plus tex3d), and
the runtime refuses the dispatch unless the bound texture has exactly
that many channels ("an exact-width image store requires a matching
output texture channel count") and supports typed UAV stores. No channel
is left unwritten, so there is no read-modify-write and no race between
invocations. Non-prefix masks stay refused.

New test native_image_store_exact_width (WARP and hardware): R32_FLOAT,
R32G32_FLOAT and R11G11B10_FLOAT readbacks in 2D, a 2D array and 3D, with
sentinel texels, through the published manifest and the native route;
an RGBA8 texture with a 0x7 store is refused at run time and a 0x9 mask
by the translator. The native pass runs first, so an adapter without
32-lane waves (inbox WARP) reports the capability skip.
Change const void* const* vtbl to void* const* vtbl in COM interface structs across 5 GameInput test files (13 occurrences). MSVC rejects reinterpret_cast from const void* through vtable function pointers.

Add static_cast<UINT> for sizeof expressions in rectlist_draw_check.cpp and startup_indirect_draw_indexed.cpp to fix C++11 narrowing errors.

Store D3D12_TEXTURE_COPY_LOCATION temporaries in named locals before passing their addresses to CopyTextureRegion in startup_resource_retire_*.cpp, fixing address-of-temporary warnings that MSVC treats as errors.

Co-authored-by: Kelbo <[email protected]>
Compile a supported VS/PS pair in process through the ordinary draw path when the native compiler is enabled. Preserve an existing published disk pair and allow a later publication to recover after a native manifest refusal.

The source-built fixture verifies cold and warm cache, actual readback after draw submission, disk precedence, and independent early and late failures on WARP and hardware.

Refs #2978.
* startup: compare resolved staging paths

* test: allow package-internal staging junctions

* startup: resolve provider-qualified staging paths

* ci: run startup staging check in PR preset

---------

Co-authored-by: sm5 <sm5@x>
Co-authored-by: lewisalex86 <[email protected]>
* compute: accept EXEC as a 64-bit scalar operand in direct compute

EXEC (126) is accepted as the even source pair of s_bcnt0/s_bcnt1,
s_ff0/s_ff1 and s_flbit *_b64, and as the s_bfm_b64 destination. In the
wave64 model each host half holds both EXEC words: both are set at entry,
lane-mask writers publish both through the exchange, and scalar writes are
identical in both halves; VCC has no such guarantee and stays
refused as a source and as the s_bfm_b64 destination.

New test native_wave64_exec_salu (wave64 64 and 128 threads, wave32 32):
a sparse EXEC count, s_bfm_b64 exec, 16, 0 and exec, 32, 32, with three
refusal controls. Depends on #3006 for the wave64 model.

* docs: describe EXEC as a 64-bit SALU source and s_bfm_b64 destination

native-direct-salu-bitscan64 lists EXEC as a valid S0 and explains why
its source refusal control now uses exec_hi; native-salu64-ops lists
s_bfm_b64 into EXEC, keeps the s_cselect_b64 / s_not_b64 EXEC
destination refusal, and adds the native_wave64_exec_salu_hardware
command.
Fixes #3242

Refs #2935, #3224

AI-assisted.

Co-authored-by: legacy-code-archaeologist <[email protected]>
Keep both the exact-width texture cases and the compiler stack's test registrations. In gfx1013_compute_native.h keep main's float/float2/float3 kinds, append packed_d16_x_uav and indexed_raw_srv, and keep both exact_texture_uav_channels and accepts_cbv_window. Use indexed_raw_srv as the decode upper bound. In gfx1013_direct_compute.inl keep exact_store and indexed, with the exact_store exception in the store gate and the indexed exception in the descriptor gate.
Author
Owner

@⁠lambirou on GitHub · 2026-11-28 03:15 UTC · original

Carried onto the refresh branch: f7bf5e2e merges main 9872074a into cf19be36.

The four conflicts are resolved as requested:

  • CMakeLists.txt keeps both the exact-width texture cases and the compiler stack's registrations.
  • gfx1013_compute_native.h keeps float_texture_uav/float2_texture_uav/float3_texture_uav in their numeric positions, then appends packed_d16_x_uav and indexed_raw_srv; both exact_texture_uav_channels and accepts_cbv_window remain.
  • direct_compute_cache.cpp uses indexed_raw_srv as the decode upper bound.
  • gfx1013_direct_compute.inl keeps both exact_store and indexed: the store gate accepts exact_store, and the descriptor gate accepts indexed.

Release /O2 and Debug each pass 9/9, zero skips, with your regex: native_compute_pack, native_frozen_request, native_direct_mesh, the four native_image_store_exact_width_hardware_* cases, and startup_native_graphics_draw_{warp,hardware}. Windows 11 26300, WARP 10.0.26100.10068, RX 9060 XT 32.0.32029.2010. The D3D12 debug layer was unavailable (0x887a002d).

#3243 is CLEAN/MERGEABLE at f7bf5e2e and approved; #3091 can use this head for its next review.

**@⁠lambirou** on GitHub · 2026-11-28 03:15 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3241#issuecomment-7232932335) Carried onto the refresh branch: `f7bf5e2e` merges `main` `9872074a` into `cf19be36`. The four conflicts are resolved as requested: - `CMakeLists.txt` keeps both the exact-width texture cases and the compiler stack's registrations. - `gfx1013_compute_native.h` keeps `float_texture_uav`/`float2_texture_uav`/`float3_texture_uav` in their numeric positions, then appends `packed_d16_x_uav` and `indexed_raw_srv`; both `exact_texture_uav_channels` and `accepts_cbv_window` remain. - `direct_compute_cache.cpp` uses `indexed_raw_srv` as the decode upper bound. - `gfx1013_direct_compute.inl` keeps both `exact_store` and `indexed`: the store gate accepts `exact_store`, and the descriptor gate accepts `indexed`. Release `/O2` and Debug each pass 9/9, zero skips, with your regex: `native_compute_pack`, `native_frozen_request`, `native_direct_mesh`, the four `native_image_store_exact_width_hardware_*` cases, and `startup_native_graphics_draw_{warp,hardware}`. Windows 11 26300, WARP 10.0.26100.10068, RX 9060 XT 32.0.32029.2010. The D3D12 debug layer was unavailable (`0x887a002d`). #3243 is `CLEAN/MERGEABLE` at `f7bf5e2e` and approved; #3091 can use this head for its next review.
* compute: allow implicit-derivative image sampling in direct compute

image_sample, image_sample_b, image_sample_c, image_gather4 and
image_get_lod no longer refuse in direct compute when the guest group
has a multiple of four threads. The guest model treats a compute quad
as four consecutive lanes (ddx from lane ^ 1, ddy from lane ^ 2), so a module
that uses implicit derivatives declares numthreads(X*Y*Z, 1, 1), where
SM 6.6 forms quads from four consecutive threads; the guest x/y/z IDs
are still rebuilt from the logical lane index (wave rank * 32 + host
lane) with the original shape.
Such a module also declares DXIL validator 1.8, which accepts
derivative operations in compute; every other module keeps 1.6.
Groups that are not a multiple of four stay refused.

New test native_compute_implicit_lod (controls, WARP, hardware):
(32,1,1), (8,4,1), (64,1,1) and (8,4,2) groups sample a three-mip
texture with implicit LOD and with image_sample_l, and compare against
the mip the guest quad selects. native_direct_container keeps its
refusal check on a six-thread group.

* compute: pin implicit-derivative group shapes and read back each operation

Document the accepted group shapes and the lane-mapping assumption in
docs/experiments/native-compute-implicit-derivatives.md.

native_compute_implicit_lod adds (4,1,1) and (12,1,1) sub-wave groups
and (96,1,1) wave32 and (128,1,1) wave64 multi-wave groups, and keeps
the 36-thread "partial final wave in multi-wave group" refusal distinct
from the 6-thread incomplete-quad refusal. It now reads back
image_sample_b (bias +1 selects the next mip, matching image_sample_l
at that LOD), image_sample_c (LESS against a depth mip chain at the
implicit LOD), image_get_lod (clamped and unclamped LOD) and
image_gather4 with a sampler fixed to mip zero (matching
image_gather4_l at LOD 0), and keeps the refusal for implicit gather
with a sampler that is not fixed to mip zero. compute_check gains a
scalar R32_FLOAT comparison case and a mip-zero static sampler for
those cases.
* compute: read a resource-heap descriptor at an added byte offset

A waterfall loop over a lane-selected heap slot forms the descriptor
address as s_add_u32 lo, <resource heap>, <offset>; s_add_u32 hi, 0,
src_scc (or s_addc_u32 hi, 0, 0); s_load_dwordx4 ..., s[lo:hi], 0x0.
The direct path refused the add as a numeric use of the heap table
("unbound numeric SGPR sN").

Track SCC as the carry of such an add and treat the load from that
exact pair as the indexed heap descriptor of the SGPR-offset form, read
under the same heap view contract. A constant offset, a high word that
is not the add's carry, SCC clobbered between the adds and an immediate
offset on the load stay refused.

Refs #3224

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: record the added heap address fixture and results

Refs #3224

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: tedin7 <[email protected]>
s_andn2_wrexec_b64 computes EXEC = S0 & ~EXEC over 64 bits, writes the
new mask to EXEC and to the destination pair, and sets SCC to
(EXEC != 0). The operand order and the destination receiving the new
mask match tools/startup/gfx2hlsl.py op_s_andn2_wrexec_b64, which models
it per lane.
In the wave64 model each host half holds both EXEC words, so the
replicated 64-bit computation reuses the SAVEEXEC path. Aligned general
SGPR pairs only; the wave32 model keeps refusing the b64 form, and
s_andn1_wrexec_b64 stays refused.

New test native_wrexec64_hardware: wave64 64- and 128-thread groups with
an explicit 64-bit EXEC, the source pair, the destination pair, SCC and
per-lane stores against expected words.

Co-authored-by: tedin7 <[email protected]>
Keep both shapes in the compute output: virtual waves finish as 64x1x1, flat compute-derivative quads as x*y*z, and the original dimensions otherwise; complete_compute_quads is set before the lane setup. Keep main's heap offset analysis and the branch's graphics/sampler descriptor branches, and take main's WREXEC validation and EXEC update path.
Author
Owner

@⁠lambirou on GitHub · 2026-11-28 03:33 UTC · original

Refreshed #3241 at 4a007912: merge of main a44e1f95 (includes 0fe4cebc, bf1bc769 and a44e1f95).

The conflicts are resolved as follows:

  • gfx1013_direct_compute.inl: complete_compute_quads is set before the lane setup, and the output keeps both shapes: virtual_waves finishes as 64x1x1, flat compute-derivative quads as x*y*z, original dimensions otherwise. The branch's exact_store/indexed gates and main's WREXEC validation/EXEC update path are both kept.
  • gfx1013_compute_native.cpp: keep the branch's Symbol types plus main's heap_offset/heap_carry, with the heap-address SMEM branch ahead of the graphics, sampler-heap and table branches.

Current-head suite, Release /O2 and Debug: 12/12 each, zero skips, including direct container/mesh, pack/frozen, interface/WQM, request cache, SALU shift64, the image cache flags and WREXEC64.

Both-shape control: native_compute_implicit_lod_controls passes; the 96-thread wave32 and 128-thread wave64 virtual-wave cases pass, as do the 1D flat cases. native_compute_implicit_lod_hardware fails only (8,4,1) on this RX 9060 XT. Unmodified main a44e1f95 fails it identically (expected=3f800000 actual=3f948000), so this is upstream in #3257 or the fixture, not the reconciliation. WARP skips because it has no 32-lane waves.

#3243 is CLEAN/MERGEABLE and approved at 4a007912; #3091 can use this head.

**@⁠lambirou** on GitHub · 2026-11-28 03:33 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3241#issuecomment-7233177324) Refreshed `#3241` at `4a007912`: merge of `main` `a44e1f95` (includes `0fe4cebc`, `bf1bc769` and `a44e1f95`). The conflicts are resolved as follows: - `gfx1013_direct_compute.inl`: `complete_compute_quads` is set before the lane setup, and the output keeps both shapes: `virtual_waves` finishes as `64x1x1`, flat compute-derivative quads as `x*y*z`, original dimensions otherwise. The branch's `exact_store`/`indexed` gates and main's WREXEC validation/EXEC update path are both kept. - `gfx1013_compute_native.cpp`: keep the branch's Symbol types plus main's `heap_offset`/`heap_carry`, with the heap-address SMEM branch ahead of the graphics, sampler-heap and table branches. Current-head suite, Release `/O2` and Debug: 12/12 each, zero skips, including direct container/mesh, pack/frozen, interface/WQM, request cache, SALU shift64, the image cache flags and WREXEC64. Both-shape control: `native_compute_implicit_lod_controls` passes; the 96-thread wave32 and 128-thread wave64 virtual-wave cases pass, as do the 1D flat cases. `native_compute_implicit_lod_hardware` fails only `(8,4,1)` on this RX 9060 XT. Unmodified `main` `a44e1f95` fails it identically (`expected=3f800000 actual=3f948000`), so this is upstream in #3257 or the fixture, not the reconciliation. WARP skips because it has no 32-lane waves. #3243 is `CLEAN/MERGEABLE` and approved at `4a007912`; #3091 can use this head.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-28 03:36 UTC · original · requested changes

The 128-thread case in native_compute_implicit_lod_check.py exercises a source-built FSSM container. The virtual-wave scheduler has a separate entry condition: a packed slot-67 request, more than one guest wave64, and a conditional branch plus a synchronizing instruction. The existing container case therefore does not cover the combination.

I rebuilt the exact 4a007912 tree and tested source-built slot-67 requests with the packed state, a table in s4, and a 128-thread group. The explicit-LOD case with a conditional branch plus barrier compiles to 64 physical threads. The ordinary implicit case compiles to 128. Adding that same branch and barrier to the implicit case also compiles on this head, with no corresponding packed-scheduler readback. A local reconciliation on dbaa010b kept the two positive cases and refused that combination at the image opcode, +0x90: implicit derivatives with virtual wave64 groups. Its independent RTX derivative, heap-offset, scalar NOT and WREXEC set passed 6/6.

Please add a packed slot-67 control for the combination. Either keep it refused as above or show its actual derivative readback against the explicit control. Please also absorb #3264's EXEC/VCC behaviors when refreshing the branch. The separately reported RX 9060 XT mismatch reproduces on unmodified main and is tracked on #3257.

**@⁠R0Y00** on GitHub · 2026-11-28 03:36 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3241#pullrequestreview-6095478148) · **requested changes** The 128-thread case in `native_compute_implicit_lod_check.py` exercises a source-built FSSM container. The virtual-wave scheduler has a separate entry condition: a packed slot-67 request, more than one guest wave64, and a conditional branch plus a synchronizing instruction. The existing container case therefore does not cover the combination. I rebuilt the exact `4a007912` tree and tested source-built slot-67 requests with the packed state, a table in s4, and a 128-thread group. The explicit-LOD case with a conditional branch plus barrier compiles to 64 physical threads. The ordinary implicit case compiles to 128. Adding that same branch and barrier to the implicit case also compiles on this head, with no corresponding packed-scheduler readback. A local reconciliation on `dbaa010b` kept the two positive cases and refused that combination at the image opcode, `+0x90: implicit derivatives with virtual wave64 groups`. Its independent RTX derivative, heap-offset, scalar NOT and WREXEC set passed 6/6. Please add a packed slot-67 control for the combination. Either keep it refused as above or show its actual derivative readback against the explicit control. Please also absorb #3264's EXEC/VCC behaviors when refreshing the branch. The separately reported RX 9060 XT mismatch reproduces on unmodified main and is tracked on #3257.
s_not_b64 and s_cselect_b64 now take VCC and EXEC as 64-bit sources in
direct compute, reading both words from the existing SALU register
slots (VCC_HI, EXEC_HI), and s_not_b64 may write EXEC through the same
pair of writes the other 64-bit SALU mask operations use. s_not_b64
writes SCC after its destination. Odd SGPRs, M0 and other special
registers stay refused, as does s_cselect_b64 into EXEC.

New test native_s_not_b64_exec (controls, hardware) covers NOT from
EXEC and VCC, CSELECT under SCC 0 and 1, and NOT into EXEC with a
per-lane store, in wave32 and wave64. native_salu64_controls refused
s_not_b64 from VCC; that control now uses EXEC_HI (127), which stays
refused.

Co-authored-by: tedin7 <[email protected]>
* startup: read translated compute inputs that live only in title memory from a snapshot, and bind unbound inputs as zeros

A compute input in a placed buffer that does not alias title memory is a committed default buffer that holds zeros, so the bytes the title wrote exist only in title memory. With X2W_TRANSLATED_TITLE_INPUT_SNAPSHOT=1 (opt-in) the range (at most 16 MiB) is copied into a dedicated upload pool (128 MiB) so draw and texture uploads cannot starve it. A compute input whose four descriptor words are all zero is an unbound buffer: it reads zeros (16 bytes) instead of refusing the dispatch; an empty range with any non-zero word is still refused. The log names the source of each input and the render totals count GPU copies and snapshots.

* fix: clear the title-input snapshot flag in the baseline runs and correct the launcher doc

* test: the long snapshot case puts its input where the buffer does not alias title memory, and asserts the snapshot log line

---------

Co-authored-by: c1 <[email protected]>
Co-authored-by: lewisalex86 <[email protected]>
* compute: name why a compiled program gets no runtime manifest

Each refusal in format_compute_runtime_manifest now returns a fixed
reason. compile_dxil --requests writes it to <key>.fail beside the
published .cs.cso, --watch writes it instead of the reasonless line,
--refusals counts it, and triage_run.py reports it as an allowlisted
category. Accepted manifests and published files are unchanged.

Refs #3224

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* compute: keep the --requests manifest reason out of .fail

A program that compiles but gets no runtime manifest is not a failed
request: .fail is the retry marker of both watchers, and with
--skip-failed the Python watcher stopped selecting such a key in a live
cache (review of #3268). --requests now removes .fail as before and
prints the reason in the job report as no_manifest input=... <reason>.
--watch, which refuses the key, still writes the reason to its .fail.

The end-to-end check runs --requests in a live cache beside a genuine
refusal and checks both pending_keys selections, plus the --watch case.

Refs #3224

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Absorb #3262's scalar64 source validation for s_cselect_b64 and s_not_b64, including VCC and EXEC sources, while keeping the branch's direct-compute paths.
A packed slot-67 group with more than one guest wave64 enters the virtual-wave scheduler only when it also has a conditional branch and a synchronizing instruction. Implicit derivatives have no packed-scheduler readback, so refuse them at the image opcode instead of compiling a shader whose guest quads cannot be reconstructed.

Add native_wave_virtual_derivative_controls: source-built packed slot-67 requests where explicit LOD with a branch and barrier and ordinary implicit both compile, and the combination is refused.
Author
Owner

@⁠lambirou on GitHub · 2026-11-28 03:50 UTC · original

Refreshed #3241 at cd746f6a: merge of main a166a753, which includes #3264.

Packed virtual-wave control. native_wave_virtual_derivative_controls builds source-built packed slot-67 requests with a table in s4 and a 128-thread group. Explicit LOD with a conditional branch and barrier compiles; ordinary implicit compiles; the combination is refused at the image opcode with implicit derivatives with virtual wave64 groups. The code refuses at the implicit && !pixel_stage check when virtual_waves is active, before any shader is published.

#3262 absorbed. s_cselect_b64 and s_not_b64 now use main's scalar64 source validation, so VCC and EXEC are accepted as 64-bit sources while the branch's direct-compute paths stay intact.

Release /O2 and Debug each pass 13/13, zero skips: the 12 current-head checks plus native_wave_virtual_derivative_controls. native_compute_implicit_lod_controls and the 96/128 cases still pass. The (8,4,1) RX 9060 XT mismatch remains upstream #3257; it reproduces on unmodified main a44e1f95 with the same value.

#3241 is CLEAN/MERGEABLE at cd746f6a. Please re-review.

**@⁠lambirou** on GitHub · 2026-11-28 03:50 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3241#issuecomment-7233433314) Refreshed `#3241` at `cd746f6a`: merge of `main` `a166a753`, which includes #3264. **Packed virtual-wave control.** `native_wave_virtual_derivative_controls` builds source-built packed slot-67 requests with a table in s4 and a 128-thread group. Explicit LOD with a conditional branch and barrier compiles; ordinary implicit compiles; the combination is refused at the image opcode with `implicit derivatives with virtual wave64 groups`. The code refuses at the `implicit && !pixel_stage` check when `virtual_waves` is active, before any shader is published. **#3262 absorbed.** `s_cselect_b64` and `s_not_b64` now use main's `scalar64` source validation, so VCC and EXEC are accepted as 64-bit sources while the branch's direct-compute paths stay intact. Release `/O2` and Debug each pass 13/13, zero skips: the 12 current-head checks plus `native_wave_virtual_derivative_controls`. `native_compute_implicit_lod_controls` and the 96/128 cases still pass. The `(8,4,1)` RX 9060 XT mismatch remains upstream #3257; it reproduces on unmodified main `a44e1f95` with the same value. `#3241` is `CLEAN/MERGEABLE` at `cd746f6a`. Please re-review.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-28 03:56 UTC · original · approved these changes

This revision addresses the packed-dispatch finding. I rebuilt cd746f6a (tree 0bba0986) and obtained 2/2 passes in Release /O2:

ctest --preset release --no-tests=error --output-on-failure -j 1 -R '^(native_wave_virtual_derivative_controls|native_s_not_b64_exec_controls)$'

The virtual scheduler's explicit-LOD case and the ordinary implicit case still compile. Their combined packed-state case refuses the image instruction before emitting a shader. The EXEC/VCC scalar controls pass against the same executable. Windows 11 26200.9974, MSVC x64 19.51, SDK/DXC 10.0.26100.0.

This is an approval of the published refresh head and its fix. #3091 still needs the published branch update, current-main integration and hosted Windows check. The independent AMD discrepancy remains tracked at #3257.

**@⁠R0Y00** on GitHub · 2026-11-28 03:56 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3241#pullrequestreview-6095608427) · **approved these changes** This revision addresses the packed-dispatch finding. I rebuilt `cd746f6a` (tree `0bba0986`) and obtained 2/2 passes in Release /O2: ```powershell ctest --preset release --no-tests=error --output-on-failure -j 1 -R '^(native_wave_virtual_derivative_controls|native_s_not_b64_exec_controls)$' ``` The virtual scheduler's explicit-LOD case and the ordinary implicit case still compile. Their combined packed-state case refuses the image instruction before emitting a shader. The EXEC/VCC scalar controls pass against the same executable. Windows 11 26200.9974, MSVC x64 19.51, SDK/DXC 10.0.26100.0. This is an approval of the published refresh head and its fix. #3091 still needs the published branch update, current-main integration and hosted Windows check. The independent AMD discrepancy remains tracked at #3257.
Author
Owner

@⁠JohnConnorNPC on GitHub · 2026-11-28 07:33 UTC · original

Thanks for working through both change requests. cf19be36 moves the sa[18] read after validate_compute_request_shape, cd746f6a refuses implicit derivatives in virtual wave64 groups, and the review list (gh api repos/R0Y00/Xbox2Windows/pulls/3241/reviews) shows APPROVED at cd746f6a.

The base moved after that approval. #3140 landed on codex/native-shader-modules at 0b505c1c, and the branch no longer merges: git merge-tree --write-tree 0b505c1c cd746f6a → rc=1, CONFLICT (content): Merge conflict in tools/startup/compile_dxil.cpp.

Could you merge the current base and push? I think is_stale resolves like this:

  • keep the base's bool sidecar_changed = false; and if (has_manifest && !sidecar_changed) {;
  • keep this branch's if (req.compute) { ... x2w::native_compute_output(manifest) ... } block inside that if;
  • drop the auto-merged lost = !psin_mtime.has_value() && fs::is_regular_file(psdep_path, ec); line. With the base's declarations lost no longer exists, so the merged file would not compile.
    After that, re-running native_compile_dxil_watch* from #3140 along with this PR's 13 tests would cover both sides.

Two smaller points, neither a blocker:

  • The CR1 fixture does not pin the fix. struct.pack("<6I", ...) is 24 bytes, so sa[18] is in range. With the old order the request still fails with compute state block A is not 28 bytes and the test stays green. A state A of 16 bytes or fewer would turn the reverted order into an out-of-range std::string read, which Debug iterator checks abort on. This is from reading the code: I did not build that mutant.
  • git grep -E 'virtual wave64 groups|native_wave_virtual_derivative' cd746f6a -- docs README.md finds nothing. One line in docs/experiments/native-compute-implicit-derivatives.md would document the new refusal.

This comment was AI-assisted.

**@⁠JohnConnorNPC** on GitHub · 2026-11-28 07:33 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3241#issuecomment-7236020428) Thanks for working through both change requests. cf19be36 moves the `sa[18]` read after `validate_compute_request_shape`, cd746f6a refuses implicit derivatives in virtual wave64 groups, and the review list (`gh api repos/R0Y00/Xbox2Windows/pulls/3241/reviews`) shows APPROVED at cd746f6a. The base moved after that approval. #3140 landed on `codex/native-shader-modules` at 0b505c1c, and the branch no longer merges: `git merge-tree --write-tree 0b505c1c cd746f6a` → rc=1, `CONFLICT (content): Merge conflict in tools/startup/compile_dxil.cpp`. Could you merge the current base and push? I think `is_stale` resolves like this: - keep the base's `bool sidecar_changed = false;` and `if (has_manifest && !sidecar_changed) {`; - keep this branch's `if (req.compute) { ... x2w::native_compute_output(manifest) ... }` block inside that `if`; - drop the auto-merged `lost = !psin_mtime.has_value() && fs::is_regular_file(psdep_path, ec);` line. With the base's declarations `lost` no longer exists, so the merged file would not compile. After that, re-running `native_compile_dxil_watch*` from #3140 along with this PR's 13 tests would cover both sides. Two smaller points, neither a blocker: - The CR1 fixture does not pin the fix. `struct.pack("<6I", ...)` is 24 bytes, so `sa[18]` is in range. With the old order the request still fails with `compute state block A is not 28 bytes` and the test stays green. A state A of 16 bytes or fewer would turn the reverted order into an out-of-range `std::string` read, which Debug iterator checks abort on. This is from reading the code: I did not build that mutant. - `git grep -E 'virtual wave64 groups|native_wave_virtual_derivative' cd746f6a -- docs README.md` finds nothing. One line in `docs/experiments/native-compute-implicit-derivatives.md` would document the new refusal. This comment was AI-assisted.
A Texture3D description in the 4 KiB standard layout with one mip and an uncompressed format is now detiled from its thick blocks (GFX10_SW_4K_S3_PATINFO rows) instead of refused. The XG-size hold counts a volume as one slice, since its footprints already span every depth layer.
A Texture3D description in the 4 KiB standard layout with a mip chain is now detiled instead of refused. Each layer of thick blocks holds that layer of every mip: the shared tail block, then the mips from the smallest to the largest, with the tail mips at the origins addrlib gives them. The mip-count check counts a volume's depth.
A Texture3D description in 0x105 with a BC1 to BC7 format was refused as
unsupported_description. addrlib rounds the texel width and height of a
block-compressed surface up to whole 4x4 blocks before laying it out and
does not divide the depth, so a BC volume takes the thick layout of the
volume of its blocks. Layout::thick now sizes the mips, the tail and the
blocks from those element sides.

startup_gfx10_volume checks two BC volumes against the volumes of their
blocks and round-trips seven more; the new bc control sizes them by
texels and must fail. The addrlib run compares 501 volumes (13,205,290
addresses, 0 mismatches), and startup_address_console draws three BC1
volume mips. startup_gfx10_layout's two BC-volume refusals now use
0x109, which stays refused.
Main now holds the volume mip chain change as a squashed commit; its files
replace the old copies here and only the block-compressed volume change remains.
DXC sets shader flag 0x8000 when the declared UAV ranges add up to more
than 8 slots, and the validator refuses a module whose declared flags
differ ("Flags must match usage"). DxilModule::finish_compute now sums the
UAV range sizes of its resource records and sets the flag, so it covers
every direct compute and graphics module.

New test native_uav_slots_controls: two source-built compute containers
store to 8 and 9 buffer descriptors from one table. Both must compile and
validate, and compile_dxil must report 8 and 9 UAV bindings. The 8-UAV
case is the negative control (the flag must stay clear); the 9-UAV case
fails validation before this change (declared 0x80010, actual 0x88010).

Co-authored-by: Claude Opus 5.5 <[email protected]>
* compute: lower binary16 v_rcp_f16, v_sqrt_f16 and v_exp_f16

The direct compute path lowered the binary16 VOP2 ALU ops only. The
three VOP1 ops now take the same route, plain and SDWA: the selected
half is widened with legacyF16ToF32, the f32 op is applied (fdiv 1.0,
dx.op Sqrt, dx.op Exp), and the result is rounded to binary16 with the
nearest-even conversion v_cvt_f16_f32 uses, keeping D[31:16] or placing
it per SDWA dst_sel. The same MODE contract applies. v_rsq_f16 and
v_log_f16 stay refused.

native_f16_alu and native_sdwa_f16 check the three ops against
f16_packed_model: rcp and sqrt bit-exact, exp within one binary16 ULP,
NaN by class.

AI-assisted.

* compute: lower binary16 v_rsq_f16 and v_log_f16

Extends the binary16 VOP1 lowering to v_rsq_f16 (dx.op Rsqrt) and
v_log_f16 (dx.op Log, base 2), plain and SDWA, with the same widen, f32
op and nearest-even rounding. The special results are selected from the
f16 input bits, because the D3D contract does not fix them: a negative nonzero
input (including -inf) or NaN gives a quiet NaN, rsq(+-0) is +-inf, rsq(+inf) is +0,
log(+-0) is -inf, log(+inf) is +inf and log(1) is +0.

The f16 checks compare rsq and log within one binary16 ULP, the special
results exactly and NaN by class.

AI-assisted.

* compute: bound binary16 exp and rsq rounding, keep log refused

exp: the binary32 exp2 result is rounded to binary16 as before, then
the 70 inputs whose exact result lies closer than 8 binary32 ULP to a
binary16 rounding midpoint take their correctly rounded value from a
table. 8 ULP covers the documented D3D exp relative error of 2^-21.
tests/f16_exp_midpoints.py regenerates the table from a 90-digit
reference and checks the C++ array. The exact tie exp2(-25) rounds to
+0. exp results are now compared bit for bit.

rsq: the documented relative error of 2^-21 is at most 2^-10 of a
binary16 ULP, so the result stays within 0.5 + 2^-10 < 0.51 ULP. The
test requires the correctly rounded value, and accepts the other
neighbouring encoding only within 8 binary32 ULP of a midpoint.

log: v_log_f16 is refused again, as on main. Its documented absolute
error of 2^-21 on [0.5, 2] can exceed 0.51 binary16 ULP near 1.

AI-assisted.
* startup: lower cube image sampling in gfx2hlsl (#2943)

image_sample, image_sample_lz, image_sample_l and image_sample_b on
dim:SQ_RSRC_IMG_CUBE now lower to TextureCube<float4>, with the
manifest kind texcube. The gfx10 address (s, t, face), where
s = sc/|ma| + 1.5 (Mesa prepare_cube_coords) and ma is twice the major
coordinate (LLVM ConstantFoldAMDGCNCubeIntrinsic), is rebuilt into a
direction by an emitted helper x2w_cube_dir. Cube loads, image_sample_d,
image_get_lod, a16, d16, compute stages and constant samplers with
DISABLE_CUBE_WRAP stay refused by name.

offscreen_check --startup-image-cube binds six 2x2 faces as a
TextureCube. tests/startup_image_cube_check.py draws literal face
addresses against the address meaning, 13 helper mutants, guest-input
controls and the v_cube chain per face against a desktop TextureCube
draw. The cube cases of the sample_l and sample_b checks change from
refusal to acceptance; the 3D check's unverified-dimension case moves
to MSAA, since the same words now form a valid cube sample.

The runtime binding of texcube views is #2938; this must land after it.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: note #2938 runtime cube binding landed on main

AI-assisted.

* tests: test cube coordinate scale factor with 4x4 faces (#2943)

Switch --startup-image-cube to six 4x4 faces (96 distinct texels) with outer-ring texel centers so dropping the 2.0 * scale on u or v shifts texels on both WARP and hardware, add scale-2 translator mutants and controls, and clarify that clamping outside [1, 2] is an untested assumption.

AI-assisted.

---------

Co-authored-by: legacy-code-archaeologist <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
* startup: hold other threads while a hook steps over its byte

Two threads entering the same hooked function could run through the step-over window untraced. The debugger now holds every other thread for the step, defers a hit that trapped before the hold, bounds each window with a deadline and always reports how many windows were unprotected.

* startup: keep a second stepping thread from taking over an open hook window

A thread that was not held no longer raises when it steps at another hook: the open window stays with its owner and is reported as exposed. Only a held thread is deferred.

* startup: trace a hooked call once when its entry traps twice

With the step window off, another thread can re-patch the hook byte before the stepping thread runs the original instruction, so the thread traps again at the same address and stack slot. The call was registered twice and its return wrote two lines (88 traces for 64 opens). Pending returns are now keyed by thread and slot, and the control counts lost opens as max(0, 64 - traced). The overlap probe uses four threads with a spin barrier.

* startup: count a thread that already exited as gone when holding the others

A thread that has called ExitThread stays in the debugger's thread list until its exit event is read. OpenThread still works on it but SuspendThread and GetThreadContext fail with access denied, and the window counted that as an unprotected window although the thread runs no code. A hold that fails is now classified after the failure: GONE when GetExitCodeThread is not STILL_ACTIVE (or the handle is already signaled), FAILED when the thread is alive. The decision is a pure function in hook_window.py checked by startup_hook_window.

Refs #1281

* startup: preserve tail-called hook returns and clarify unprotected count

* startup: treat STATUS_THREAD_IS_TERMINATING from NtSuspendThread as gone; reuse the debug event's thread handle

Thanks @RenzoWit35 for the Win11 26300 finding.

* tests: show the debugger's exit code and stderr when the hook summary is missing

* startup: do not shadow the ntdll module used for NtSuspendThread

* startup: map a console package drive letter to a real folder

A console executable opens its package at a fixed drive letter, so a package on another volume never
mounts: the first open returns "not found", nothing is mounted, and the run stops within a second on
a table sized from data that was never loaded. subst does not help when the letter is already a real
volume.

tools/startup/debug_launch.py --map-drive LETTER=FOLDER[;...], exposed as run.ps1 -MapDrive, rewrites
the path of an open on a mapped letter to the real folder, in the caller's own path structure and
inside the file hooks the launcher already installs for tracing. The rewrite keeps the device prefix,
and because the replacement is usually longer than the buffer the caller allocated (a folder path
against a single letter), the new name is allocated in the process and the UNICODE_STRING is
repointed at it. Each rewrite is logged as a MAP line and appears in files.txt.

Covered by startup_map_drive (tests/startup_map_drive_check.py with a source-built consumer): the
rewrite makes an open on a letter that is not a volume succeed and read its content, the same open
fails without the option, and an open on a letter that is not mapped is left alone. Measured on
Windows 11 build 26200, where the mapped letter does not exist as a volume.

Documented in docs/startup-runtime.md under the run instructions, including the two limits (only
opens through the installed file hooks are rewritten, and the replacement allocation is left to the
process).

* startup: fix the drive rewrite for root-relative opens

Review of #1251 found that map_drive() looked for a "] " separator, but oa_name() formats a
root-relative name as "[root 0x...]" + text with no space. So a root-relative open was never
rewritten, and had the separator matched, the synthetic "[root 0x...]" display tag would have been
written into the caller's UNICODE_STRING and corrupted the kernel string.

The tag is now drained by finding "]" and dropped: it is only a label for the log, so it never takes
part in the rewrite.

Three smaller points from the same review:

- The "\\\\?\\" Win32 long-path prefix is matched alongside the "\\??\\" and "\\\\.\\" device
  prefixes.
- Mapping letters are ASCII A-Z. isalpha() alone also accepts non-ASCII letters, which no NT path
  has.
- A replacement longer than 0xFFFF bytes is refused, because a UNICODE_STRING length is a USHORT and
  the name could not be expressed at all.

The root-relative case is not covered by startup_map_drive yet: CreateFileW builds the object name
without a RootDirectory, so the fixture never produces the "[root ...]" form. A direct NtCreateFile
consumer would be needed to exercise it; the separator and the tag handling are the code that
changed.

* startup: borrow the mapped name only for the hooked call

Addresses the review of #1251. The rewrite changed the caller's name permanently: in the short case
it overwrote the caller's own buffer, and in the long case it repointed the caller's UNICODE_STRING at
a fresh VirtualAllocEx that nothing released, including after a failed write. A caller that opens with
the same UNICODE_STRING twice, or that reads it after the call, saw the rewritten name.

The name is now temporary to the call. The entry trace records what the caller's UNICODE_STRING held,
and the existing return boundary restores it — length, buffer pointer and contents — before anything
else runs, so a failure or a retry sees the name it built. The offline deny path also runs before the
rewrite, so a refused call never borrows the name at all.

The long case writes into one backing allocation that is grown on demand and reused, so the number of
name allocations does not follow the number of opens, and a failed write after growth leaves the
caller's string untouched.

Covered by a new fixture mode: the source-built consumer builds one UNICODE_STRING whose buffer is
exactly the caller's size, calls NtCreateFile through the mapped letter 32 times, and checks its
length, buffer pointer and contents after every return, while the trace must show a single name
allocation.

Measured, Windows 11 build 26200, release preset:

  mapped letter Z: ok ('read 9 bytes: mapped ok')
  negative control without the option: ok ('open failed: 3')
  unmapped letter C: ok
  reused caller name over 32 opens: ok (name allocations=1, rewrites=32)

Mutation control: with the restore removed the same case fails at the first open with
"caller name changed after open 0: length=136 maximum=136 buffer_moved=1", so the check does detect a
name that is not given back.

* startup: keep the mapped name per call and report a dropped-hook limit

Addresses the second review of #1251.

The backing buffer is no longer one process-wide allocation. Each hooked call borrows a buffer for the
duration of that call and returns it to a pool when the caller's name is restored, so two calls that
overlap on different threads cannot overwrite or free each other's name, while a serial run still
reuses one buffer (the 32-open case stays at one name allocation).

`restore` is now initialised before the trace-kind dispatch. It was assigned inside the file-name
branch only, and the common "if desc:" below serves every kind, so a count, runtime or bink trace could
see an unbound name or, worse, carry over the previous call's callback and restore a different call's
string.

The two-thread overlap control the review asked for is added, and it found a separate, larger problem
that is not in this change: the launcher's entry hooks are one patched byte per function, so a thread
that enters the same hooked function while another is being stepped over runs untraced. Measured with
the source-built consumer, 32 opens per thread:

  two threads, no mapping, real file through its own letter: 64/64 opens succeed
  two threads, --map-drive:                                 40/64 opens traced and rewritten (46/64 on a repeat)

Without mapping the same pattern is 64/64, so the loss is the hook dropping concurrent hits, not the
consumer or the file system. It affects file tracing and the offline socket deny as well as this
rewrite, so it is filed as #1281 rather than worked around here. `startup_map_drive_overlap` holds the
control as an expected failure (CTest WILL_FAIL) so it is visible and documented, and will start
failing the suite once the hook stops dropping calls — which is the signal to make it a normal gate.

Measured, Windows 11 build 26200, release preset:

  mapped letter Z: ok ('read 9 bytes: mapped ok')
  negative control without the option: ok ('open failed: 3')
  unmapped letter C: ok
  reused caller name over 32 opens: ok (name allocations=1, rewrites=32)
  startup_map_drive: Passed
  startup_map_drive_overlap: Passed (expected failure: traced 46 of 64)

Mutation controls: with the buffer forced back to a single shared one the overlap case reports one
name allocation instead of two, and with the restore removed the serial case fails at the first open
with "caller name changed after open 0".

* fix: ask the return book whether a call is pending instead of dict.get

The hook window replaced the returns dict with ReturnBook; the hit-limit release still called returns.get(addr), which the class does not have.

* fix: keep one file_log so X2W_LOG_AT writes to files.txt

The merge left a second file_log assignment that opened files.txt only when tracing, overriding the main definition that also opens it for X2W_LOG_AT. startup_debug_log then failed with a None log.

* ReturnBook: run a call's restore callback when it returns

A hooked call may change its arguments for the call only (a mapped drive name). The book now keeps an optional restore per call and runs it once on the return, so the caller's state is back before anything else runs; a re-trap of the same call keeps the first restore.

* test: the two overlap threads open different mapped files of different lengths

A name buffer shared between calls in flight now hands one thread the other's name or a cut-off one, so the case fails for it: each thread checks the file it actually opened (GetFinalPathNameByHandleW) and the check counts 32 mapped opens per file.

---------

Co-authored-by: tedin7 <[email protected]>
Co-authored-by: c1 <[email protected]>
Co-authored-by: sm5 <sm5@x>
Co-authored-by: lewisalex86 <[email protected]>
* compute: lower v_dot4c_i32_i8 in direct compute

VOP2 v_dot4c_i32_i8 (opcode 0x0d) adds the signed byte dot product of
src0 and src1 to the destination, which is also the accumulator:
D = D + sum(sext(S0.byte[k]) * sext(S1.byte[k])), modulo 2^32, as
tools/pixel_aot.py models dpp_dot4c_i32_i8. It reuses the packed-byte
dot lowering with src2 = D. Literal, SGPR, inline and VGPR src0 are
accepted; DPP, SDWA, VOP3 and modifiers stay refused.

New test native_dot4c (IR and hardware): literal, SGPR with a sparse
EXEC (inactive lanes keep D), inline -1 and a VGPR aliasing the
destination, with wrapping below INT32_MIN, plus DPP and SDWA refusal
controls.

* docs: describe the VOP2 v_dot4c_i32_i8 form next to the packed dots

native-packed-dot4 now covers the accepted VOP2 dot-accumulate form,
its refusals (VOP3, modifiers, DPP, SDWA) and the native_dot4c
reproduction command.

AI-assisted.
* compute: accept GLC, DLC and SLC on raw buffer loads in direct compute

The cache-policy bits GLC (word 0 bit 14), DLC (word 0 bit 15) and SLC
(word 1 bit 22) no longer refuse a raw buffer_load in the direct
compute decoder; they do not change the loaded value, as
tools/startup/gfx2hlsl.py already treats them for MUBUF loads. DXIL
globallycoherent is not modelled. LDS, TFE, IDXEN and the other
modifiers stay refused, and stores and atomics keep their masks.

New test native_raw_load_cache_bits_hardware: OFFEN with GLC+DLC, a
scalar offset with GLC+DLC and OFFEN with SLC read back against a CPU
reference, with LDS and TFE refusal controls. The two refusal cases for
GLC and SLC in native_global_srv_heap_replay_check.py are retired.

* compute: accept GLC, DLC and SLC on raw buffer stores in direct compute

Direct compute raw stores accept and ignore the GLC, DLC and SLC
cache-policy bits, as raw loads now do; graphics keeps its mask. IDXEN,
LDS, TFE and the other bits stay refused.

New tests native_raw_store_cache_bits_controls and _hardware: dword and
dwordx4 OFFEN stores with GLC, a dword with DLC and a dwordx4 with SLC
read back against expected words, plus IDXEN, LDS and TFE refusals.
* docs: close an open code fence in experiments.md

The cpu_native_acphal_hal example block had no closing fence, so the
ApuFree section after it, and the text up to the next bare fence, rendered
as code and their links were not checked.

* gh #1145 atom 1: count XMA context and XApu command activity in the stand-ins

Opt-in with X2W_AUDIO_ACTIVITY=1. AcpHal watches the XMA context array it
allocates and counts contexts filled, changed and cleared, plus HAL slot2
submits by type; xapu counts XApuEnqueueCommand calls by command class with
no cap. Each DLL logs a line per second when a count moved and has an
experimental export with the totals. Off, nothing runs.

* gh #1145 atom 2: add startup_acphal_xma_activity

A source-built caller fills, changes and clears XMA contexts, submits HAL
commands and enqueues XApu commands. The on case checks the exact counts
from the exports and the logged lines, and that a freed and reused array
is no longer counted; the none case writes only next to the contexts and
must count 0; the off case reports nothing. Results, outputs, last errors
and context bytes must match with the counter on and off.

* gh #1145 atom 3: document the audio activity counter

Adds the X2W_AUDIO_ACTIVITY switch, an Activity counter section under the
APU heap stand-in with the line formats and limits, and an experiments
entry with the reproduction command for startup_acphal_xma_activity.

* gh #1145 review round 1: assert block reuse, share expectations, fit CTest timeout

The on and off cases now check that ApuAlloc of the same size returns the
freed context block, so the not-counted-after-reuse check cannot pass on
some other block. expect_on() replaces the repeated on/off expectation
lists without changing them. Each case waits 15 s, so all three fit in
the 60 s CTest timeout.

* gh #1145 review round 2107-1: observe activity inside calls, no sampler threads; add unload case

* gh #1145 review round 2107-2: start the line interval at the last written line; fix comments

* audio: count unreadable XApu commands on the early E_POINTER path

main's XApuEnqueueCommand now refuses a null or unreadable command header
with E_POINTER before the activity counter runs, so the unreadable count
never moved. Count those calls as unreadable on that path. A call refused
for a full ring (E_OUTOFMEMORY) is still counted by its command class.

* gh #1145 rebase: give the fixture's XApuConnect a nonzero buffer size

XApuConnect now refuses a size of 0 at input +0x0C (#2288), so the fixture's
commands all landed on an unknown handle.

* audio: count the short decode command that XApuEnqueueCommand refuses before the queue

In an X2W_WITH_OPUS build with typed completions, a type 3 command too short
to decode returned E_POINTER before count_command. Count it by its class, as
the other E_POINTER refusals after the header read are, and pin it in
startup_acphal_xma_activity with a type 3 header that ends where free address
space begins (X2W_PROBE_PRECHECK=1 refuses the tail without a fault).

---------

Co-authored-by: lewisalex86 <[email protected]>
Fixes #3249

Refs #2935, #3005

AI-assisted.

Co-authored-by: legacy-code-archaeologist <[email protected]>
Direct wave64 compute now gives scalar loads the same SGPR bound as
wave32 since #3180: destination ranges may end at s107 (VCC_HI), and
VCC_LO/VCC_HI may be the SGPR offset. In the direct wave64 model VCC
is two scalar words that both host wave32 halves hold identically
(ballot writers publish both words through the exchange), so a
uniform numeric load into s106/s107 is read back the same way by
s_mov, v_cndmask and the VCC branches. Table descriptor loads and
resource-heap loads at an added byte offset (#3253), which track
descriptor identity or a slot index instead of payload bits, still
refuse when their destination overlaps VCC in wave64. Graphics and ranges past
s107 keep their refusals.

New test native_smem_vcc_wave64 (controls, hardware): x4 and x8 loads
ending at s107, VCC_LO and VCC_HI offsets, and a 64-bit mask loaded
into VCC driving v_cndmask in both host halves under a patterned EXEC.
native_direct_container replaces the wave64 VCC refusals it had with a
symbolic-destination refusal.

native_heap_offset_add gains a wave64 control: an added-offset heap
address loaded into s[104:107] refuses with the overlap message.
Fixes #3252

Refs #2935

AI-assisted.

Co-authored-by: legacy-code-archaeologist <[email protected]>
Lower plain VOP2 v_dot2c_f32_f16 (0x02) via the shared binary16 dot2 lowering (op_sel=0, op_sel_hi=3, accumulator in vdst) with binary32 subnormal preservation and full 0x8000ffu mode tracking, and add IR, DXIL control, Compute, and Pixel tests.

Fixes #3256, Refs #2935. AI-assisted.

Co-authored-by: legacy-code-archaeologist <[email protected]>
Co-authored-by: lewisalex86 <[email protected]>
Co-authored-by: R0D4X <[email protected]>
Lower plain VOP2 v_pk_fmac_f16 (0x3c) through the shared packed binary16 path using fused_half_rne with accumulator read from vdst under the 0x8000ccu mode contract, update the stale negative control in native_f16_alu_check.py, and add IR/DXIL/Pixel/Compute coverage.

Fixes #3258, Refs #2935, #3224. AI-assisted.

Co-authored-by: legacy-code-archaeologist <[email protected]>
* compute: lower more typed 2D image atomics in direct compute

The direct compute typed 2D image atomic path of #3162 (cmpswap, add,
umax) now also lowers image_atomic_swap, _umin, _and, _or and _xor to
DXIL AtomicBinOp Exchange, UMin, And, Or and Xor on the same
RWTexture2D<uint> binding, with the same operand checks, EXEC guard and
GLC return of the old value. image_atomic_smin and _smax stay refused,
because signed min/max is not verified on this R32_UINT binding; sub,
inc, dec and the float atomics stay refused too.

New test native_image_atomic_binops (controls, WARP, hardware) reuses
the #3162 fixture: each new op compiles to atomicBinOp with its code,
the operand refusals still apply, and the refused ops keep "direct
image opcode or descriptor modifiers". The readback covers distinct and
contended texels, GLC on and off, and a sparse EXEC.

AI-assisted.

* docs: list the new typed 2D image atomics

native-image-atomics now lists swap, umin, and, or and xor with their
AtomicBinOp codes, keeps signed min/max outside the verified scope, and
links the binary-operation fixture.

AI-assisted.
* tooling: add --assert-sites to the startup debugger

--continue-asserts N counts hits, so a soft assert that repeats runs the budget out and long runs need ever larger values. --assert-sites N steps over every hit at up to N distinct main-image int3 sites and stops at the first hit of one more site. run.ps1 -AssertSites and run.sh --assert-sites pass it through with 0 as the default.

* tooling: keep the two assert budgets apart

Both budgets read asserts_seen, so a site the hit budget continued also
filled a slot of the site budget. With hits A, B, A and --assert-sites 1
--continue-asserts 2, A and B continued and A's second hit stopped the
run. Keep the sites the site budget admits in their own set and count
only the hits the hit budget covers.

Test: the probe can revisit its first breakpoint
(STARTUP_DEBUG_PROBE_REVISIT=1); A, B, A with both budgets now runs to
the end, and the control with the hit budget alone stops at A's second
hit.

---------

Co-authored-by: tedin7 <[email protected]>
* startup: confirm command list slots from the 261000 table

The GXDK 261000 ID3D12GraphicsCommandList8 table confirms the command-list order: Reset and ClearState at 10-11, the query methods at 28-30, SetPredication at 31, the desktop marker methods at 56-58, ExecuteIndirect at 61 and the console reset at 139. It also confirms AllocateFromCommandAllocatorX at 148.

Name the confirmed public methods and fix the query comments. The console-only rows stay outside the repository. Tests: startup_command_list_slot_names, startup_list_queries_warp and startup_list_queries_default_warp_control.

* startup: name the confirmed command list table

The query comment still cited ID3D12GraphicsCommandList6; the extracted 261000 table is GraphicsCommandList8.

* docs: align the query slot table with the confirmed slots

Keep the query bindings diagnostic while naming the confirmed methods. Leave the allocator page-size note to the xmem change.
* runtime: decode the 261000 xmem attribute layout

The GDK 261000 XALLOC_ATTRIBUTES layout has objectType:14, pageSize:2, allocatorId:8, alignment:5, memoryType:4, an address-below-4-GiB bit at 33 and 30 reserved bits above it. Page size 2 is 2 MiB, not 4 MiB.

Separate the address bit from the reserved field and refuse a below-4-GiB request explicitly until the allocator can honor it. Tests: era_heap_decode_fields, era_heap_failure and the other era_heap scenarios (10/10).

* docs: update the Era heap layout for the 261000 table

Record the 2 MiB page-size value, the address-below-4-GiB bit at 33 and the 30 reserved bits at 34-63. Scope the older observed words to the zeros they measured and note that a below-4-GiB request still returns null.

* runtime: note the two-MiB xmem page in the resource path

Page size 2 is 2 MiB. This comment belongs with the XALLOC_ATTRIBUTES change rather than the command-list slot names.

* docs: distinguish the 261000 layout from the SlimEra baseline

Describe the current 261000 decoder, keep the older SlimEra observations scoped to their historical layout, include the below-4-GiB refusal, and replace the incorrect bit-34 mutation sentence.
* shader: support neg_lo, neg_hi, and clamp on v_pk_min/max_f16 (#3261)

Admit VOP3P NEG_LO[1:0], NEG_HI[1:0], and CLAMP on v_pk_min_f16 and v_pk_max_f16 in DirectCompute::packed_minmax() while keeping third-operand/reserved modifier bits and integer packed min/max clamp/negation refused, and extend native_packed_minmax_check.py with modifier compute/pixel/control tests.

Fixes #3261, Refs #2935, #3224. AI-assisted.

* docs: document neg_lo/neg_hi/clamp support on v_pk_min/max_f16

Clarify FP16-only neg_lo[1:0], neg_hi[1:0], and clamp semantics, preserved integer/reserved-bit refusals, and extended MOD_CASES/Pixel coverage in native-packed-minmax.md. Refs #3261, #2935, #3224. AI-assisted.

---------

Co-authored-by: legacy-code-archaeologist <[email protected]>
* shader: lower v_fract_f16 in direct Compute and Pixel DXIL (#3267)

Lower VOP1 (0x5f) and VOP3 (0x1df) v_fract_f16 in DirectCompute::float_alu() with abs/neg/clamp/op_sel[0]/op_sel[3], exact binary16 min(x - floor(x), 0x3bff) clamping tiny negative fractions to 0x3bff, non-finite +-Inf/NaN -> 0x7e00 (+0.0 under clamp), destination other-half preservation, 0x8000ccu mode gate, and IR/DXIL/Pixel/Compute coverage.

Fixes #3267, Refs #2935. AI-assisted.

* docs,test: document v_fract_f16 and expand rounding/modifier cases

Add docs/experiments/native-fract-f16.md and update tests/native_fract_f16_check.py (32 cases): fix tiny negative encodings (0x9000, 0x8C00), add RNE-vs-truncation discriminators (0x9500, 0x9480), split abs/neg, add finite clamp=1 cases, split op_sel[0] and op_sel[3] cases with nonzero high halves, and enforce the 32-word per-lane compute buffer limit. Refs #3267, #2935. AI-assisted.

---------

Co-authored-by: legacy-code-archaeologist <[email protected]>
* tooling: parse GDK MSVC class layouts

* tooling: keep print-only ABI probes to size facts
Match the established fract32 bound from the Python translators in the newer direct DXIL lowering. Preserve NaNs and apply the cap before output modifiers. Refs #267, #2010.
Lower VOP1 (0x63/0x64) and VOP3 (0x1e3/0x1e4) v_cvt_norm_i16_f16 and v_cvt_norm_u16_f16 in DirectCompute::float_alu() using exact 32-bit integer round-to-nearest-even arithmetic (matching pixel_aot::f16_cvt_norm_result), sharing unary half-source decode/destination-half merge with v_fract_f16, enforcing the 0x8000ccu binary16 mode gate, and adding IR/DXIL/WARP/hardware tests plus native-cvt-norm-f16.md. Fixes #3291, Refs #2935. AI-assisted.
* tooling: extract GDK MSBuild platform profiles

* tooling: use the selected SDK for platform paths
Admit VOP3P CLAMP on v_pk_add_f16, v_pk_mul_f16, and v_pk_fma_f16 in DirectCompute::packed_f16_alu(), saturating each rounded binary16 half to [+0.0, 1.0] with -0.0 -> +0.0 and NaN -> +0.0 while keeping VOP2/e64 v_pk_fmac_f16 clamp and unused third-operand fields refused. Add native_packed_f16_clamp_check.py, CMake registration, and docs updates. Fixes #3287, Refs #2935. AI-assisted.

Co-authored-by: legacy-code-archaeologist <[email protected]>
Generalizes the direct Compute DXIL scalar mask combiner and SCC liveness/provenance tracking to lower all remaining 9 wave32 (*_saveexec_b32, s_andn1_wrexec_b32) and 3 wave64 (s_andn1_saveexec_b64, s_orn1_saveexec_b64, s_andn1_wrexec_b64) SOP1 EXEC-mask instructions.

Fixes #3296. Refs #2935.

AI-assisted.
Co-authored-by: RonLogic <[email protected]>
* shader: lower bounded per-lane heap record indices in compute waterfalls (#2644 T3)

* tests: add wrong pre-loop shift negative control for waterfall heap index

---------

Co-authored-by: lewisalex86 <[email protected]>
* shader: lower v_cvt_pknorm_i16_f32 and v_cvt_pknorm_u16_f32 in direct DXIL

Lower VOP3 v_cvt_pknorm_i16_f32 (0x368) and v_cvt_pknorm_u16_f32 (0x369) in DirectCompute::float_alu() using exact pure-32-bit unsigned integer RNE arithmetic ((m << k) - m split at bit k), supporting abs[1:0], neg[1:0], and VGPR/SGPR/literal/inline sources across Compute and Pixel DXIL while refusing clamp, omod, op_sel, third-operand modifiers, nonzero src2, and DPP/SDWA. Add tests/native_cvt_pknorm_f32_check.py, CMake registration, and docs/experiments/native-cvt-pknorm-f32.md. Fixes #3294, Refs #2935. AI-assisted.

* tests,docs: pin single-rounding vs binary32 multiply and document unmeasured RDNA2 status

Refs #3294, #2935.

AI-assisted.

---------

Co-authored-by: legacy-code-archaeologist <[email protected]>
* compile_dxil: add --rekey mode matching shader_cache_rekey.py

Share request hashing and .psin/.rtv parsing helpers in
shader_compute_request, add `compile_dxil --rekey OLD_CACHE_DIR
NEW_REQUEST_DIR [--jobs N]`, register `native_compile_dxil_rekey`, and
document verification.

Fixes #3012
Refs #2935

* docs: update compile_dxil --rekey output revision to 29
Co-authored-by: RonLogic <[email protected]>
s_absdiff_i32, s_min_u32, s_min_i32 and s_max_i32 already write SCC in the
direct lowering. uses_scc_after still treated them as readers, so a symbolic
descriptor field ahead of them was refused. Classify them with the other
overwrites.

Refs #3224

Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: SimSalabimse <[email protected]>
Co-authored-by: lewisalex86 <[email protected]>
* tooling: refuse a patch manifest nested too deeply for tomllib

* tooling: define the shader patch kind, checked for shape only

* tooling: gate a patch manifest on input bytes the caller already read

* tooling: check the shader revision's form, not the runtime's current number

* tooling: a shader patch names its files by bare file name

* tests: pin the shader patch files to what the runtime reads

* tests: set the recursion limit in the patch manifest nesting case

* docs: list the shader patch mutations and controls

* docs: record the patch manifest loader measurements

* tests: pin patch manifest geometry, trailing text, empty bytes and the CLI's OSError

Four memory patches in descending RVA, three adjacent and one at RVA 0, load; a one-byte overlap is refused in either order. A hash or key with trailing text and an empty bytes are refused, the bound patch is compared field by field, and a missing input file reaches the CLI as a diagnostic. Each kills one of the eight mutations that survived the fixture.

* docs: list the patch manifest cases and mutations added for the fixture audit

* tests: give the side-by-side patches ids out of step with their addresses

A sort of the spans by id instead of by address passed the fixture, because
the accept case listed ids that followed the addresses. Use ids that follow
neither the addresses nor their reverse, and list the mutation.

* loader: refuse Windows-invalid manifest file names (#3119)

* loader: accept the .cs.hlsl a compute key may need (#3119)

Since #3006 the runtime's compute loader also looks for <key>.cs.hlsl when the
key's .txt has no native line, and refuses the translation without it. List it
as a compute translation file, optional like mesh86's .ps.cso, since the loader
does not read the .txt. Pin it beside the runtime's unmarked-manifest check.
The published compute manifest now carries `srv N tex1d|tex3d|tex2da table R B`
for texture SRVs of those dimensions (cube and multisampled ones keep their
named refusal). The Dispatch reader takes the name as the slot's dimension; for
1D, 2D-array and 3D it needs the title's described view of that dimension that
fits its texture (address_view_fits: same or typeless-family format, mips and
slices inside, no LOD clamp), otherwise the Dispatch is refused by name.

An accepted tex2d line binds as before. The refusal text for an srv line that
is not read now names the new dimensions.


Claude-Session: https://claude.ai/code/session_01EF3hKGcUDvQ6pxjDDMrvbn

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: lewisalex86 <[email protected]>
precheck_enabled() returned IsDebuggerPresent() || <X2W_PROBE_PRECHECK set and
not 0>, so the variable could only turn the pre-check on. Title runs always
start under debug_launch.py, where the VirtualQuery before each probe and
guarded copy now runs on every call. An explicit setting now decides (0 off,
anything else on); unset keeps the debugger check.

startup_local_log_precheck_off_debugger sets the PEB's BeingDebugged byte and
checks with X2W_PROBE_PRECHECK=0 that a free range is refused by the touch,
with one first-chance fault and nothing counted as avoided. With the old
condition it fails on both.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
runtime: compare the GDK runtime with the shim
tooling: report GDK knowledge coverage
'fix: prevent undefined behavior in unpin_slot when slot is not pinned'
startup: read block-compressed 0x105 volumes in slot 70
shader: add a GDK shader corpus harness
shader: lower v_cvt_norm_i16_f16 and v_cvt_norm_u16_f16 in direct DXIL
shader: lower remaining SOP1 *_saveexec_* and *_wrexec_* ops in direct Compute DXIL
shader: harden compile_lds_request CLI, path guards, and replay checks with offline unit suite
startup: let X2W_PROBE_PRECHECK=0 turn the probe pre-check off under a debugger
* shader: harden directory, symlink, and output path guards in probe_root_devices with CLI suite

* shader: address review feedback on probe_root_devices regressive guards

---------

Co-authored-by: Ammar Abdelfattah <[email protected]>
Co-authored-by: R0D4X <[email protected]>
Co-authored-by: tedin7 <[email protected]>
Keep #3138's sidecar_changed invalidation and the branch's compute dependency_changed/lost checks in the watch request gate.
Keep the shared graphics/compute request key helpers and pixel-input reader, including the .ps57in sidecar. Keep the BCNT64 compute block alongside the shared scalar-mask combiner. Accept main's raw-store cache-policy naming. Keep both --rekey and --prepare-compute-pack in the usage text.
Author
Owner

@⁠lambirou on GitHub · 2026-11-28 10:09 UTC · original

Refreshed #3243 at 86cf5aa8: it now merges both the current base 71e23baf (#3140, #3310) and current main 3926a289.

  • The watch gate keeps #3140's sidecar_changed and the branch's compute dependency_changed/lost checks.
  • Request reading uses the shared graphics_request_key/compute_request_key helpers while keeping .psin/.ps57in pixel inputs.
  • Direct compute keeps the BCNT64 block alongside main's combine_scalar_mask, both output shapes, the exact_store/indexed gates, WREXEC and the packed virtual-wave derivative refusal.
  • The usage text keeps both --rekey and --prepare-compute-pack.

Debug: 18/18 selected controls, zero skips. Release /O2: 18/19; only native_ldexp_f16_hardware fails on this RX 9060 XT, and unmodified main 3926a289 fails it identically (got beef7c00, expected beef0200), so it is upstream #3125. The (8,4,1) implicit-LOD mismatch remains #3257. The core compiler, WREXEC, #3264 and packed virtual-wave controls all pass.

#3243 is CLEAN/MERGEABLE and approved at 86cf5aa8; it is ready to merge into codex/native-shader-modules for #3091.

**@⁠lambirou** on GitHub · 2026-11-28 10:09 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3241#issuecomment-7237714284) Refreshed #3243 at `86cf5aa8`: it now merges both the current base `71e23baf` (#3140, #3310) and current `main` `3926a289`. - The watch gate keeps #3140's `sidecar_changed` and the branch's compute `dependency_changed`/`lost` checks. - Request reading uses the shared `graphics_request_key`/`compute_request_key` helpers while keeping `.psin`/`.ps57in` pixel inputs. - Direct compute keeps the BCNT64 block alongside main's `combine_scalar_mask`, both output shapes, the `exact_store`/`indexed` gates, WREXEC and the packed virtual-wave derivative refusal. - The usage text keeps both `--rekey` and `--prepare-compute-pack`. Debug: 18/18 selected controls, zero skips. Release `/O2`: 18/19; only `native_ldexp_f16_hardware` fails on this RX 9060 XT, and unmodified `main` `3926a289` fails it identically (`got beef7c00, expected beef0200`), so it is upstream #3125. The `(8,4,1)` implicit-LOD mismatch remains #3257. The core compiler, WREXEC, #3264 and packed virtual-wave controls all pass. #3243 is `CLEAN/MERGEABLE` and approved at `86cf5aa8`; it is ready to merge into `codex/native-shader-modules` for #3091.
Author
Owner

@⁠lambirou on GitHub · 2026-11-28 10:24 UTC · original

Additional runtime check on the approved head 86cf5aa8:

ctest --preset {dev,release} --no-tests=error --output-on-failure -j 1 -R '^(startup_native_graphics_draw_(warp|hardware)|startup_mrt_dxc_(warp|hardware)|startup_compute_dispatch_native_(warp|hardware)|startup_stream_draw_(warp|hardware))$'

Debug and Release each gave 7 passes and one capability skip (startup_compute_dispatch_native_warp, 32-lane waves). The WARP and RX 9060 XT paths cover first-draw native graphics, MRT late-manifest recovery, stream draw, and hardware native Dispatch. This is the tree #3091 receives when #3243 fast-forwards codex/native-shader-modules.

**@⁠lambirou** on GitHub · 2026-11-28 10:24 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3241#issuecomment-7237882060) Additional runtime check on the approved head `86cf5aa8`: ``` ctest --preset {dev,release} --no-tests=error --output-on-failure -j 1 -R '^(startup_native_graphics_draw_(warp|hardware)|startup_mrt_dxc_(warp|hardware)|startup_compute_dispatch_native_(warp|hardware)|startup_stream_draw_(warp|hardware))$' ``` Debug and Release each gave 7 passes and one capability skip (`startup_compute_dispatch_native_warp`, 32-lane waves). The WARP and RX 9060 XT paths cover first-draw native graphics, MRT late-manifest recovery, stream draw, and hardware native Dispatch. This is the tree #3091 receives when #3243 fast-forwards `codex/native-shader-modules`.
Author
Owner

@⁠lambirou on GitHub · 2026-11-28 10:43 UTC · original

Full Release build on 86cf5aa8 also completes with 0 errors (cmake --build --preset release, all targets). This is on top of the 18/19 targeted controls and the 7/8 runtime set already reported.

**@⁠lambirou** on GitHub · 2026-11-28 10:43 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3241#issuecomment-7238085828) Full Release build on `86cf5aa8` also completes with 0 errors (`cmake --build --preset release`, all targets). This is on top of the 18/19 targeted controls and the 7/8 runtime set already reported.
* startup: lower v_dot2_i32_i16 and v_dot2_u32_u16 in gfx2hlsl

* tests: add zero-product signed-clamp lanes for v_dot2_i32_i16

---------

Co-authored-by: R0D4X <[email protected]>
Co-authored-by: lewisalex86 <[email protected]>
transfer() records the symbol of EXEC in s[126]/s[127], for example a
constant after s_mov_b64 exec, <literal>. The wave32 saveexec/wrexec
branch clears s[126], but the 64-bit *_saveexec_b64 and *_wrexec_b64
fell into the generic SOP1 branch, which clears only the destination
pair. The analysis then kept the old EXEC constant, and a later
s_mov_b32 sN, exec_lo copied it, so the constant-sampler path could
fold a value the program no longer had. These ops now clear the
destination pair and both EXEC words.

New test native_exec_symbol_b64_controls: a sampler word taken from
exec_lo compiles while EXEC is a known constant, and is refused with
"nonconstant sampler" after s_and_saveexec_b64 or s_andn2_wrexec_b64
with an unknown source.

AI-assisted.

Co-authored-by: tedin7 <[email protected]>
Author
Owner

@⁠lambirou on GitHub · 2026-11-28 11:07 UTC · original

Refreshed again to 48b2027c: clean merge of main 7e5c378d (#3316, #3036).

  • native_exec_symbol_b64_controls passes; gfx1013_compute_native.cpp takes main's EXEC-symbol forgetting without breaking the branch's compute paths.
  • startup_gfx2hlsl_v_dot2_controls passes with main's dot2 lowering.
  • native_compute_pack passes after relinking the checker against the new compiler (the earlier failure was the known stale-checker symptom).

#3243 is CLEAN/MERGEABLE and remains approved at 48b2027c.

**@⁠lambirou** on GitHub · 2026-11-28 11:07 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3241#issuecomment-7238346414) Refreshed again to `48b2027c`: clean merge of `main` `7e5c378d` (#3316, #3036). - `native_exec_symbol_b64_controls` passes; `gfx1013_compute_native.cpp` takes main's EXEC-symbol forgetting without breaking the branch's compute paths. - `startup_gfx2hlsl_v_dot2_controls` passes with main's dot2 lowering. - `native_compute_pack` passes after relinking the checker against the new compiler (the earlier failure was the known stale-checker symptom). #3243 is `CLEAN/MERGEABLE` and remains approved at `48b2027c`.
Author
Owner

@⁠lambirou on GitHub · 2026-11-28 11:09 UTC · original

Runtime checks on 48b2027c (the tree #3091 receives): 7 passes and one capability skip in Release. The WARP and RX 9060 XT paths cover native graphics draw, MRT late-manifest recovery, stream draw and hardware native Dispatch. No failures.

**@⁠lambirou** on GitHub · 2026-11-28 11:09 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3241#issuecomment-7238366904) Runtime checks on `48b2027c` (the tree #3091 receives): 7 passes and one capability skip in Release. The WARP and RX 9060 XT paths cover native graphics draw, MRT late-manifest recovery, stream draw and hardware native Dispatch. No failures.
github manually merged commit 07e8daa636 into codex/native-shader-modules 2026-11-28 14:26:03 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.