Hendrik Greving via llvm-dev
2020-Jul-16 21:00 UTC
[llvm-dev] Selection DAG chain question
> No, non-sideeffecting operations can be legalized as compiler-rt callsRight, but not as "regular" nodes with side-effects? I guess you could search and analyze the DAG manually but that seems hacky. Maybe something that one day LLVM could support natively. On Thu, Jul 16, 2020 at 11:55 AM Matt Arsenault <arsenm2 at gmail.com> wrote:> > > On Jul 16, 2020, at 14:47, Hendrik Greving <hgreving at google.com> wrote: > > I think their originating node already has a chain (i.e. mem operand or > side effect in llvm-ir) > > > > No, non-sideeffecting operations can be legalized as compiler-rt calls > > -Matt >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200716/89819cda/attachment.html>
> On Jul 16, 2020, at 17:00, Hendrik Greving <hgreving at google.com> wrote: > > > No, non-sideeffecting operations can be legalized as compiler-rt calls > > Right, but not as "regular" nodes with side-effects? I guess you could search and analyze the DAG manually but that seems hacky. Maybe something that one day LLVM could support natively.You can’t add arbitrary chains or glue to the regular nodes, but you can define a custom node you select the same way with your chain/glue. You don’t need to preprocess the IR and can do in the custom lowering. This is what AMDGPU does for FDIV (see AMDGPUISD::FMA_W_CHAIN). GlobalISel avoids these complications by not having nodes or chains, and just instructions with side effects, so in that sense this is a solved problem. -Matt
Hendrik Greving via llvm-dev
2020-Jul-16 21:34 UTC
[llvm-dev] Selection DAG chain question
Yea. I think AMD chains the node they're expanding into, but they don't chain it into an _existing_ chain. e.g. adding A->B to the DAG is ok. But adding A->B and next C->D with B->C is the problem. I appreciate the input On Thu, Jul 16, 2020 at 2:04 PM Matt Arsenault <arsenm2 at gmail.com> wrote:> > > > On Jul 16, 2020, at 17:00, Hendrik Greving <hgreving at google.com> wrote: > > > > > No, non-sideeffecting operations can be legalized as compiler-rt calls > > > > Right, but not as "regular" nodes with side-effects? I guess you could > search and analyze the DAG manually but that seems hacky. Maybe something > that one day LLVM could support natively. > > > You can’t add arbitrary chains or glue to the regular nodes, but you can > define a custom node you select the same way with your chain/glue. You > don’t need to preprocess the IR and can do in the custom lowering. This is > what AMDGPU does for FDIV (see AMDGPUISD::FMA_W_CHAIN). GlobalISel avoids > these complications by not having nodes or chains, and just instructions > with side effects, so in that sense this is a solved problem. > > -Matt-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200716/bc60a7e5/attachment.html>