18 #include <pybind11/detail/common.h>
19 #include <pybind11/pybind11.h>
24 struct PyMlirTransformOptions {
26 PyMlirTransformOptions(PyMlirTransformOptions &&other) {
28 other.options.ptr =
nullptr;
30 PyMlirTransformOptions(
const PyMlirTransformOptions &) =
delete;
39 py::class_<PyMlirTransformOptions>(m,
"TransformOptions", py::module_local())
43 [](
const PyMlirTransformOptions &
self) {
46 [](PyMlirTransformOptions &
self,
bool value) {
50 "enforce_single_top_level_transform_op",
51 [](
const PyMlirTransformOptions &
self) {
55 [](PyMlirTransformOptions &
self,
bool value) {
61 "apply_named_sequence",
62 [](MlirOperation payloadRoot, MlirOperation transformRoot,
63 MlirOperation transformModule,
const PyMlirTransformOptions &
options) {
70 py::object obj = py::cast(payloadRoot);
71 obj.attr(
"context").attr(
"_clear_live_operations_inside")(payloadRoot);
74 payloadRoot, transformRoot, transformModule,
options.options);
78 throw py::value_error(
79 "Failed to apply named transform sequence.\nDiagnostic message " +
82 py::arg(
"payload_root"), py::arg(
"transform_root"),
83 py::arg(
"transform_module"),
84 py::arg(
"transform_options") = PyMlirTransformOptions());
87 "copy_symbols_and_merge_into",
88 [](MlirOperation target, MlirOperation other) {
94 throw py::value_error(
95 "Failed to merge symbols.\nDiagnostic message " +
99 py::arg(
"target"), py::arg(
"other"));
103 m.doc() =
"MLIR Transform dialect interpreter functionality.";
static llvm::ManagedStatic< PassManagerOptions > options
RAII scope intercepting all diagnostics into a string.
std::string takeMessage()
MLIR_CAPI_EXPORTED MlirContext mlirOperationGetContext(MlirOperation op)
Gets the context this operation is associated with.
static bool mlirLogicalResultIsSuccess(MlirLogicalResult res)
Checks if the given logical result represents a success.
static bool mlirLogicalResultIsFailure(MlirLogicalResult res)
Checks if the given logical result represents a failure.
A logical result value, essentially a boolean with named states.