[llvm] [LV][NFC]Preselect folding style before choosing maxing VF, NFC. (PR #81885)

via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 26 07:25:52 PST 2024


ayalz wrote:

> It is a bit unfortunate that we need to account for 2 possible TF styles, but I don't think there's really any way around that at the moment, as we have to commit to one (or possibly 2) styles up front

Adding some complementary thoughts:

foldTailByMasking() checks if the default getTailFoldingStyle() is None - implicitly assuming IVUpdateMayOverflow. Worth commenting that checking for None Style can be done independent of IVUpdateMayOverflow, i.e., both styles are None or both of them are not None (right?).

Indeed, a cyclic dependence seems to currently prevent ordering this properly: which TF style is needed depends on IVUpdateMayOverflow which depends on (all VF's up to, but actually only on) MaxVF which is in turn involved in setting the TF styles.
One feasible way to resolve this may be to compute IVUpdateMayOverflow first, based on computeFeasibleMaxVF(), independent of TF styles - assuming conservatively that tail is folded. Going forward, according to roadmap, IVUpdateMayOverflow would relate to the Strip-mine-Factor (VFxUF), possibly splitting it into ranges where IVUpdate may not overflow.

nit: `selectTailFoldinStyle()` does slightly more than passively "select and record" the style - it also records all masked operations by calling prepareToFoldTailByMasking(), regardless of IVUpdateMayOverflow. And it actually sets two Styles. Perhaps a more accurate name would be `setTailFoldingStyles()`.

https://github.com/llvm/llvm-project/pull/81885


More information about the llvm-commits mailing list