diff options
| author | Codex <codex@localhost> | 2026-11-23 19:53:07 +0100 |
|---|---|---|
| committer | Codex <codex@localhost> | 2026-11-23 19:53:07 +0100 |
| commit | 6ecd922d99f57b4c8a4e815930caa1c855f4e252 (patch) | |
| tree | 92ae4ed8adddb15b1c376606d6ad9f1b3ad8d599 /tools/rdna2spirv.py | |
| parent | d9aa42a16ee860b3b1463af6a53f4889c1f7b2af (diff) | |
rdna2spirv: lower scalar bit replication into EXEC
A 32-bit scalar source provides each lane's bit at L / 2.
Use the existing EXEC state for the destination and keep SCC.
Check all 64 lane results, including the high source bit,
with a synthetic compute program.
Diffstat (limited to 'tools/rdna2spirv.py')
| -rw-r--r-- | tools/rdna2spirv.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/rdna2spirv.py b/tools/rdna2spirv.py index 4680062ac..901d054f7 100644 --- a/tools/rdna2spirv.py +++ b/tools/rdna2spirv.py | |||
| @@ -6833,8 +6833,20 @@ class Gen: | |||
| 6833 | d, x = a[0], a[1] | 6833 | d, x = a[0], a[1] |
| 6834 | wide_src = op == "s_quadmask_b64" | 6834 | wide_src = op == "s_quadmask_b64" |
| 6835 | wide_dst = op != "s_quadmask_b32" | 6835 | wide_dst = op != "s_quadmask_b32" |
| 6836 | if self.is_mask_op(x) or (d["k"] == "special" and d.get("t", "").startswith(("exec", "vcc"))): | 6836 | if self.is_mask_op(x): |
| 6837 | raise Unsupported(op + " on a lane mask") | 6837 | raise Unsupported(op + " on a lane mask") |
| 6838 | if d["k"] == "special" and d.get("t", "").startswith(("exec", "vcc")): | ||
| 6839 | if op != "s_bitreplicate_b64_b32" or d["t"] != "exec": | ||
| 6840 | raise Unsupported(op + " on a lane mask") | ||
| 6841 | # EXEC's bit for lane L comes from scalar-source bit L // 2. | ||
| 6842 | shift, shifted, bit = (self.tmp() for _ in range(3)) | ||
| 6843 | lane = self.wave_lane() | ||
| 6844 | word = self.src_u(x) | ||
| 6845 | self.emit(f"{shift} = OpShiftRightLogical %uint {lane} {self.cu(1)}") | ||
| 6846 | self.emit(f"{shifted} = OpShiftRightLogical %uint {word} {shift}") | ||
| 6847 | self.emit(f"{bit} = OpBitwiseAnd %uint {shifted} {self.cu(1)}") | ||
| 6848 | self.set_exec(bit) | ||
| 6849 | return | ||
| 6838 | if wide_src: | 6850 | if wide_src: |
| 6839 | lo, hi = self.src64_data(x, op) | 6851 | lo, hi = self.src64_data(x, op) |
| 6840 | words = [lo, hi] | 6852 | words = [lo, hi] |