<div dir="ltr"><div>Oh interesting - I hadn't even considered registering vector descriptors for the LLVM intrinsics, but right enough when I just registered that pow has a vector variant (itself of a bigger size) I got the correct 8-wide variants like I was expecting - nice!</div><div><br></div><div>Thanks for the help!</div><div><br></div><div>Cheers,</div><div>-Neil.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jul 17, 2020 at 12:09 PM Florian Hahn <<a href="mailto:florian_hahn@apple.com">florian_hahn@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><br><div><br><blockquote type="cite"><div>On 16 Jul 2020, at 19:54, Neil Henning via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:</div><br><div><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><div>So for us we use SLEEF to actually implement the libcalls (LLVM intrinsics) that LLVM by default would generate - and since SLEEF has highly optimal 8-wide pow, optimized for AVX and AVX2, we really want to use that.</div></div></div></blockquote><br></div><div>Right, the way vector versions of library functions are accessed by the vectoriser has changed since the last release. I think the initial patch was <a href="https://reviews.llvm.org/D70107" target="_blank">https://reviews.llvm.org/D70107</a>.</div><div><br></div><div>Vector functions now must be annotated with a vector-function-abi-variant function attribute. There’s the -inject-tli-mappings pass, that is supposed to add the attributes for vector functions from TLI. It seems like this is currently not happening for your custom TLI mappings for some reason.</div><div><br></div><div>For example, the Accelerate library has a vector version of log10. Running `opt -vector-library=Accelerate -inject-tli-mappings` on the IR below will add the following attribute to the llvm.log10 call-site, indicating that there’s a <4 x float> version of log10 called vlog10f.</div><div><br></div><div>{ "vector-function-abi-variant"="_ZGV_LLVM_N4v_llvm.log10.f32(vlog10f)" }</div><div><div><br></div><div><br></div><div>To double-check, if running -inject-tli-mappings on your example does not add the vector-function-abi-variant attribute for `pow`, the vectorisers won’t know about them. If the vector-function-abi-variant attribute is actually created, but the vector version is not used nonetheless, it would be great if you could share the IR with the attributes, as they depend on the downstream TLI.</div><div><br></div><div>I am also CC’ing Francesco, who might be able to help you pinning down where exactly things go wrong with the mapping.</div><div><br></div><div>Cheers,</div><div>Florian</div><div><br></div><div>——</div><div><br></div><div>define float @call_llvm.log10.f32(float %in) {</div><div>  %call = tail call float @llvm.log10.f32(float %in)</div><div>  ret float %call</div><div>}</div><div><br></div><div>declare float @llvm.log10.f32(float)</div></div></div></blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><table style="border-collapse:collapse;border-spacing:0px;color:rgb(90,90,91);font-size:13px;margin:0px 0px 20px;padding:0px" width="100%" cellspacing="0" cellpadding="0" border="0"><tbody style="margin:0px;padding:0px"><tr style="margin:0px;padding:0px"><td style="border-collapse:collapse;font-size:0px;line-height:1.5em;padding:0px 0px 20px;vertical-align:top" align="left"><table style="border-collapse:collapse;border-spacing:0px;margin:0px;padding:0px" cellspacing="0" cellpadding="0" border="0" align="left"><tbody style="margin:0px;padding:0px"><tr style="margin:0px;padding:0px"><td style="border-collapse:collapse;font-size:1.12em;line-height:1.5em;padding:0px;vertical-align:top;width:64px"><img style="border: medium none; border-radius: 0px; display: block; font-size: 13px; height: auto; line-height: 100%; margin: 0px; max-width: 100%; outline-style: none; outline-width: medium; padding: 20px 0px 0px; width: 100%;" alt="" src="https://unity3d.com/profiles/unity3d/themes/unity/images/ui/other/unity-logo-dark-email.png" width="64" height="auto"></td></tr></tbody></table></td></tr><tr style="margin:0px;padding:0px"><td style="border-collapse:collapse;font-size:0px;line-height:1.5em;padding:0px;vertical-align:top" align="left"><div style="color:rgb(0,0,0);font-family:Roboto,Arial;font-size:14px;font-weight:600;line-height:15px;margin:0px;padding:0px">Neil Henning</div></td></tr><tr style="margin:0px;padding:0px"><td style="border-collapse:collapse;font-size:0px;line-height:1.5em;padding:0px;vertical-align:top" align="left"><div style="color:rgb(0,0,0);font-family:Roboto,Arial;font-size:14px;line-height:15px;margin:0px;padding:0px 0px 10px">Senior Software Engineer Compiler</div></td></tr><tr style="margin:0px;padding:0px"><td style="border-collapse:collapse;font-size:0px;line-height:1.5em;padding:0px;vertical-align:top" align="left"><div style="color:rgb(0,0,0);font-family:Roboto,Arial;font-size:12px;line-height:15px;margin:0px;padding:0px"><a href="http://unity.com" target="_blank">unity.com</a></div></td></tr></tbody></table></div></div>