On Jun 13, 2011, at 4:41 AM, Nicolas Capens wrote:> > So I was wondering whether in LLVM a gather operation is best represented with a 'load' instruction taking vector operands, or whether it's better to define it as a separate 'gather' instruction. What would be the pros and cons of each approach, and what do you think should be the long-term goals for the LLVM instruction set?Lots of parts of LLVM "know" about loads, and would be quite broken if loads could suddenly be gathers. Also, autovectorizers have to know a fair amount about target instruction sets, especially if they're going to vectorize non-trivial things like gathers. So target-specific intrinsics seem like a reasonable start. A generic 'gather' instruction/intrinsic may make sense at some point, if it can be designed cleanly enough. Dan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110613/3e17020a/attachment.html>
On Jun 13, 2011, at 6:48 AM, Dan Gohman wrote:> On Jun 13, 2011, at 4:41 AM, Nicolas Capens wrote: >> >> So I was wondering whether in LLVM a gather operation is best represented with a 'load' instruction taking vector operands, or whether it's better to define it as a separate 'gather' instruction. What would be the pros and cons of each approach, and what do you think should be the long-term goals for the LLVM instruction set? > > Lots of parts of LLVM "know" about loads, and would be quite broken if > loads could suddenly be gathers. > > Also, autovectorizers have to know a fair amount about target > instruction sets, especially if they're going to vectorize non-trivial things > like gathers. > > So target-specific intrinsics seem like a reasonable start. A generic > 'gather' instruction/intrinsic may make sense at some point, if it can > be designed cleanly enough.Right, the natural evolution of LLVM IR is that things start out as intrinsics, then eventually get built into the instruction set if it makes sense. This is how unaligned loads were handled early on, for example. -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110613/d8dffc8b/attachment.html>
Chris Lattner <clattner at apple.com> writes:> On Jun 13, 2011, at 6:48 AM, Dan Gohman wrote: > > On Jun 13, 2011, at 4:41 AM, Nicolas Capens wrote: > > So I was wondering whether in LLVM a gather operation is best > represented with a 'load' instruction taking vector operands, > or whether it's better to define it as a separate 'gather' > instruction. What would be the pros and cons of each approach, > and what do you think should be the long-term goals for the > LLVM instruction set? > > Lots of parts of LLVM "know" about loads, and would be quite broken if > loads could suddenly be gathers.What are the problem areas? It seems natural to me to extend loads to be able to take vectors of offsets and/or pointers.> Also, autovectorizers have to know a fair amount about target > instruction sets, especially if they're going to vectorize > non-trivial things like gathers.True.> So target-specific intrinsics seem like a reasonable start. A > generic 'gather' instruction/intrinsic may make sense at some > point, if it can be designed cleanly enough. > > Right, the natural evolution of LLVM IR is that things start out as > intrinsics, then eventually get built into the instruction set if it > makes sense. This is how unaligned loads were handled early on, for > example.Yes, intrinsics make perfect sense for the moment. -Dave