compute: lower v_dot4c_i32_i8 in direct compute #3248

Manually merged
github merged 2 commits from github-bot/gh-3246 into gh-pr/3246/base 2026-11-28 04:01:00 +00:00 AGit
Owner

@⁠Leyukaka on GitHub · 2026-11-28 01:42 UTC · original
Leyukaka:dot4c-i32-i8 → main · +158 −6 · 4 files · 2 commits · merged 2026-11-28 03:57 UTC

Part of #2935, claimed in #3226 (item 2 of my second comment there). Target branch main.

Change (src/gfx1013_direct_compute.inl): direct compute lowers VOP2 v_dot4c_i32_i8 (opcode 0x0d).

  • It 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 existing packed-byte dot lowering, with the destination as the accumulator.
  • Literal, SGPR, inline and VGPR src0 are accepted. DPP, SDWA, the VOP3 form and modifiers stay refused.

Tests. The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, Release, on main 7364e6a9 plus this commit.

  • New native_dot4c_ir and native_dot4c_hardware (wave32, groups 0 and 1, EXEC set explicitly) cover four cases:
    • a literal src0 (dot -69);
    • an SGPR src0 with a sparse EXEC, where inactive lanes keep D;
    • inline -1;
    • a VGPR aliasing the destination, wrapping below INT32_MIN.
  • Refusal controls: DPP and SDWA forms.
  • With main's compile_dxil, the new test stops at "direct DXIL lowering for v_dot4c_i32_i8".
  • 22 tests pass with -R "native_dot|native_direct_container|native_packed".
  • Mutation check by hand: treating the bytes as unsigned fails both new tests.

Measured with compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests, main 7364e6a9 against this commit.

  • Local capture of 2,689 requests: no change (494).
  • Requests of one start-up run (2,718): 507 to 508.
  • The 882 requests of #3226: 128 to 129. The new program accounts for 4,282 dispatches.
  • Five more programs get past this refusal. Four stop at the VOP3P "unsupported packed byte dot operand modifiers" refusal, and one at "descriptor used as mask".
  • No program that compiled before stops compiling.
  • Counts and instruction shape only.

AI-assisted.

**@⁠Leyukaka** on GitHub · 2026-11-28 01:42 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3246) `Leyukaka:dot4c-i32-i8` → `main` · +158 −6 · 4 files · 2 commits · merged 2026-11-28 03:57 UTC Part of #2935, claimed in #3226 (item 2 of my second comment there). Target branch `main`. **Change** (`src/gfx1013_direct_compute.inl`): direct compute lowers VOP2 `v_dot4c_i32_i8` (opcode 0x0d). - It 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 existing packed-byte dot lowering, with the destination as the accumulator. - Literal, SGPR, inline and VGPR src0 are accepted. DPP, SDWA, the VOP3 form and modifiers stay refused. **Tests.** The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, Release, on `main` `7364e6a9` plus this commit. - New `native_dot4c_ir` and `native_dot4c_hardware` (wave32, groups 0 and 1, EXEC set explicitly) cover four cases: - a literal src0 (dot -69); - an SGPR src0 with a sparse EXEC, where inactive lanes keep D; - inline -1; - a VGPR aliasing the destination, wrapping below INT32_MIN. - Refusal controls: DPP and SDWA forms. - With `main`'s `compile_dxil`, the new test stops at "direct DXIL lowering for v_dot4c_i32_i8". - 22 tests pass with `-R "native_dot|native_direct_container|native_packed"`. - Mutation check by hand: treating the bytes as unsigned fails both new tests. **Measured** with `compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests`, `main` `7364e6a9` against this commit. - Local capture of 2,689 requests: no change (494). - Requests of one start-up run (2,718): 507 to 508. - The 882 requests of #3226: 128 to 129. The new program accounts for 4,282 dispatches. - Five more programs get past this refusal. Four stop at the VOP3P "unsupported packed byte dot operand modifiers" refusal, and one at "descriptor used as mask". - No program that compiled before stops compiling. - Counts and instruction shape only. AI-assisted.
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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 01:43:36 +00:00
github-bot force-pushed github-bot/gh-3246 from 4909bb61df to d8a1909831 2026-11-28 03:42:16 +00:00 Compare
Author
Owner

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

I reviewed d8a19098 and ran Debug and Release /O2 on main a166a753 plus this head (tree 796f1777). Each build passed 11/11, including the new signed accumulator's IR and RTX wave32 readback, inactive-lane preservation and the adjacent packed-dot controls. Windows 11 26200.9974, RTX 4060 Laptop driver 32.0.16.1656, SDK/DXC 10.0.26100.0. No skips.

ctest --test-dir <build> --no-tests=error --output-on-failure -j 1 -R '^(native_dot4c_(ir|hardware)|native_(packed_dot|int8).*(controls|hardware))$'

Please add the newly supported VOP2 form, refusal boundary and reproduction command to the experiment documentation alongside the existing packed-dot coverage. The #3226 counts already identify the offline cohort.

