xref: /llvm-project/mlir/lib/Bindings/Python/DialectLinalg.cpp (revision 5cd427477218d8bdb659c6c53a7758f741c3990a)
143b9fa3cSNicolas Vasilache //===- DialectLinalg.cpp - Pybind module for Linalg dialect API support --===//
243b9fa3cSNicolas Vasilache //
343b9fa3cSNicolas Vasilache // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
443b9fa3cSNicolas Vasilache // See https://llvm.org/LICENSE.txt for license information.
543b9fa3cSNicolas Vasilache // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
643b9fa3cSNicolas Vasilache //
743b9fa3cSNicolas Vasilache //===----------------------------------------------------------------------===//
843b9fa3cSNicolas Vasilache 
943b9fa3cSNicolas Vasilache #include "mlir-c/Dialect/Linalg.h"
1043b9fa3cSNicolas Vasilache #include "mlir-c/IR.h"
11*5cd42747SPeter Hawkins #include "mlir/Bindings/Python/NanobindAdaptors.h"
12*5cd42747SPeter Hawkins #include "mlir/Bindings/Python/Nanobind.h"
1343b9fa3cSNicolas Vasilache 
14*5cd42747SPeter Hawkins namespace nb = nanobind;
1543b9fa3cSNicolas Vasilache 
16*5cd42747SPeter Hawkins static void populateDialectLinalgSubmodule(nb::module_ m) {
1743b9fa3cSNicolas Vasilache   m.def(
1843b9fa3cSNicolas Vasilache       "fill_builtin_region",
19d716cfc4SAlex Zinenko       [](MlirOperation op) { mlirLinalgFillBuiltinNamedOpRegion(op); },
20*5cd42747SPeter Hawkins       nb::arg("op"),
2143b9fa3cSNicolas Vasilache       "Fill the region for `op`, which is assumed to be a builtin named Linalg "
2243b9fa3cSNicolas Vasilache       "op.");
2343b9fa3cSNicolas Vasilache }
2495ddbed9SAlex Zinenko 
25*5cd42747SPeter Hawkins NB_MODULE(_mlirDialectsLinalg, m) {
2695ddbed9SAlex Zinenko   m.doc() = "MLIR Linalg dialect.";
2795ddbed9SAlex Zinenko 
2895ddbed9SAlex Zinenko   populateDialectLinalgSubmodule(m);
2995ddbed9SAlex Zinenko }
30