23 struct PyMlirTransformOptions {
25 PyMlirTransformOptions(PyMlirTransformOptions &&other) {
27 other.options.ptr =
nullptr;
29 PyMlirTransformOptions(
const PyMlirTransformOptions &) =
delete;
38 nb::class_<PyMlirTransformOptions>(m,
"TransformOptions")
42 [](
const PyMlirTransformOptions &
self) {
45 [](PyMlirTransformOptions &
self,
bool value) {
49 "enforce_single_top_level_transform_op",
50 [](
const PyMlirTransformOptions &
self) {
54 [](PyMlirTransformOptions &
self,
bool value) {
60 "apply_named_sequence",
61 [](MlirOperation payloadRoot, MlirOperation transformRoot,
62 MlirOperation transformModule,
const PyMlirTransformOptions &
options) {
69 nb::object obj = nb::cast(payloadRoot);
70 obj.attr(
"context").attr(
"_clear_live_operations_inside")(payloadRoot);
73 payloadRoot, transformRoot, transformModule,
options.options);
77 throw nb::value_error(
78 (
"Failed to apply named transform sequence.\nDiagnostic message " +
82 nb::arg(
"payload_root"), nb::arg(
"transform_root"),
83 nb::arg(
"transform_module"),
84 nb::arg(
"transform_options") = PyMlirTransformOptions());
87 "copy_symbols_and_merge_into",
88 [](MlirOperation target, MlirOperation other) {
94 throw nb::value_error(
95 (
"Failed to merge symbols.\nDiagnostic message " +
100 nb::arg(
"target"), nb::arg(
"other"));
104 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.