shader: support 64-bit source operands in gfx2hlsl (Part of #1723) #2032

Merged
tedin7 merged 7 commits from upstream-pr/2039 into main 2026-11-26 06:04:40 +00:00
tedin7 commented 2026-11-24 23:32:17 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T23:32:17Z.


Part of #1723

What this unblocks: Run 20 census #10 (64-bit source N, 62 pairs).

gfx2hlsl refused v_lshlrev_b64, v_lshrrev_b64 and v_ashrrev_i64 whenever the 64-bit source was a 32-bit hex literal (for example 0x80000000) instead of a register pair or an inline constant. These now lower. The literal fills the low word. The high word is zero for the two unsigned shifts and copies bit 31 for v_ashrrev_i64, the same rule the scalar 64-bit operations already use.

Known limit: decimal literals outside the inline range (65, -17), literals wider than 32 bits, float constants, vcc and exec as a 64-bit source stay refused. The zero/sign extension of a literal is taken from the existing scalar rule, not measured on a console.

Changes:

  • tools/startup/gfx2hlsl.py: i64_words accepts 0x literals of up to 8 hex digits; the signed shift sign-extends.
  • tests/startup_gfx2hlsl_shift64_literal_check.py (new, registered in CMakeLists.txt as startup_gfx2hlsl_shift64_literal): checks the emitted line for each shift with literals that have bit 31 clear and set, and that a 33-bit literal and a literal destination stay refused.
  • tests/startup_gfx2hlsl_shift64_check.py: 0x41 removed from the refusal list, since it is now supported.

Verification (head 51842db4f9a5ec1e487771f30070dfab8521e2b3):

  • Linux: python3 -B tests/startup_gfx2hlsl_shift64_literal_check.py, startup_gfx2hlsl_shift64_check.py, startup_gfx2hlsl_mad64_check.py, startup_gfx2hlsl_scalar_shift64_bfe_check.py, python3 -m unittest tests.rdna2_tools_check -k shift64: PASS. With tools/startup/gfx2hlsl.py from origin/main the literal check fails (Unsupported: 64-bit source 0x41).
  • Win2025 (D3D12 WARP): ctest --preset dev and --preset release -R '^(startup_gfx2hlsl_shift64_literal|startup_gfx2hlsl_shift64_controls|startup_gfx2hlsl_shift64_warp|startup_gfx2hlsl_scalar_shift64_bfe_controls|startup_gfx2hlsl_mad64.*)$': 7/7 passed on dev, 7/7 on release; tests/rdna2_tools_check.py ok.
  • Real GPU (RTX 3090 through vkd3d-proton, Linux): pending.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6593564337 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2039). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T23:32:17Z. --- Part of #1723 What this unblocks: Run 20 census #10 (`64-bit source N`, 62 pairs). `gfx2hlsl` refused `v_lshlrev_b64`, `v_lshrrev_b64` and `v_ashrrev_i64` whenever the 64-bit source was a 32-bit hex literal (for example `0x80000000`) instead of a register pair or an inline constant. These now lower. The literal fills the low word. The high word is zero for the two unsigned shifts and copies bit 31 for `v_ashrrev_i64`, the same rule the scalar 64-bit operations already use. Known limit: decimal literals outside the inline range (`65`, `-17`), literals wider than 32 bits, float constants, `vcc` and `exec` as a 64-bit source stay refused. The zero/sign extension of a literal is taken from the existing scalar rule, not measured on a console. Changes: - `tools/startup/gfx2hlsl.py`: `i64_words` accepts `0x` literals of up to 8 hex digits; the signed shift sign-extends. - `tests/startup_gfx2hlsl_shift64_literal_check.py` (new, registered in `CMakeLists.txt` as `startup_gfx2hlsl_shift64_literal`): checks the emitted line for each shift with literals that have bit 31 clear and set, and that a 33-bit literal and a literal destination stay refused. - `tests/startup_gfx2hlsl_shift64_check.py`: `0x41` removed from the refusal list, since it is now supported. Verification (head `51842db4f9a5ec1e487771f30070dfab8521e2b3`): - Linux: `python3 -B tests/startup_gfx2hlsl_shift64_literal_check.py`, `startup_gfx2hlsl_shift64_check.py`, `startup_gfx2hlsl_mad64_check.py`, `startup_gfx2hlsl_scalar_shift64_bfe_check.py`, `python3 -m unittest tests.rdna2_tools_check -k shift64`: PASS. With `tools/startup/gfx2hlsl.py` from `origin/main` the literal check fails (`Unsupported: 64-bit source 0x41`). - Win2025 (D3D12 WARP): `ctest --preset dev` and `--preset release` `-R '^(startup_gfx2hlsl_shift64_literal|startup_gfx2hlsl_shift64_controls|startup_gfx2hlsl_shift64_warp|startup_gfx2hlsl_scalar_shift64_bfe_controls|startup_gfx2hlsl_mad64.*)$'`: 7/7 passed on dev, 7/7 on release; `tests/rdna2_tools_check.py` ok. - Real GPU (RTX 3090 through vkd3d-proton, Linux): pending. AI-assisted; commands listed were executed locally.
