shader: lower packed byte dot products in direct compute #3060
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3060"
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 RonLogic on 2026-11-27T13:13:38Z.
Change
Refs #2935. Add the gfx1013 VOP3P
v_dot4_i32_i8andv_dot4_u32_u8instructions to the direct C++ compute path. Onfca7c35b, the source-built request is refused asdirect ALU operand modifiersat the first dot instruction.Emit the matching signed or unsigned DXIL packed dot. The ordinary form accumulates with 32-bit wrapping. For
clamp, compute the dot with a zero accumulator, then saturate the addition of the guest accumulator. The packed product fits in 32 bits by itself. The clamp path shares the existing halfword multiply-add overflow handling. The canonical VOP3P selectors and zero negation fields are required.PR #3031 works on the separate HLSL frontend. Its existing conflict in
tools/startup/gfx2hlsl.pyalso occurs against cleanmain; this branch does not edit that file.Verification
Tested
7a28de14cf520d548c3481e310932b301518268eon801f4c3bwith Windows 11 build 26300.10075, MSVC 19.52, SDK 10.0.26100 and DXC 1.9.2602.17.32.0.16.2124, SM 6.6 / wave32, debug layer off): both the full and sparse EXEC dispatches matched 2,048 result words and 16 guards. The no-clamp replay matched the wrapping reference and differed at 192 words from the clamped reference. Five noncanonical encodings were refused.10.0.26100.10068, debug layer on for adjacent HLSL fixtures): the related shader checks passed. This WARP adapter exposes 4-lane waves, so the native wave32 replay is inapplicable.python -B tests/docs_links_check.py,python -B tests/bidi_controls_check.py, andgit diff --checkpassed.Evidence and follow-up
The fixture is generated from synthetic guest instructions under the repository license. It covers signed overflow in both directions, unsigned carry, inputs at the saturation bounds, wraparound, and inactive lanes. The experiment notes cite the AMD ISA and Microsoft DXIL definitions. Native readback on AMD remains unverified.
Checklist
I used Codex to prepare the change and ran verification locally.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T13:54:11Z.
Review: APPROVED
Independent review of the exact head integrated over
main36d2cbeband #2871 (tree810cde3b931940b7fd7d7514db693802b3e89427). The byte dot alone fits into 32 bits. The unclamped path uses the packed DXIL dot with the guest accumulator, and the clamp path saturates only the final addition. The extracted saturation helper preserves the existing halfword MAD behavior.Built
compile_dxil native_store_replay. Debug and Release/O2each passed 10/10 with zero skips usingctest --test-dir <build> --no-tests=error -j 1 -V -R '^(native_(packed_dot4|int16_ternary|perm_lerp|absdiff)_.+|native_dxil_llvm_ident_controls|startup_gfx2hlsl_v_dot8_controls)$'. Full and sparse EXEC each matched 2,048 result words and 16 guards. The malformed modifier and wrapping controls passed. Windows 11 build 26200.9974, RTX 4060 Laptop driver 32.0.16.1656, SDK DXC 10.0.26100, replay debug layer off. Native replay needs wave32 and has no WARP case; the PR author reports the adjacent HLSL WARP runs.