I'm compiling the cmsis-nn library, and in that library there are some functions which determine "#if defined(ARM_MATH_DSP) && !defined(ARM_MATH_MVEI)".
For example arm_relu_q15.c. He looks like: if the judgment is successful then use the vectorization way, otherwise it's a normal loop. Why is this, I can't understand why MVEI expansion affects DSP expansion.
I'd like to know why, and whether detecting that MVEI undefined is redundant.
No, its not redundant. This is usual way to detect Helium Technology extension on M cores as not all that support DSP also support MVE (I think it was added in M55).
In case core supports DSP and does not support MVE then reference ARM implementation of vectorization is used, otherwise its just ordinary loop (and if core happens to support DSP and MVE it is auto-vectorized anyway if AUTOVECTORIZE is enabled).
Quoting pre-processor macros section from documentation: