Mesa (main): nir: Require vectorized ALU ops to be all-or-nothing

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 21 17:14:47 UTC 2021


Module: Mesa
Branch: main
Commit: f00b5a30f5799b5072197ecb92bbcc16877109cd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f00b5a30f5799b5072197ecb92bbcc16877109cd

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Thu Jun 17 10:32:34 2021 -0500

nir: Require vectorized ALU ops to be all-or-nothing

Long ago, the semantics of bcsel were such that it took a single boolean
value and selected between whole vectors.  These days, it takes a vector
boolean with the assumption that if you want the old behavior you can
just use a .xxxx swizzle.  There currently are no opcodes which use a
output_size of 0 but have a scalar or fixed-vector input.  Let's
disallow it for now to force us to think through the semantics again if
this ever comes up as something someone actually wants.

Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11438>

---

 src/compiler/nir/nir_opcodes.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py
index 4e48567340c..42bcfb66569 100644
--- a/src/compiler/nir/nir_opcodes.py
+++ b/src/compiler/nir/nir_opcodes.py
@@ -78,6 +78,8 @@ class Opcode(object):
       assert 0 <= output_size <= 5 or (output_size == 8) or (output_size == 16)
       for size in input_sizes:
          assert 0 <= size <= 5 or (size == 8) or (size == 16)
+         if output_size == 0:
+            assert size == 0
          if output_size != 0:
             assert size != 0
       self.name = name



More information about the mesa-commit mailing list