shader: merge current main into the native shader module stack #3241
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3241"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-28T01:22:11Z.
Updates #3091's
codex/native-shader-modulesbranch to currentmain7e5c378d, on top of the current base71e23baf, without modifying either target branch. This is a merge-only PR; R0Y00 can merge it to refresh #3091. Conflict resolutions: - Base merge (#3138/#3308): keep#3138'ssidecar_changedinvalidation together with the branch's computedependency_changed/lostchecks in the watch gate; keep #3308's reviewed address-only mesh pixel inputs. -src/shader_compute_request.cpp: use the sharedgraphics_request_key/compute_request_keyhelpers, and keepread_pixel_inputsso both.psinand.ps57inrecords are read. -src/gfx1013_direct_compute.inl: keep the BCNT64 block alongside main'scombine_scalar_mask, both output shapes (virtual waves64x1x1, flat compute-derivative quadsx*y*z), theexact_store/indexedgates, 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--rekeyand--prepare-compute-packin the usage text, and both watch invalidations. Validation at48b2027c, 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 isnative_ldexp_f16_hardwareon this RX 9060 XT, and unmodifiedmain3926a289fails it identically (got beef7c00, expected beef0200), so it is upstream #3123. The set covers direct container/mesh, pack/frozen, the compile watcher, interface/WQM, request cache, SALU shift64, image cache flags, WREXEC64, #3262 EXEC/VCC and the packed virtual-wave derivative control. The(8,4,1)native_compute_implicit_lod_hardwaremismatch also still reproduces on unmodified main and remains #3255. The D3D12 debug layer is unavailable (0x887a002d). This does not change the flag fix in #3139; it only refreshes the compiler base and keeps both merged features.Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-28T01:26:05Z.
@R0Y00 this is the merge-only refresh of #3091 onto
main57e94668. It is ready to merge intocodex/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.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-28T01:38:17Z.
Review: CHANGES_REQUESTED
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.
Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-28T01:44:53Z.
Fixed at
cf19be36.read_compute_request()now constructsComputeRequestwith its defaultwave32, callsvalidate_compute_request_shape(), and only then decodesrequest.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 returncompute state block A is not 28 bytesand write no shader.Validation, Debug and Release, 5/5 each (no skips):
The other reconciliations are unchanged.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-28T02:04:17Z.
Review: APPROVED
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, withcf19be36integrated in trial tree 0d0868d58b43ad9bd1f5cd696ef2984ef41b00ee: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.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-28T02:55:05Z.
After #3243 and #2981 landed, integrating
cf19be36onto mainc827d8banow conflicts in four files. The original short-state fix remains correct. I checked this reconciliation locally (tree 91399a6f3e12cd06062928ae111abb48cfdd976e):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.
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.
Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-28T03:15:58Z.
Carried onto the refresh branch:
f7bf5e2emergesmain9872074aintocf19be36.The four conflicts are resolved as requested:
CMakeLists.txtkeeps both the exact-width texture cases and the compiler stack's registrations.gfx1013_compute_native.hkeepsfloat_texture_uav/float2_texture_uav/float3_texture_uavin their numeric positions, then appendspacked_d16_x_uavandindexed_raw_srv; bothexact_texture_uav_channelsandaccepts_cbv_windowremain.direct_compute_cache.cppusesindexed_raw_srvas the decode upper bound.gfx1013_direct_compute.inlkeeps bothexact_storeandindexed: the store gate acceptsexact_store, and the descriptor gate acceptsindexed.Release
/O2and Debug each pass 9/9, zero skips, with your regex:native_compute_pack,native_frozen_request,native_direct_mesh, the fournative_image_store_exact_width_hardware_*cases, andstartup_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).#3241 is
CLEAN/MERGEABLEatf7bf5e2eand approved; #3091 can use this head for its next review.Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-28T03:33:53Z.
Refreshed
#3241at4a007912: merge ofmaina44e1f95(includes0fe4cebc,bf1bc769anda44e1f95).The conflicts are resolved as follows:
gfx1013_direct_compute.inl:complete_compute_quadsis set before the lane setup, and the output keeps both shapes:virtual_wavesfinishes as64x1x1, flat compute-derivative quads asx*y*z, original dimensions otherwise. The branch'sexact_store/indexedgates and main's WREXEC validation/EXEC update path are both kept.gfx1013_compute_native.cpp: keep the branch's Symbol types plus main'sheap_offset/heap_carry, with the heap-address SMEM branch ahead of the graphics, sampler-heap and table branches.Current-head suite, Release
/O2and 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_controlspasses; the 96-thread wave32 and 128-thread wave64 virtual-wave cases pass, as do the 1D flat cases.native_compute_implicit_lod_hardwarefails only(8,4,1)on this RX 9060 XT. Unmodifiedmaina44e1f95fails it identically (expected=3f800000 actual=3f948000), so this is upstream in #3255 or the fixture, not the reconciliation. WARP skips because it has no 32-lane waves.#3241 is
CLEAN/MERGEABLEand approved at4a007912; #3091 can use this head.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-28T03:36:18Z.
Review: CHANGES_REQUESTED
The 128-thread case in
native_compute_implicit_lod_check.pyexercises 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
4a007912tree 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 ondbaa010bkept 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 #3262's EXEC/VCC behaviors when refreshing the branch. The separately reported RX 9060 XT mismatch reproduces on unmodified main and is tracked on #3255.
Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-28T03:50:19Z.
Refreshed
#3241atcd746f6a: merge ofmaina166a753, which includes #3262.Packed virtual-wave control.
native_wave_virtual_derivative_controlsbuilds 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 withimplicit derivatives with virtual wave64 groups. The code refuses at theimplicit && !pixel_stagecheck whenvirtual_wavesis active, before any shader is published.#3262 absorbed.
s_cselect_b64ands_not_b64now use main'sscalar64source validation, so VCC and EXEC are accepted as 64-bit sources while the branch's direct-compute paths stay intact.Release
/O2and Debug each pass 13/13, zero skips: the 12 current-head checks plusnative_wave_virtual_derivative_controls.native_compute_implicit_lod_controlsand the 96/128 cases still pass. The(8,4,1)RX 9060 XT mismatch remains upstream #3255; it reproduces on unmodified maina44e1f95with the same value.#3241isCLEAN/MERGEABLEatcd746f6a. Please re-review.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-28T03:56:37Z.
Review: APPROVED
This revision addresses the packed-dispatch finding. I rebuilt
cd746f6a(tree0bba0986) and obtained 2/2 passes in Release /O2: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 #3255.
Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-28T07:33:51Z.
Thanks for working through both change requests.
cf19be36moves thesa[18]read aftervalidate_compute_request_shape,cd746f6arefuses implicit derivatives in virtual wave64 groups, and the review list (gh api repos/R0Y00/Xbox2Windows/pulls/3241/reviews) shows APPROVED atcd746f6a.The base moved after that approval. #3138 landed on
codex/native-shader-modulesat0b505c1c, 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_staleresolves like this:bool sidecar_changed = false;andif (has_manifest && !sidecar_changed) {;if (req.compute) { ... x2w::native_compute_output(manifest) ... }block inside thatif;lost = !psin_mtime.has_value() && fs::is_regular_file(psdep_path, ec);line. With the base's declarationslostno longer exists, so the merged file would not compile.After that, re-running
native_compile_dxil_watch*from #3138 along with this PR's 13 tests would cover both sides.Two smaller points, neither a blocker:
struct.pack("<6I", ...)is 24 bytes, sosa[18]is in range. With the old order the request still fails withcompute state block A is not 28 bytesand the test stays green. A state A of 16 bytes or fewer would turn the reverted order into an out-of-rangestd::stringread, 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.mdfinds nothing. One line indocs/experiments/native-compute-implicit-derivatives.mdwould document the new refusal.This comment was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-28T10:09:57Z.
Refreshed #3241 at
86cf5aa8: it now merges both the current base71e23baf(#3138, #3308) and currentmain3926a289.sidecar_changedand the branch's computedependency_changed/lostchecks.graphics_request_key/compute_request_keyhelpers while keeping.psin/.ps57inpixel inputs.combine_scalar_mask, both output shapes, theexact_store/indexedgates, WREXEC and the packed virtual-wave derivative refusal.--rekeyand--prepare-compute-pack.Debug: 18/18 selected controls, zero skips. Release
/O2: 18/19; onlynative_ldexp_f16_hardwarefails on this RX 9060 XT, and unmodifiedmain3926a289fails it identically (got beef7c00, expected beef0200), so it is upstream #3123. The(8,4,1)implicit-LOD mismatch remains #3255. The core compiler, WREXEC, #3262 and packed virtual-wave controls all pass.#3241 is
CLEAN/MERGEABLEand approved at86cf5aa8; it is ready to merge intocodex/native-shader-modulesfor #3091.Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-28T10:24:58Z.
Additional runtime check on the approved head
86cf5aa8: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 #3241 fast-forwardscodex/native-shader-modules.Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-28T10:43:57Z.
Full Release build on
86cf5aa8also 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.Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-28T11:07:49Z.
Refreshed again to
48b2027c: clean merge ofmain7e5c378d(#3314, #3036).native_exec_symbol_b64_controlspasses;gfx1013_compute_native.cpptakes main's EXEC-symbol forgetting without breaking the branch's compute paths.startup_gfx2hlsl_v_dot2_controlspasses with main's dot2 lowering.native_compute_packpasses after relinking the checker against the new compiler (the earlier failure was the known stale-checker symptom).#3241 is
CLEAN/MERGEABLEand remains approved at48b2027c.Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-28T11:09:42Z.
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.