serial-recurrenceThe loop carries a serial recurrence
Reported by --explain after a verdict.
mettle explain serial-recurrence
A value is computed from its own previous value through an operation that does not reassociate: *, /, a shift, or a bitwise or xor op. Iteration 2 cannot start until iteration 1 has finished, so the lanes form a chain rather than eight independent pieces of work.
This is the one refusal that is a fact about the algorithm rather than a gap in the compiler. A hash, a linear congruential generator, an IIR filter: the running state IS the algorithm, and the loop is already at its scalar floor.
What does vectorize: + and - reductions. Those reassociate, so the compiler splits them into per-lane partial sums and adds the lanes at the end.
Fix: none, unless the algorithm itself can change. Some hashes have a parallel form that hashes N independent streams and combines them.
Related
- call-in-bodyThe loop body calls a function
- extern-call-in-bodyThe loop body calls an external function
- indirect-callThe loop body calls through a function pointer
- alloc-in-bodyThe loop body allocates
- inline-asmThe loop body contains inline assembly
- control-flowThe loop body branches
- early-exitThe loop can leave before its trip count
- int16-elements16-bit integer elements have no kernel