Page MenuHomePhabricator

[NFC][LoopVectorize] Allow getRuntimeVF to generate FP values
AbandonedPublic

Authored by david-arm on Oct 15 2021, 3:51 AM.

Details

Summary

Given there is already code in the vectoriser that sometimes needs
to create a floating-point value for the runtime VF, it makes sense
to move the logic for the int->FP conversions into getRuntimeVF
itself.

This will also be useful in future when we want to add tail-folding
support for scalable vectors.

Diff Detail

Event Timeline

david-arm created this revision.Oct 15 2021, 3:51 AM
david-arm requested review of this revision.Oct 15 2021, 3:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 15 2021, 3:51 AM

Passing-by remark: i don't see how this makes sense.
VF is inherently an integral quantity, if something needs it as a float, should it not deal with the conversion?

Passing-by remark: i don't see how this makes sense.
VF is inherently an integral quantity, if something needs it as a float, should it not deal with the conversion?

It's because this will become a frequent pattern in future work, where we have to follow the same pattern of 1) convert float type -> int type, 2) invoke getRuntimeVF, 3) convert result back to FP. I wrote this patch on the basis that we'd prefer to reduce code duplication scattered throughout the vectoriser. It will make future patches in the area of tail-folding smaller.

What about making the patch additive only. So keep getRuntimeVF as is and add something like getRuntimeVFasFloat as the helper function? Just a thought. Is the patch which introduces the multiple uses big? If not then I don't see a reason for not introducing the helper function there, that way it'll be clear why you need it.

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
1125

Should this be B.CreateUIToFP given VF is unsigned?

Thanks for the comments @lebedev.ri and @paulwalker-arm, I'll have a think about possibly restructuring this. I will go back and double check which code paths will absolutely need a FP value.