Previously, the Python bindings for the Linalg dialect relied on the internal implementation of core bindings. Most of that functionality was moved, and the remaining one does not need access to the implementation: it used to accept a dialect pointer as argument, but it can always be extracted from the operation that it also accepts; operations are available through PybindAdaptors in an opaque way. Change the bindings in that direction. This enables the decoupling of the Linalg dialect Python extension from the core IR Python extension. Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D116649
24 lines
819 B
C++
24 lines
819 B
C++
//===- DialectLinalg.cpp - Pybind module for Linalg dialect API support --===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "Dialects.h"
|
|
#include "mlir-c/Dialect/Linalg.h"
|
|
#include "mlir-c/IR.h"
|
|
#include "mlir/Bindings/Python/PybindAdaptors.h"
|
|
|
|
namespace py = pybind11;
|
|
|
|
void mlir::python::populateDialectLinalgSubmodule(py::module m) {
|
|
m.def(
|
|
"fill_builtin_region",
|
|
[](MlirOperation op) { mlirLinalgFillBuiltinNamedOpRegion(op); },
|
|
py::arg("op"),
|
|
"Fill the region for `op`, which is assumed to be a builtin named Linalg "
|
|
"op.");
|
|
}
|