1 //===- DialectLinalg.cpp - Pybind module for Linalg dialect API support --===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "Dialects.h"
10 #include "IRModule.h"
11 #include "mlir-c/Dialect/Linalg.h"
12 #include "mlir-c/IR.h"
13 
14 // TODO: Port this to operate only on the public PybindAdaptors.h
15 #include "PybindUtils.h"
16 
17 namespace py = pybind11;
18 using namespace mlir;
19 using namespace mlir::python;
20 
populateDialectLinalgSubmodule(py::module m)21 void mlir::python::populateDialectLinalgSubmodule(py::module m) {
22   m.def(
23       "fill_builtin_region",
24       [](PyDialectDescriptor &dialect, PyOperation &op) {
25         mlirLinalgFillBuiltinNamedOpRegion(dialect.get(), op.get());
26       },
27       py::arg("dialect"), py::arg("op"),
28       "Fill the region for `op`, which is assumed to be a builtin named Linalg "
29       "op.");
30 }
31