**@⁠R0Y00** on GitHub · 2026-11-28 03:45 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3246#pullrequestreview-6095532659) · **requested changes** I reviewed `d8a19098` and ran Debug and Release /O2 on main `a166a753` plus this head (tree `796f1777`). Each build passed 11/11, including the new signed accumulator's IR and RTX wave32 readback, inactive-lane preservation and the adjacent packed-dot controls. Windows 11 26200.9974, RTX 4060 Laptop driver 32.0.16.1656, SDK/DXC 10.0.26100.0. No skips. ```powershell ctest --test-dir <build> --no-tests=error --output-on-failure -j 1 -R '^(native_dot4c_(ir|hardware)|native_(packed_dot|int8).*(controls|hardware))$' ``` Please add the newly supported VOP2 form, refusal boundary and reproduction command to the experiment documentation alongside the existing packed-dot coverage. The #3226 counts already identify the offline cohort.
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.
Author
Owner

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

Thanks for testing it. Pushed 8f0b1b94, docs only. docs/experiments/native-packed-dot4.md gains a "VOP2 dot-accumulate" section, next to the existing packed-dot text:

  • the accepted form: plain VOP2 v_dot4c_i32_i8, with the destination as accumulator, Dot4AddI8Packed, and S0 from a VGPR, SGPR, inline constant or literal;
  • the refusal boundary: the VOP3 form, abs/neg/clamp/omod, DPP16 and SDWA, with their messages;
  • the native_dot4c_(ir|hardware) command and what each test checks.

AI-assisted.

**@⁠Leyukaka** on GitHub · 2026-11-28 03:50 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3246#issuecomment-7233429441) Thanks for testing it. Pushed `8f0b1b94`, docs only. `docs/experiments/native-packed-dot4.md` gains a "VOP2 dot-accumulate" section, next to the existing packed-dot text: - the accepted form: plain VOP2 `v_dot4c_i32_i8`, with the destination as accumulator, `Dot4AddI8Packed`, and S0 from a VGPR, SGPR, inline constant or literal; - the refusal boundary: the VOP3 form, abs/neg/clamp/omod, DPP16 and SDWA, with their messages; - the `native_dot4c_(ir|hardware)` command and what each test checks. AI-assisted.
github-bot changed target branch from main to gh-pr/3246/base 2026-11-28 04:00:58 +00:00
github manually merged commit 8f0b1b94c0 into gh-pr/3246/base 2026-11-28 04:01:00 +00:00
Author
Owner

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

The requested experiment note is present at 8f0b1b94. On main 152e93b4 plus this head (tree 25711d43), the two focused Release /O2 tests native_dot4c_ir and native_dot4c_hardware both passed on RTX 4060 Laptop, including the sparse EXEC control. The earlier source-identical revision passed 11/11 in both configurations. The launcher-only merge leaves the tested shader and fixture files unchanged.

**@⁠R0Y00** on GitHub · 2026-11-28 03:57 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3246#pullrequestreview-6095616267) · **approved these changes** The requested experiment note is present at 8f0b1b94. On main 152e93b4 plus this head (tree 25711d43), the two focused Release /O2 tests native_dot4c_ir and native_dot4c_hardware both passed on RTX 4060 Laptop, including the sparse EXEC control. The earlier source-identical revision passed 11/11 in both configurations. The launcher-only merge leaves the tested shader and fixture files unchanged.
Author
Owner

@⁠pigalot on GitHub · 2026-11-28 04:00 UTC · original

Independently reviewed 8f0b1b94 integrated over main 152e93b4 (tree 25711d43). This is the head that was merged, so I'm posting this as a comment. The merge is clean, and git diff --cached --check is clean too.

What I traced. VOP2 v_dot4c_i32_i8 is lowered as Dot4AddI8Packed(D, S0, S1), with the destination as the accumulator and the sum wrapping modulo 2^32. The VOP2 decoder sets i.dst = 256 + vdst (gfx1013_compute_native.cpp:151), so operand32(i, i.dst) reads the destination VGPR. vector_write keeps the old D on inactive lanes. Clamp is refused for this form, so the saturating path is never taken.

I checked the four expected dots by hand:

  • the literal 0xfbf201f7·0x04030201 gives -69;
  • -128·-128 four times gives 65536 on 0x7ffffff0, which crosses INT32_MAX;
  • inline -1 gives -10;
  • the aliased v3 byte 3 (-128)·127 gives -16256 on 0x80000000, which crosses INT32_MIN.

What I ran. I built compile_dxil native_store_replay native_compute_ir_dump offscreen_check in dev and release, then ran

ctest --test-dir out/build/<preset> --no-tests=error -j 1 -V -R '^(native_dot4c_(ir|hardware)|native_(packed_dot|int8).*(controls|hardware))$'

The _hardware tests ran at -j 1. All 11 pass in Debug and in Release /O2, with no skips:

  • native_dot4c_ir: four source encodings, plus the DPP and SDWA refusals.
  • native_dot4c_hardware: "64 results and all guards matched" for literal, sgpr, inline and vgpr_dst_alias.

The 74 ^native_.*_(controls|ir)$ tests also pass in dev.

