upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonEyes <ducoinbenjamin@yahoo.fr>2026-12-01 14:51:25 +0100
committerGitHub <noreply@github.com>2026-12-01 14:51:25 +0100
commit3e7b34a52aed802e7d84cd9333cdfd0d194a723d (patch)
tree21f99e438848b58008968c396e516f958a1a0527
parent9f27ba2e1f4f315b6f3e29ee9989b3619d4a5cae (diff)
parentd696c86509c6742aed5d0c219c028791f51c76be (diff)
Merge pull request #2799 from aznohonza/docs/quad-any-partial
rdna2spirv: quad_any's docstring says partial quads are exact (DOC-QUAD-ANY-PARTIAL)
-rw-r--r--tests/semantic/test_salu_wqm32.py2
-rw-r--r--tools/rdna2spirv.py18
2 files changed, 10 insertions, 10 deletions
diff --git a/tests/semantic/test_salu_wqm32.py b/tests/semantic/test_salu_wqm32.py
index 5ab78a069..3d0f23c39 100644
--- a/tests/semantic/test_salu_wqm32.py
+++ b/tests/semantic/test_salu_wqm32.py
@@ -5,7 +5,7 @@
5Covers both: 5Covers both:
6 - Data path (32-bit nibble expansion + SCC) via tools/rdna2spirv.py -> spirv_mini_interp.py. 6 - Data path (32-bit nibble expansion + SCC) via tools/rdna2spirv.py -> spirv_mini_interp.py.
7 - Lane-mask path (32-lane wave32, 8 quads) via tools/rdna2spirv.py -> spirv_wave_interp.py (vertex stage 7 - Lane-mask path (32-lane wave32, 8 quads) via tools/rdna2spirv.py -> spirv_wave_interp.py (vertex stage
8 uses OpGroupNonUniformShuffle for quad_any; fragment/compute stages are checked for OpGroupNonUniformQuadSwap). 8 uses OpGroupNonUniformBallot for quad_any; the fragment stage is checked for OpGroupNonUniformQuadSwap).
9 9
10Standard library only; no game data. 10Standard library only; no game data.
11""" 11"""
diff --git a/tools/rdna2spirv.py b/tools/rdna2spirv.py
index 80b641633..d6f0db65b 100644
--- a/tools/rdna2spirv.py
+++ b/tools/rdna2spirv.py
@@ -7281,11 +7281,10 @@ class Gen:
7281 def quad_any(self, v): 7281 def quad_any(self, v):
7282 """This lane's value after whole-quad mode: all ones if any of the 4 lanes of its quad (4n .. 4n+3 of the 7282 """This lane's value after whole-quad mode: all ones if any of the 4 lanes of its quad (4n .. 4n+3 of the
7283 wave) has `v` non-zero, else 0. A quad never crosses the 32/32 half of a wave64, so a 32-wide subgroup is 7283 wave) has `v` non-zero, else 0. A quad never crosses the 32/32 half of a wave64, so a 32-wide subgroup is
7284 exact. Without emulation the subgroup's quad ops do it (the invocations of a quad are 4 consecutive subgroup 7284 exact. Without emulation the subgroup's ops do it: in a fragment shader the 2x2 quad, which on hardware is
7285 invocations; in a fragment shader the 2x2 quad, which on hardware is also 4 consecutive lanes; vertex, 7285 also 4 consecutive lanes; every other stage ballots, so a partial quad (fewer than 4 of the quad's lanes
7286 geometry and mesh shaders shuffle, as quad operations are only guaranteed in fragment and compute stages); 7286 running, e.g. 2 active lanes of a 32-lane subgroup) is exact too, as a lane's bit is set only when it is
7287 emulated, the four lanes' values are read through the exchange buffer. Not handled: an absent invocation in 7287 running with `v` non-zero. Emulated, the four lanes' values are read through the exchange buffer."""
7288 a partial quad (a compute group whose size is not a multiple of 4) gives an undefined value natively."""
7289 b = self.tmp() 7288 b = self.tmp()
7290 self.emit(f"{b} = OpSelect %uint {self.tmp_bool_nz(v)} {self.cu(1)} {self.cu(0)}") 7289 self.emit(f"{b} = OpSelect %uint {self.tmp_bool_nz(v)} {self.cu(1)} {self.cu(0)}")
7291 if self.emulate: 7290 if self.emulate:
@@ -7314,10 +7313,11 @@ class Gen:
7314 self.emit(f"{o} = OpBitwiseOr %uint {acc} {sw}") 7313 self.emit(f"{o} = OpBitwiseOr %uint {acc} {sw}")
7315 acc = o 7314 acc = o
7316 else: 7315 else:
7317 # Non-fragment stages (CS/VS/GS/MS) can have partial quads (subgroup size or thread count not a multiple 7316 # Non-fragment stages (CS/VS/GS/MS) can have partial quads (fewer than 4 of the quad's lanes running: a
7318 # of 4), where QuadSwap or unguarded shuffles from absent lanes are undefined in SPIR-V. Ballot sets bit l 7317 # subgroup or workgroup size not a multiple of 4, or a partial wave, e.g. 2 active lanes of a 32-lane
7319 # iff lane l is running with `v != 0`, so extracting this lane's 4-bit quad nibble is exact on any partial 7318 # subgroup), where QuadSwap or unguarded shuffles from absent lanes are undefined in SPIR-V. Ballot sets
7320 # subgroup up to 128 lanes without needing GroupNonUniformQuad or any shuffle. 7319 # bit l iff lane l is running with `v != 0`, so extracting this lane's 4-bit quad nibble is exact on any
7320 # partial subgroup up to 128 lanes without needing GroupNonUniformQuad or any shuffle.
7321 self.uses_subgroup = self.uses_ballot = True 7321 self.uses_subgroup = self.uses_ballot = True
7322 nz = self.tmp_bool_nz(v) 7322 nz = self.tmp_bool_nz(v)
7323 bal, widx, word, qoff, shifted, acc = (self.tmp() for _ in range(6)) 7323 bal, widx, word, qoff, shifted, acc = (self.tmp() for _ in range(6))