[PATCH] D78327: [mlir][Linalg] Create a named batchmatmul op and pipe it through.
Uday Bondhugula via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 17 08:38:42 PDT 2020
bondhugula added a comment.
In D78327#1988920 <https://reviews.llvm.org/D78327#1988920>, @nicolasvasilache wrote:
> > I now see the relevant method. But to use the builder, you only need a block or a region, and not an op(?). You could do an addRegion(), followed by pushing a new block into it, and then create the builder to insert. Am I missing something?
>
> This is what I started with but along the line I realized that `region.getContext()` requires `region` to be attached to a `Operation*`.
> See: https://github.com/llvm/llvm-project/blob/master/mlir/include/mlir/IR/Region.h#L31
>
> However this was a red herring only due to the fact that I was constructing `OpBuilder` from `region`.
> I.e. this fails:
>
> Region *region = result.addRegion();
> OpBuilder opBuilder(region);
>
>
> This works fine:
>
> Region *region = result.addRegion();
> OpBuilder opBuilder(context);
> opBuilder.setInsertionPoint(®ion.front(), region.front().begin());
>
>
> Thanks for noting!
That's great. In fact, the following is less verbose and should work:
auto opBuilder = OpBuilder::atBlockBegin(®ion.front());
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78327/new/
https://reviews.llvm.org/D78327
More information about the llvm-commits
mailing list