[llvm-dev] Vectorization of math function failed?

Venkataramanan Kumar via llvm-dev llvm-dev at lists.llvm.org
Tue Dec 22 03:51:24 PST 2020


Hi Lukas,

+ Florian and Sanjay.

On Tue, 22 Dec 2020 at 02:06, Lukas Sommer <sommer at esa.tu-darmstadt.de>
wrote:

> 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?
>
I am not aware of any existing pass.

> 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?
>
May be we should have one IR pass which does this conversion or make the
code gen lower it to the required call.
I have added few others to comment.

regards,
Venkat.

> Thanks in advance,
>
> Lukas
>
> Lukas Sommer, M.Sc.
> TU Darmstadt
> Embedded Systems and Applications Group (ESA)
> Hochschulstr. 10, 64289 Darmstadt, Germany
> Phone: +49 6151 1622429www.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>
> wrote:
>
>> On Tue, Sep 15, 2020 at 3:58 PM Venkataramanan Kumar
>> <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 listllvm-dev at lists.llvm.orghttps://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/20201222/08f313a8/attachment.html>


More information about the llvm-dev mailing list