I was thinking of adding a vectorization_mode class that would
encapsulate the mode and whether to allow masking or alternatively
to make the vector_modes array (and the m_suggested_epilogue_mode)
a std::pair of mode and mask flag?

Without having a very strong opinion (or the full background) on this, the pair approach seems useful to me. The x86 and aarch64 port being more mature experimentation might be less important but for riscv we definitely still explore the full "solution space" of all possible modes for main loop as well as epilogue.

As mode selection is already under target control I recently (locally, not upstream) added a riscv-specific --param=autovec-mode for this exact purpose so we can choose a single vector mode and improve it in isolation.

Adding the additional flexibility of switching partial/length vectors per mode on and off would IMHO help in that regard. And, while many of the available modes might indeed be "disposable" right away I find the option of trying out everything attractive as it also allows to learn about the behavior of code between loop and epilog (like extracts). IIRC LLVM also has the option to freely chose loop and epilog strategy, not sure about the granularity, though. We have this as well, just not very accessible right now, and I can imagine the pair approach would be a helpful step in making it more accessible.

--
Regards
Robin

Reply via email to