Negative control and mutants. Each mutant was rebuilt in dev and run against both new tests:

Mutant Result
src/gfx1013_direct_compute.inl back to main killed: "direct DXIL lowering for v_dot4c_i32_i8"
dot4c treated as unsigned (op 164) killed in _ir and _hardware (literal word 8 0000081f)
accumulator read from src[2] instead of D killed in _hardware (literal word 8)
accumulator dropped (0) killed in _hardware (literal word 8 ffffffbb)
write instead of vector_write (inactive lanes written) killed in _hardware (sgpr word 9 8000fff1)

Restored and rebuilt afterwards. The restored build passes again, and git diff --quiet is clean.

R0Y00's request on d8a19098. 8f0b1b94 adds the "VOP2 dot-accumulate" section to docs/experiments/native-packed-dot4.md. It covers the accepted form and sources, the refusal boundary with each message, the reproduction commands, and what each test checks.

Non-blocking. The new refusal's dpp_control and subword clauses are not reached by the controls. DPP16 and SDWA are refused earlier, with "unsupported DPP arithmetic" and "unimplemented direct SDWA operand profile", and the docs say so. The clauses are harmless, but nothing pins "unsupported packed byte dot-accumulate operand modifiers" itself.

Verdict: I would have approved 8f0b1b94.

Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088, Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; SDK 10.0.28000.0 DXC (the one CTest picked up); Python 3.12.10; wave32.
CI: Build and test on Windows passes on 8f0b1b94.

This reply was AI-assisted.

**@⁠pigalot** on GitHub · 2026-11-28 04:00 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3246#issuecomment-7233600245) Independently reviewed `8f0b1b94` integrated over `main` `152e93b4` (tree `25711d43`). This is the head that was merged, so I'm posting this as a comment. The merge is clean, and `git diff --cached --check` is clean too. **What I traced.** VOP2 `v_dot4c_i32_i8` is lowered as `Dot4AddI8Packed(D, S0, S1)`, with the destination as the accumulator and the sum wrapping modulo 2^32. The VOP2 decoder sets `i.dst = 256 + vdst` (`gfx1013_compute_native.cpp:151`), so `operand32(i, i.dst)` reads the destination VGPR. `vector_write` keeps the old D on inactive lanes. Clamp is refused for this form, so the saturating path is never taken. I checked the four expected dots by hand: - the literal `0xfbf201f7`·`0x04030201` gives -69; - -128·-128 four times gives 65536 on `0x7ffffff0`, which crosses INT32_MAX; - inline -1 gives -10; - the aliased `v3` byte 3 (-128)·127 gives -16256 on `0x80000000`, which crosses INT32_MIN. **What I ran.** I built `compile_dxil native_store_replay native_compute_ir_dump offscreen_check` in `dev` and `release`, then ran ```powershell ctest --test-dir out/build/<preset> --no-tests=error -j 1 -V -R '^(native_dot4c_(ir|hardware)|native_(packed_dot|int8).*(controls|hardware))$' ``` The `_hardware` tests ran at `-j 1`. All 11 pass in Debug and in Release `/O2`, with no skips: - `native_dot4c_ir`: four source encodings, plus the DPP and SDWA refusals. - `native_dot4c_hardware`: "64 results and all guards matched" for literal, sgpr, inline and vgpr_dst_alias. The 74 `^native_.*_(controls|ir)$` tests also pass in `dev`. **Negative control and mutants.** Each mutant was rebuilt in `dev` and run against both new tests: | Mutant | Result | |---|---| | `src/gfx1013_direct_compute.inl` back to `main` | killed: "direct DXIL lowering for v_dot4c_i32_i8" | | dot4c treated as unsigned (op 164) | killed in `_ir` and `_hardware` (literal word 8 `0000081f`) | | accumulator read from `src[2]` instead of D | killed in `_hardware` (literal word 8) | | accumulator dropped (0) | killed in `_hardware` (literal word 8 `ffffffbb`) | | `write` instead of `vector_write` (inactive lanes written) | killed in `_hardware` (sgpr word 9 `8000fff1`) | Restored and rebuilt afterwards. The restored build passes again, and `git diff --quiet` is clean. **R0Y00's request on `d8a19098`.** `8f0b1b94` adds the "VOP2 dot-accumulate" section to `docs/experiments/native-packed-dot4.md`. It covers the accepted form and sources, the refusal boundary with each message, the reproduction commands, and what each test checks. **Non-blocking.** The new refusal's `dpp_control` and `subword` clauses are not reached by the controls. DPP16 and SDWA are refused earlier, with "unsupported DPP arithmetic" and "unimplemented direct SDWA operand profile", and the docs say so. The clauses are harmless, but nothing pins "unsupported packed byte dot-accumulate operand modifiers" itself. **Verdict:** I would have approved `8f0b1b94`. Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088, Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; SDK 10.0.28000.0 DXC (the one CTest picked up); Python 3.12.10; wave32. CI: `Build and test on Windows` passes on `8f0b1b94`. This reply was AI-assisted.
This discussion has been locked. Commenting is limited to contributors.
No description provided.