pan/bi: Assert that vectors are sufficiently small
authorAlyssa Rosenzweig <alyssa@collabora.com>
Thu, 1 Sep 2022 20:48:08 +0000 (16:48 -0400)
committerMarge Bot <emma+marge@anholt.net>
Thu, 1 Sep 2022 21:40:06 +0000 (21:40 +0000)
There is a limit to how vector widths (eg due to RA), larger vectors should be
broken up in NIR so we shouldn't ever see such vectors.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17220>

src/panfrost/bifrost/bifrost_compile.c

index 15a5888..6cb728e 100644 (file)
@@ -655,6 +655,9 @@ bi_make_vec_to(bi_builder *b, bi_index dst,
         unsigned shift = (bitsize == 32) ? 0 : (bitsize == 16) ? 1 : 2;
         unsigned chan_per_word = 1 << shift;
 
+        assert(DIV_ROUND_UP(count * bitsize, 32) <= BI_MAX_SRCS &&
+               "unnecessarily large vector should have been lowered");
+
         bi_index srcs[BI_MAX_VEC];
 
         for (unsigned i = 0; i < count; i += chan_per_word) {