[llvm-dev] Questions about vscale

Kai Wang via llvm-dev llvm-dev at lists.llvm.org
Sat Apr 11 07:55:07 PDT 2020


Hi Renato,

Thanks for your reply.
IIUC. If I could lower LLVM IR to Asm correctly under my type system
design, there should be no problem with it.
Another concern I have is that llvm.vscale intrinsic is designed to return
integer value. Should we relax it to return float or something else?
Thanks.

Kai

On Wed, Apr 8, 2020 at 5:36 PM Renato Golin <rengolin at gmail.com> wrote:

> On Wed, 8 Apr 2020 at 04:23, Kai Wang <kai.wang at sifive.com> wrote:
> > If we apply the type system pointed out by Renato, is the vector type
> <vscale x 1 x i16> legal? If we decide that <vscale x 1 x i16> is a
> fundamentally impossible type, does it contrary to the philosophy of LLVM
> IR as reasonably target-independent IR? I do not get the point of your
> argument.
>
> Hi Kai,
>
> Don't worry about target-independent IR in your design of intermediate
> passes or lowering.
>
> By the time the front-end lowers to LLVM IR, it already has, often
> irreversible, target-specific knowledge in it.
>
> If by some stroke of luck that doesn't happen, then using "<vscale x
> anything>" is enough indication that you should not try to lower that
> onto a target that it wasn't specifically aimed at.
>
> No one expects the middle-end to be target-neutral. That's the whole
> point of constantly asking target-specific machinery (like TTI) about
> what's possible or what's "good" and what's not.
>
> More importantly, the closer you are to the end of the pass pipeline,
> the closer the IR is to machine IR. It's not uncommon, and often
> expected, to see "just the right amount of shuffles" to match lowering
> patterns into MIR and then Asm.
>
> IIRC, OpenCL or some other parallel-compute/graphic oriented pipeline
> does use odd vector shapes and legalise them later on.
>
> I may be severely outdated in my opinion, and happy to be corrected,
> but I don't think it would be totally egregious to carry on with
> (whole numbered) vector shapes that aren't strictly legal, as long as
> you guarantee that *any* such pattern gets correctly legalised by the
> lowering.
>
> If you can make the adversarial cases performing on top of that, it's
> a bonus, not a target.
>
> Hope this helps.
>
> cheers,
> --renato
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200411/38be2c89/attachment.html>


More information about the llvm-dev mailing list