chatgpt-codex-connector[bot commented 2026-11-25 00:05:05 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T23:38:58Z.

Review: COMMENTED


💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 19a3637896

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6049177858 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2039#pullrequestreview-6049177858). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T23:38:58Z. **Review:** COMMENTED --- <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `19a3637896` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details>
chatgpt-codex-connector[bot commented 2026-11-25 01:01:57 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T23:32:28Z.


Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T23:39:01.193250Z 19a3637 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147515955 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2039#issuecomment-7147515955). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T23:32:28Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"19a363789690e2176b853d544f4a21b8146d40db","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T23:39:01.193250Z">2026-11-24T23:39:01.193250Z</relative-time> | `19a3637` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
chatgpt-codex-connector[bot commented 2026-11-25 01:02:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T23:38:58Z.

Code review location: tools/startup/gfx2hlsl.py; line 1429

@@ -1423,6 +1424,9 @@ def i64_words(self, tok):
         if re.fullmatch(r'0|-?[1-9]\d*', tok) and -16 <= int(tok) <= 64:
             value = int(tok) & 0xffffffffffffffff
             return '%du' % (value & 0xffffffff), '%du' % (value >> 32)
+        if re.fullmatch(r'0x[0-9a-f]{1,8}', tok):
+            word = int(tok, 16)
+            return '%du' % word, ('4294967295u' if signed and word >> 31 else '0u')

P1 Badge Document the newly supported 64-bit literal sources

This expands a public translator capability, but the startup-shift description in docs/experiments.md:6251–6258 still lists only register pairs and inline integers and provides no reproduction command for literal sources. Update that section with the accepted 32-bit hex form, the zero/sign-extension assumption, remaining refusals, and the new startup_gfx2hlsl_shift64_literal check. Root AGENTS.md explicitly requires updating the public documentation when a capability changes.

AGENTS.md reference: AGENTS.md:L210-L211

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4688072822 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2039#discussion_r4688072822). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T23:38:58Z. **Code review location:** `tools/startup/gfx2hlsl.py`; line 1429 ~~~~diff @@ -1423,6 +1424,9 @@ def i64_words(self, tok): if re.fullmatch(r'0|-?[1-9]\d*', tok) and -16 <= int(tok) <= 64: value = int(tok) & 0xffffffffffffffff return '%du' % (value & 0xffffffff), '%du' % (value >> 32) + if re.fullmatch(r'0x[0-9a-f]{1,8}', tok): + word = int(tok, 16) + return '%du' % word, ('4294967295u' if signed and word >> 31 else '0u') ~~~~ --- **<sub><sub>![P1 Badge](https://img.shields.io/badge/P1-orange?style=flat)</sub></sub> Document the newly supported 64-bit literal sources** This expands a public translator capability, but the startup-shift description in `docs/experiments.md:6251–6258` still lists only register pairs and inline integers and provides no reproduction command for literal sources. Update that section with the accepted 32-bit hex form, the zero/sign-extension assumption, remaining refusals, and the new `startup_gfx2hlsl_shift64_literal` check. Root `AGENTS.md` explicitly requires updating the public documentation when a capability changes. AGENTS.md reference: [AGENTS.md:L210-L211](https://github.com/R0Y00/Xbox2Windows/blob/19a363789690e2176b853d544f4a21b8146d40db/AGENTS.md#L210-L211) Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
tedin7 commented 2026-11-25 02:01:30 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:28:33Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6050168582 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2039#pullrequestreview-6050168582). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T01:28:33Z. **Review:** COMMENTED --- _No description provided._
tedin7 commented 2026-11-25 02:02:05 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:13:45Z.


Fixed and pushed in df127ec8 (docs updated, tests pass).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7149335433 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2039#issuecomment-7149335433). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T01:13:45Z. --- Fixed and pushed in df127ec8 (docs updated, tests pass).
tedin7 commented 2026-11-25 02:02:14 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:28:33Z.

Code review location: tools/startup/gfx2hlsl.py; line 1429

@@ -1423,6 +1424,9 @@ def i64_words(self, tok):
         if re.fullmatch(r'0|-?[1-9]\d*', tok) and -16 <= int(tok) <= 64:
             value = int(tok) & 0xffffffffffffffff
             return '%du' % (value & 0xffffffff), '%du' % (value >> 32)
+        if re.fullmatch(r'0x[0-9a-f]{1,8}', tok):
+            word = int(tok, 16)
+            return '%du' % word, ('4294967295u' if signed and word >> 31 else '0u')

Fixed in df127ec8. docs/experiments.md (64-bit VOP3 shift paragraph) now covers the 32-bit hex literal source, the zero/sign-extension assumption, the remaining refusals, and the startup_gfx2hlsl_shift64_literal ctest command. Verification (Linux): python3 tests/startup_gfx2hlsl_shift64_literal_check.py and startup_gfx2hlsl_shift64_check.py -> pass. Windows/WARP not run.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4688948150 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2039#discussion_r4688948150). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T01:28:33Z. **Code review location:** `tools/startup/gfx2hlsl.py`; line 1429 ~~~~diff @@ -1423,6 +1424,9 @@ def i64_words(self, tok): if re.fullmatch(r'0|-?[1-9]\d*', tok) and -16 <= int(tok) <= 64: value = int(tok) & 0xffffffffffffffff return '%du' % (value & 0xffffffff), '%du' % (value >> 32) + if re.fullmatch(r'0x[0-9a-f]{1,8}', tok): + word = int(tok, 16) + return '%du' % word, ('4294967295u' if signed and word >> 31 else '0u') ~~~~ --- Fixed in df127ec8. docs/experiments.md (64-bit VOP3 shift paragraph) now covers the 32-bit hex literal source, the zero/sign-extension assumption, the remaining refusals, and the `startup_gfx2hlsl_shift64_literal` ctest command. Verification (Linux): `python3 tests/startup_gfx2hlsl_shift64_literal_check.py` and `startup_gfx2hlsl_shift64_check.py` -> pass. Windows/WARP not run. AI-assisted; commands listed were executed locally.
thepatrickworld commented 2026-11-25 13:01:04 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-25T13:00:38Z.


Run at head df127ec8, on the AMD adapter, backend hardware, both compilers.

startup_flat_param words=deadbeef,cafebabe,80000000,c0000000
dxc v_ashrrev_i64 draw 3: deadbeef,cafebabe,80000000,c0000000

12 readbacks per compiler over v_lshlrev_b64, v_lshrrev_b64 and v_ashrrev_i64, all matching, with three mutation runs per compiler that fail as they should. The sign-filling case is in the run above: 0x80000000,c0000000 read back unchanged through the arithmetic shift.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7163163590 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2039#issuecomment-7163163590). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-25T13:00:38Z. --- Run at head `df127ec8`, on the AMD adapter, backend `hardware`, both compilers. ``` startup_flat_param words=deadbeef,cafebabe,80000000,c0000000 dxc v_ashrrev_i64 draw 3: deadbeef,cafebabe,80000000,c0000000 ``` 12 readbacks per compiler over `v_lshlrev_b64`, `v_lshrrev_b64` and `v_ashrrev_i64`, all matching, with three mutation runs per compiler that fail as they should. The sign-filling case is in the run above: `0x80000000,c0000000` read back unchanged through the arithmetic shift. _AI-assisted._
upstream-sync closed this pull request 2026-11-25 14:04:30 +00:00
tedin7 commented 2026-11-25 14:05:11 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T13:45:10Z.


Thanks for the hardware run. It was at head df127ec8, which is the current head of this PR.

All 12 readbacks per compiler match on the AMD hardware backend. The sign-filling case (80000000,c0000000 through v_ashrrev_i64) is unchanged, and the three mutation runs fail as expected. This confirms the 64-bit shift lowering on real hardware. No code change is needed.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7164237807 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2039#issuecomment-7164237807). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T13:45:10Z. --- Thanks for the hardware run. It was at head `df127ec8`, which is the current head of this PR. All 12 readbacks per compiler match on the AMD hardware backend. The sign-filling case (`80000000,c0000000` through `v_ashrrev_i64`) is unchanged, and the three mutation runs fail as expected. This confirms the 64-bit shift lowering on real hardware. No code change is needed. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 14:05:13 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T13:51:00Z.


Closing this PR for now to keep the Windows test queue short. Nothing is wrong with it and the branch stays as it is.

We will reopen it once the queue is clear, re-run the Win2025 WARP checks at its head, and post the result here.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7164380437 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2039#issuecomment-7164380437). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T13:51:00Z. --- Closing this PR for now to keep the Windows test queue short. Nothing is wrong with it and the branch stays as it is. We will reopen it once the queue is clear, re-run the Win2025 WARP checks at its head, and post the result here. AI-assisted; commands listed were executed locally.
upstream-sync reopened this pull request 2026-11-25 23:01:40 +00:00
NiiRoZz commented 2026-11-25 23:02:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-25T22:29:53Z.


A data point from a local request cache, in case it helps prioritise this (counts only).

  • 104 requests there refuse first with 64-bit source <literal>. All 170 failing instructions have one shape: v_lshrrev_b64 v[a:a+1], 0, 0x<literal>, a shift by 0 used as a 64-bit constant move into a VGPR pair. No scalar instruction and no EXEC or VCC destination raises it.
  • With this PR's change applied on top of a local tree (the five files of this PR, nothing else), none of the 104 stops at that refusal any more. tests/startup_gfx2hlsl_shift64_literal_check.py passes there. None of them translates fully yet; they go on to unrelated refusals.
  • In 81 of the 104 every literal has bit 31 clear, so zero and sign extension give the same pair. In 23 at least one literal has bit 31 set (for example 0xffffffff, 0x80000001), all through v_lshrrev_b64, so those rely on the zero-extension rule this PR takes for the unsigned shifts. I could not find that rule stated for a 32-bit literal on a 64-bit vector operand in the LLVM sources I read, so for those 23 it stays an assumption on our side as well; the hardware readbacks above cover the lowering, not that rule on the console.

Not measured: any effect at run time. The counts come from one local cache and were taken on a tree that is not current main.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7176435232 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2039#issuecomment-7176435232). Originally posted by [NiiRoZz](https://github.com/NiiRoZz) on 2026-11-25T22:29:53Z. --- A data point from a local request cache, in case it helps prioritise this (counts only). - 104 requests there refuse first with `64-bit source <literal>`. All 170 failing instructions have one shape: `v_lshrrev_b64 v[a:a+1], 0, 0x<literal>`, a shift by 0 used as a 64-bit constant move into a VGPR pair. No scalar instruction and no EXEC or VCC destination raises it. - With this PR's change applied on top of a local tree (the five files of this PR, nothing else), none of the 104 stops at that refusal any more. `tests/startup_gfx2hlsl_shift64_literal_check.py` passes there. None of them translates fully yet; they go on to unrelated refusals. - In 81 of the 104 every literal has bit 31 clear, so zero and sign extension give the same pair. In 23 at least one literal has bit 31 set (for example `0xffffffff`, `0x80000001`), all through `v_lshrrev_b64`, so those rely on the zero-extension rule this PR takes for the unsigned shifts. I could not find that rule stated for a 32-bit literal on a 64-bit vector operand in the LLVM sources I read, so for those 23 it stays an assumption on our side as well; the hardware readbacks above cover the lowering, not that rule on the console. Not measured: any effect at run time. The counts come from one local cache and were taken on a tree that is not current `main`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
tedin7 commented 2026-11-25 23:02:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T22:34:44Z.


Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit 45a18be54f9a0804ffbfa2b5f20f50e958b35650:

  • Debug (--preset dev): ctest --preset dev -R shift64 --no-tests=error --output-on-failure: 7/7 passed (startup_gfx2hlsl_shift64_warp, startup_gfx2hlsl_shift64_hardware, startup_gfx2hlsl_shift64_literal, startup_gfx2hlsl_shift64_controls, startup_gfx2hlsl_scalar_shift64_bfe_controls, pixel_aot_shift64_warp, pixel_aot_shift64_hardware)
  • Release /O2 (--preset release): same command and same 7 tests: 7/7 passed

What changed since df127ec8: merged origin/main (no conflicts), and fixed one bug found in review: a 32-bit hex literal as the source of s_ashr_i64 is now sign-extended, like the vector form. startup_gfx2hlsl_shift64_literal has two new checks for it (s_ashr_i64 and s_lshr_b64 with 0xffffffff); the s_ashr_i64 check fails without the fix.

Not covered here: the hex literal as the 64-bit value has no GPU readback yet (the draws use the literal only as the shift amount), and the one-scalar-or-literal constant-bus rule in the docs is not enforced by the translator (same on main).

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7176536509 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2039#issuecomment-7176536509). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T22:34:44Z. --- Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `45a18be54f9a0804ffbfa2b5f20f50e958b35650`: - **Debug (`--preset dev`)**: `ctest --preset dev -R shift64 --no-tests=error --output-on-failure`: **7/7 passed** (`startup_gfx2hlsl_shift64_warp`, `startup_gfx2hlsl_shift64_hardware`, `startup_gfx2hlsl_shift64_literal`, `startup_gfx2hlsl_shift64_controls`, `startup_gfx2hlsl_scalar_shift64_bfe_controls`, `pixel_aot_shift64_warp`, `pixel_aot_shift64_hardware`) - **Release `/O2` (`--preset release`)**: same command and same 7 tests: **7/7 passed** What changed since `df127ec8`: merged `origin/main` (no conflicts), and fixed one bug found in review: a 32-bit hex literal as the source of `s_ashr_i64` is now sign-extended, like the vector form. `startup_gfx2hlsl_shift64_literal` has two new checks for it (`s_ashr_i64` and `s_lshr_b64` with `0xffffffff`); the `s_ashr_i64` check fails without the fix. Not covered here: the hex literal as the 64-bit value has no GPU readback yet (the draws use the literal only as the shift amount), and the one-scalar-or-literal constant-bus rule in the docs is not enforced by the translator (same on main). AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 23:02:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T22:34:45Z.


@MasterDomino #2039 is ready for review/merge.

  • What changed: merged origin/main (clean), plus a fix so a 32-bit hex literal as the source of s_ashr_i64 is sign-extended (new check in startup_gfx2hlsl_shift64_literal).
  • Head: 45a18be5. CI green. Win2025 WARP dev+release receipt above: 7/7 shift64 tests pass on both presets.
  • Known gaps, same as before this merge: no GPU readback for the hex literal as a 64-bit value, and the constant-bus rule is documented but not enforced.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7176536843 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2039#issuecomment-7176536843). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T22:34:45Z. --- @MasterDomino #2039 is ready for review/merge. - What changed: merged `origin/main` (clean), plus a fix so a 32-bit hex literal as the source of `s_ashr_i64` is sign-extended (new check in `startup_gfx2hlsl_shift64_literal`). - Head: `45a18be5`. CI green. Win2025 WARP dev+release receipt above: 7/7 shift64 tests pass on both presets. - Known gaps, same as before this merge: no GPU readback for the hex literal as a 64-bit value, and the constant-bus rule is documented but not enforced. AI-assisted; commands listed were executed locally.
Leyukaka commented 2026-11-26 02:05:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-26T01:43:39Z.


A second capture, consistent with the data point above (local, counts and instruction shape only), at main 7287979. 55 requests stop at 64-bit source <literal>, all v_lshrrev_b64 with an inline shift. In 3 the literal has bit 31 set (0xffffffff twice, 0x80000001 once).

I did not run this branch. With main's translator plus an in-memory wrap of Stage.i64_words that gives (word, 0) for a hex literal of at most 8 digits (what this PR does for v_lshrrev_b64):

  • 4 of the 55 translate;
  • 25 stop next at s_bfm_b64 (#2007);
  • the rest stop at unrelated refusals, at most 4 each.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7180063718 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2039#issuecomment-7180063718). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-26T01:43:39Z. --- A second capture, consistent with the data point above (local, counts and instruction shape only), at main `7287979`. 55 requests stop at `64-bit source <literal>`, all `v_lshrrev_b64` with an inline shift. In 3 the literal has bit 31 set (`0xffffffff` twice, `0x80000001` once). I did not run this branch. With main's translator plus an in-memory wrap of `Stage.i64_words` that gives `(word, 0)` for a hex literal of at most 8 digits (what this PR does for `v_lshrrev_b64`): - 4 of the 55 translate; - 25 stop next at `s_bfm_b64` (#2007); - the rest stop at unrelated refusals, at most 4 each. AI-assisted.
tedin7 commented 2026-11-26 04:04:36 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T03:17:53Z.


@Leyukaka thank you for the second capture, and @NiiRoZz for the first one.

No code change is needed here. I checked Stage.i64_words at head 45a18be5 (tools/startup/gfx2hlsl.py): a hex literal of at most 8 digits gives (word, 0) for the unsigned shifts, so v_lshrrev_b64 with 0xffffffff or 0x80000001 zero-extends. That is the same mapping as your in-memory wrap. Only the signed form (s_ashr_i64) sign-extends, and startup_gfx2hlsl_shift64_check.py covers both.

The 25 requests that stop next at s_bfm_b64 belong to #2007, so I left them out of this PR on purpose.

Head 45a18be5 is unchanged, CI is green and the branch is mergeable. @MasterDomino nothing new to review on #2039.

Commands run locally: gh pr view 2039 (head, CI, mergeStateStatus) and git show 45a18be5:tools/startup/gfx2hlsl.py | sed -n 5602,5626p.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7181583691 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2039#issuecomment-7181583691). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T03:17:53Z. --- @Leyukaka thank you for the second capture, and @NiiRoZz for the first one. No code change is needed here. I checked `Stage.i64_words` at head `45a18be5` (`tools/startup/gfx2hlsl.py`): a hex literal of at most 8 digits gives `(word, 0)` for the unsigned shifts, so `v_lshrrev_b64` with `0xffffffff` or `0x80000001` zero-extends. That is the same mapping as your in-memory wrap. Only the signed form (`s_ashr_i64`) sign-extends, and `startup_gfx2hlsl_shift64_check.py` covers both. The 25 requests that stop next at `s_bfm_b64` belong to #2007, so I left them out of this PR on purpose. Head `45a18be5` is unchanged, CI is green and the branch is mergeable. @MasterDomino nothing new to review on #2039. Commands run locally: `gh pr view 2039` (head, CI, mergeStateStatus) and `git show 45a18be5:tools/startup/gfx2hlsl.py | sed -n 5602,5626p`. AI-assisted; commands listed were executed locally.
MasterDomino commented 2026-11-26 06:01:44 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-26T05:31:14Z.

Review: CHANGES_REQUESTED


Requesting one small change at 45a18be5.

The vector lowering looks right. A 32-bit hex literal fills the low word, and the high word is zero for v_lshlrev_b64/v_lshrrev_b64 and copies bit 31 for v_ashrrev_i64. Wider literals and literal destinations stay refused.

The problem is in scalar_wide_op (tools/startup/gfx2hlsl.py:3755). It now passes helper == 'shr64i' to i64_words as the signedness. But s_bfe_u64 and s_bfe_i64 both use helper bfe64 and differ only in signed (:3804, :3807). So s_bfe_i64 with a hex literal source, refused before this PR, is now accepted with the literal zero-extended.

  • Example: s_bfe_i64 s[20:21], 0x80000000, s9 emits bfe64(2147483648u, 0u, s9, 1u). Under the rule this PR states (sign-extend when the operation is signed), the high word should be 4294967295u. Any field that reaches bit 32 or above reads differently.
  • Suggested fix: self.i64_words(ops[1], helper == 'shr64i' or signed is True), plus an s_bfe_i64 row in startup_gfx2hlsl_shift64_literal_check.py. With that change applied locally, the shift64 and bfe tests still pass.

Docs: please also extend the paragraph.

  • The PR newly accepts hex literals as the 64-bit source of s_lshl_b64, s_lshr_b64, s_ashr_i64, s_bfe_u64 and s_bfe_i64, not only of the vector shifts.
  • "the rule the scalar 64-bit operations use" reads as an existing precedent, but scalar shift and bfe literals were refused until this PR. Only s_mov_b64 zero-extended a hex literal before.

Cache revision: no bump needed, since only formerly refused programs change.

Verified locally (Windows 11 build 26300; WARP 10.0.26100.9818 and AMD Radeon RX 9070 XT, driver 32.0.32029.2010; debug layer on):

  • ctest --preset dev --no-tests=error -j4 -R shift64: 7/7 passed, 0 skipped.
  • ctest --preset dev --no-tests=error -j4 -R startup_gfx2hlsl: 169/170. The one failure, startup_gfx2hlsl_fma_mix_dispatch_hardware, also fails on this adapter without this PR, so this PR didn't cause it.
  • The branch is 168 commits behind main but merges cleanly, and the shift64/bfe Python checks pass on the merged tree.
  • Mutants: five one-line mutants of the new code (no sign fill, 9-digit literals, the scalar signed flag dropped, the vector call always signed, bit 30 in place of bit 31) were all caught, but only by the string-match startup_gfx2hlsl_shift64_literal. As already noted, no draw reads a literal 64-bit value back yet.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6069005042 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2039#pullrequestreview-6069005042). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-26T05:31:14Z. **Review:** CHANGES_REQUESTED --- Requesting one small change at `45a18be5`. The vector lowering looks right. A 32-bit hex literal fills the low word, and the high word is zero for `v_lshlrev_b64`/`v_lshrrev_b64` and copies bit 31 for `v_ashrrev_i64`. Wider literals and literal destinations stay refused. **The problem is in `scalar_wide_op`** (`tools/startup/gfx2hlsl.py:3755`). It now passes `helper == 'shr64i'` to `i64_words` as the signedness. But `s_bfe_u64` and `s_bfe_i64` both use helper `bfe64` and differ only in `signed` (`:3804`, `:3807`). So `s_bfe_i64` with a hex literal source, refused before this PR, is now accepted with the literal zero-extended. - **Example:** `s_bfe_i64 s[20:21], 0x80000000, s9` emits `bfe64(2147483648u, 0u, s9, 1u)`. Under the rule this PR states (sign-extend when the operation is signed), the high word should be `4294967295u`. Any field that reaches bit 32 or above reads differently. - **Suggested fix:** `self.i64_words(ops[1], helper == 'shr64i' or signed is True)`, plus an `s_bfe_i64` row in `startup_gfx2hlsl_shift64_literal_check.py`. With that change applied locally, the shift64 and bfe tests still pass. **Docs:** please also extend the paragraph. - The PR newly accepts hex literals as the 64-bit source of `s_lshl_b64`, `s_lshr_b64`, `s_ashr_i64`, `s_bfe_u64` and `s_bfe_i64`, not only of the vector shifts. - "the rule the scalar 64-bit operations use" reads as an existing precedent, but scalar shift and bfe literals were refused until this PR. Only `s_mov_b64` zero-extended a hex literal before. **Cache revision:** no bump needed, since only formerly refused programs change. **Verified locally** (Windows 11 build 26300; WARP 10.0.26100.9818 and AMD Radeon RX 9070 XT, driver 32.0.32029.2010; debug layer on): - `ctest --preset dev --no-tests=error -j4 -R shift64`: 7/7 passed, 0 skipped. - `ctest --preset dev --no-tests=error -j4 -R startup_gfx2hlsl`: 169/170. The one failure, `startup_gfx2hlsl_fma_mix_dispatch_hardware`, also fails on this adapter without this PR, so this PR didn't cause it. - The branch is 168 commits behind `main` but merges cleanly, and the shift64/bfe Python checks pass on the merged tree. - **Mutants:** five one-line mutants of the new code (no sign fill, 9-digit literals, the scalar signed flag dropped, the vector call always signed, bit 30 in place of bit 31) were all caught, but only by the string-match `startup_gfx2hlsl_shift64_literal`. As already noted, no draw reads a literal 64-bit value back yet. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-26 06:04:42 +00:00
MasterDomino commented 2026-11-26 06:04:42 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-26T06:04:35Z.

Review: APPROVED


Approving 51842db4; the change request is resolved.

  • The fix: 0c4e94a3 passes helper == 'shr64i' or signed is True to i64_words, so a hex literal source of s_bfe_i64 is sign-extended and s_bfe_u64 stays zero-extended.
  • Pinned: both cases now have rows in startup_gfx2hlsl_shift64_literal_check (bfe64(4294967295u, 4294967295u, s9, 1u) against bfe64(4294967295u, 0u, s9, 0u)).
  • Docs: the paragraph now covers the scalar shifts and the bitfield extracts.
  • 51842db4 tightens the change: a hex literal is now accepted only on the shift and bitfield-extract paths (the literal flag on i64_words). It stays refused as the 64-bit addend of v_mad_u64_u32 / v_mad_i64_i32, which now has a refusal row, and the scanner pattern and the Linux CI list match.

Pure-Python checks at this head, all passing (Windows 11 build 26300):

  • startup_gfx2hlsl_shift64_literal_check
  • startup_gfx2hlsl_scalar_shift64_bfe_check (3498 helper cases)
  • startup_gfx2hlsl_shift64_check
  • rdna2_tools_check (19 skips, none failed)

The WARP and RX 9070 XT runs from my earlier review were at 45a18be5; the only code changes since are the signedness fix and the narrower literal acceptance. CI is green at this head.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6069274261 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2039#pullrequestreview-6069274261). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-26T06:04:35Z. **Review:** APPROVED --- Approving `51842db4`; the change request is resolved. - **The fix:** `0c4e94a3` passes `helper == 'shr64i' or signed is True` to `i64_words`, so a hex literal source of `s_bfe_i64` is sign-extended and `s_bfe_u64` stays zero-extended. - **Pinned:** both cases now have rows in `startup_gfx2hlsl_shift64_literal_check` (`bfe64(4294967295u, 4294967295u, s9, 1u)` against `bfe64(4294967295u, 0u, s9, 0u)`). - **Docs:** the paragraph now covers the scalar shifts and the bitfield extracts. - **`51842db4` tightens the change:** a hex literal is now accepted only on the shift and bitfield-extract paths (the `literal` flag on `i64_words`). It stays refused as the 64-bit addend of `v_mad_u64_u32` / `v_mad_i64_i32`, which now has a refusal row, and the scanner pattern and the Linux CI list match. Pure-Python checks at this head, all passing (Windows 11 build 26300): - `startup_gfx2hlsl_shift64_literal_check` - `startup_gfx2hlsl_scalar_shift64_bfe_check` (3498 helper cases) - `startup_gfx2hlsl_shift64_check` - `rdna2_tools_check` (19 skips, none failed) The WARP and RX 9070 XT runs from my earlier review were at `45a18be5`; the only code changes since are the signedness fix and the narrower literal acceptance. CI is green at this head. AI-assisted; commands listed were executed locally.
thepatrickworld commented 2026-11-26 06:04:46 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-26T06:02:13Z.


Checked on 51842db4: both new rows bite — each fails on the head that preceded its fix. Text-level check of the emitted lowering; no GPU involved.

Command

add_test at CMakeLists.txt:4267 runs the check with ${INTAKE_PYTHON} -B, pure Python, no build target:

ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_shift64_literal$' -V

The runs below call the script directly, with the pe-env Python 3.15 on Windows 11 25H2 build 26200.9974, swapping only tools/startup/gfx2hlsl.py and the check out of this branch's own history (git show <ref>:<path>, then git checkout --):

translator 51842db4 + check 51842db4   rc=0
translator b9208cd7 + check 51842db4   rc=1  AssertionError: a hex literal stays refused as the addend of v_mad_u64_u32 and v_mad_i64_i32
translator 45a18be5 + check 51842db4   rc=1  AssertionError: s_bfe_i64 literal 0xffffffff is sign-extended

Reading

  • 45a18be5 is the head the review was written on: the s_bfe_i64 row fails there, and the emitted text says why — bfe64(4294967295u, 0u, s9, 1u) on that head, bfe64(4294967295u, 4294967295u, s9, 1u) on b9208cd7.
  • b9208cd7 is the head just before 51842db4: the addend row fails there, so the follow-up is pinned by the fixture, not only applied. After the change i64_words takes literal as a third argument (tools/startup/gfx2hlsl.py:7632) and only the two call sites that need it pass it (:5173 for the scalar shifts and bfe, :7663); the v_mad addend at :7831 keeps the default and stays refused.
  • Dropping or signed is True from the call at :5173 reproduces the zero-extended word and the same s_bfe_i64 assertion on b9208cd7; on 51842db4 the same edit also drops literal=True, so the literal is refused there (Unsupported: 64-bit source 0xffffffff). Both measured: the added rows are what separate these heads in this fixture.
  • 0c4e94a3 extends the docs/experiments.md paragraph to the five scalar forms and the sign rule, so the documentation half of the review is covered as well.

Limits

Emitted text of the lowering checked by the branch's own assertions, not an instruction-level measurement: the change only turns formerly refused programs into accepted ones, so there is nothing to draw on a GPU. One translation per form.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7184032520 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2039#issuecomment-7184032520). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-26T06:02:13Z. --- **Checked on `51842db4`: both new rows bite — each fails on the head that preceded its fix. Text-level check of the emitted lowering; no GPU involved.** ### Command `add_test` at `CMakeLists.txt:4267` runs the check with `${INTAKE_PYTHON} -B`, pure Python, no build target: ``` ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_shift64_literal$' -V ``` The runs below call the script directly, with the `pe-env` Python 3.15 on Windows 11 25H2 build 26200.9974, swapping only `tools/startup/gfx2hlsl.py` and the check out of this branch's own history (`git show <ref>:<path>`, then `git checkout --`): ``` translator 51842db4 + check 51842db4 rc=0 translator b9208cd7 + check 51842db4 rc=1 AssertionError: a hex literal stays refused as the addend of v_mad_u64_u32 and v_mad_i64_i32 translator 45a18be5 + check 51842db4 rc=1 AssertionError: s_bfe_i64 literal 0xffffffff is sign-extended ``` ### Reading - `45a18be5` is the head the review was written on: the `s_bfe_i64` row fails there, and the emitted text says why — `bfe64(4294967295u, 0u, s9, 1u)` on that head, `bfe64(4294967295u, 4294967295u, s9, 1u)` on `b9208cd7`. - `b9208cd7` is the head just before `51842db4`: the addend row fails there, so the follow-up is pinned by the fixture, not only applied. After the change `i64_words` takes `literal` as a third argument (`tools/startup/gfx2hlsl.py:7632`) and only the two call sites that need it pass it (`:5173` for the scalar shifts and `bfe`, `:7663`); the `v_mad` addend at `:7831` keeps the default and stays refused. - Dropping `or signed is True` from the call at `:5173` reproduces the zero-extended word and the same `s_bfe_i64` assertion on `b9208cd7`; on `51842db4` the same edit also drops `literal=True`, so the literal is refused there (`Unsupported: 64-bit source 0xffffffff`). Both measured: the added rows are what separate these heads in this fixture. - `0c4e94a3` extends the `docs/experiments.md` paragraph to the five scalar forms and the sign rule, so the documentation half of the review is covered as well. ### Limits Emitted text of the lowering checked by the branch's own assertions, not an instruction-level measurement: the change only turns formerly refused programs into accepted ones, so there is nothing to draw on a GPU. One translation per form. _AI-assisted._
tedin7 commented 2026-11-26 08:01:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T07:18:06Z.


@MasterDomino fixed in 51842db4 (merged current main, no rebase).

  • s_bfe_i64 with a hex literal source now sign-extends: s_bfe_i64 s[20:21], 0xffffffff, s9 emits bfe64(4294967295u, 4294967295u, s9, 1u). scalar_wide_op passes helper == 'shr64i' or signed is True, as you suggested. startup_gfx2hlsl_shift64_literal_check.py has new s_bfe_i64 and s_bfe_u64 rows; the s_bfe_i64 row fails without the change and passes with it.
  • Docs: the paragraph now says the hex literal is also the 64-bit source of s_lshl_b64, s_lshr_b64, s_ashr_i64, s_bfe_u64 and s_bfe_i64, that only s_mov_b64 zero-extended a hex literal before, and that the extension rule is an assumption.
  • Found while pre-reviewing: i64_words also feeds v_mad_u64_u32 and v_mad_i64_i32, which would have started accepting a hex addend (zero-extended even when signed). The hex path is now opt-in per caller, so those two stay refused, with a check for it.
  • Also aligned: the scanner accepts v_lshlrev_b64 v[2:3], v1, 0x41 (the rdna2_tools_check.py case moved to supported; a scalar amount plus a literal value stays refused), and the new pure-Python check runs in the Linux CI job.

Verification:

  • Linux: python3 tests/startup_gfx2hlsl_shift64_literal_check.py, startup_gfx2hlsl_shift64_check.py, startup_gfx2hlsl_mad64_check.py, startup_gfx2hlsl_scalar_shift64_bfe_check.py, startup_gfx2hlsl_bit_alu_check.py, python3 -m unittest tests.rdna2_tools_check -k shift64: all pass. CI green on 51842db4.
  • Win2025 (WARP) at 51842db4f9a5ec1e487771f30070dfab8521e2b3: ctest --preset dev and --preset release -R '^(startup_gfx2hlsl_shift64_literal|startup_gfx2hlsl_shift64_controls|startup_gfx2hlsl_shift64_warp|startup_gfx2hlsl_scalar_shift64_bfe_controls|startup_gfx2hlsl_mad64.*)$': 7/7 passed on dev, 7/7 on release; tests/rdna2_tools_check.py ok.

Re-requesting your review.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7185309422 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2039#issuecomment-7185309422). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T07:18:06Z. --- @MasterDomino fixed in `51842db4` (merged current `main`, no rebase). - `s_bfe_i64` with a hex literal source now sign-extends: `s_bfe_i64 s[20:21], 0xffffffff, s9` emits `bfe64(4294967295u, 4294967295u, s9, 1u)`. `scalar_wide_op` passes `helper == 'shr64i' or signed is True`, as you suggested. `startup_gfx2hlsl_shift64_literal_check.py` has new `s_bfe_i64` and `s_bfe_u64` rows; the `s_bfe_i64` row fails without the change and passes with it. - Docs: the paragraph now says the hex literal is also the 64-bit source of `s_lshl_b64`, `s_lshr_b64`, `s_ashr_i64`, `s_bfe_u64` and `s_bfe_i64`, that only `s_mov_b64` zero-extended a hex literal before, and that the extension rule is an assumption. - Found while pre-reviewing: `i64_words` also feeds `v_mad_u64_u32` and `v_mad_i64_i32`, which would have started accepting a hex addend (zero-extended even when signed). The hex path is now opt-in per caller, so those two stay refused, with a check for it. - Also aligned: the scanner accepts `v_lshlrev_b64 v[2:3], v1, 0x41` (the `rdna2_tools_check.py` case moved to supported; a scalar amount plus a literal value stays refused), and the new pure-Python check runs in the Linux CI job. Verification: - Linux: `python3 tests/startup_gfx2hlsl_shift64_literal_check.py`, `startup_gfx2hlsl_shift64_check.py`, `startup_gfx2hlsl_mad64_check.py`, `startup_gfx2hlsl_scalar_shift64_bfe_check.py`, `startup_gfx2hlsl_bit_alu_check.py`, `python3 -m unittest tests.rdna2_tools_check -k shift64`: all pass. CI green on `51842db4`. - Win2025 (WARP) at `51842db4f9a5ec1e487771f30070dfab8521e2b3`: `ctest --preset dev` and `--preset release` `-R '^(startup_gfx2hlsl_shift64_literal|startup_gfx2hlsl_shift64_controls|startup_gfx2hlsl_shift64_warp|startup_gfx2hlsl_scalar_shift64_bfe_controls|startup_gfx2hlsl_mad64.*)$'`: 7/7 passed on dev, 7/7 on release; `tests/rdna2_tools_check.py` ok. Re-requesting your review. AI-assisted; commands listed were executed locally.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!2032
No description provided.