nir/validate: Don't spam nir_alu_instr_channels

It doesn't inline and so is about 1% of M1 CTS time. Expand out the definition
and simplify the logic. Honestly, I think this is clearer too.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26084>
This commit is contained in:
Alyssa Rosenzweig 2023-11-06 16:51:23 -04:00
parent 1786032029
commit 8d5a1e5a77

View file

@ -208,12 +208,15 @@ validate_alu_src(nir_alu_instr *instr, unsigned index, validate_state *state)
{
nir_alu_src *src = &instr->src[index];
unsigned num_instr_channels = nir_ssa_alu_instr_src_components(instr, index);
unsigned num_components = nir_src_num_components(src->src);
for (unsigned i = 0; i < NIR_MAX_VEC_COMPONENTS; i++) {
validate_assert(state, src->swizzle[i] < NIR_MAX_VEC_COMPONENTS);
if (nir_alu_instr_channel_used(instr, index, i))
validate_assert(state, src->swizzle[i] < num_components);
for (unsigned i = 0; i < num_instr_channels; i++) {
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);