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

Author: Alyssa Rosenzweig <[email protected]>
Date:   Mon Nov  6 16:52:14 2023 -0400

nir/validate: Don't validate out-of-bounds channels

Nothing should ever be reading them, they logically do not exist. So there's no
point validating them, especially when the validation in question is so useless
(just checking the bit width, without any semantic awareness). Yet now that we
support vec16, this loop is quite hot even on scalar ISAs, and rather
pointlessly so. Just remove it and bring the ALU src validation complexity to
O(# of channels in source) instead of O(max # of channels in NIR).

Signed-off-by: Alyssa Rosenzweig <[email protected]>
Reviewed-by: Faith Ekstrand <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26084>

---

 src/compiler/nir/nir_validate.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c
index 4febc3d3b1e..0193a6c0ca8 100644
--- a/src/compiler/nir/nir_validate.c
+++ b/src/compiler/nir/nir_validate.c
@@ -215,10 +215,6 @@ validate_alu_src(nir_alu_instr *instr, unsigned index, 
validate_state *state)
       validate_assert(state, src->swizzle[i] < num_components);
    }
 
-   for (unsigned i = num_instr_channels; i < NIR_MAX_VEC_COMPONENTS; i++) {
-      validate_assert(state, src->swizzle[i] < NIR_MAX_VEC_COMPONENTS);
-   }
-
    validate_src(&src->src, state, 0, 0);
 }
 

Reply via email to