Mettle

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