From 2ded4909135b7ff81885a84d53c9d738a6666e9c Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 1 Sep 2022 16:48:08 -0400 Subject: [PATCH] pan/bi: Assert that vectors are sufficiently small 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 Part-of: --- src/panfrost/bifrost/bifrost_compile.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 15a5888995e..6cb728ed4e9 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -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) {