[llvm-dev] Vectorization of math function failed?

Lukas Sommer via llvm-dev llvm-dev at lists.llvm.org
Mon Dec 21 12:36:20 PST 2020


Hi Venkat.,

thanks for adding the support for libmvec!

Is there a pass or something similar to replace calls to intrinsics that
already operate on vector operands with calls to libmvec?

inject-tli-mappings seems to add the attributes only to scalar calls to
intrinsics such as llvm.exp and the loop-vectorizer then might vectorize
these calls.

In my use case, I'm getting vectorized calls to LLVM intrinsics from
MLIR and would like to replace those with calls to libmvec, but as the
code is already vectorized, the LoopVectorizer does not do these
replacements.

So for example, in the LLVM IR generated from MLIR, there is a call such as:

%103 = fmul <4 x double> %102, <double -5.000000e-01, double
-5.000000e-01, double -5.000000e-01, double -5.000000e-01>
%104 = tail call <4 x double> @llvm.exp.v4f64(<4 x double> %103)

I would like to have a pass replace the call to llvm.exp.v4f64 with a
call @_ZGVdN4v_exp(<4 x double>), whose declaration is inserted by
inject-tli-mappings.

Are you aware of such a pass or another way to achieve this behavior?

Thanks in advance,

Lukas

Lukas Sommer, M.Sc.
TU Darmstadt
Embedded Systems and Applications Group (ESA)
Hochschulstr. 10, 64289 Darmstadt, Germany
Phone: +49 6151 1622429
www.esa.informatik.tu-darmstadt.de

On 23.09.20 17:11, Venkataramanan Kumar via llvm-dev wrote:
>
> Hi Florian and Alexandre, 
>
> On Tue, 15 Sep 2020 at 19:30, Alexandre Bique
> <bique.alexandre at gmail.com <mailto:bique.alexandre at gmail.com>> wrote:
>
>     On Tue, Sep 15, 2020 at 3:58 PM Venkataramanan Kumar
>     <venkataramanan.kumar.llvm at gmail.com
>     <mailto:venkataramanan.kumar.llvm at gmail.com>> wrote:
>     > I have not yet started the patch work.
>     >
>     > Collected information about the ABI for the routines.   To start
>     with I am thinking of supporting  pow/lib/exp/sin/cos/log routines
>     till VF 8 which are non masked variants in the initial patch.
>     > I will try to send the patch early next week.
>
>     Great, let me know if you need help or don't have time to look at it.
>
>
> I made a patch and submitted it here.  
> https://reviews.llvm.org/D88154
>
> regards,
> venkat.
>  
>
>
>     Regards,
>     Alexandre
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20201221/5a5504bd/attachment.html>


More information about the llvm-dev mailing list