Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions mlir/lib/Bindings/Python/TransformInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include "mlir-c/IR.h"
#include "mlir-c/Support.h"
#include "mlir/Bindings/Python/Diagnostics.h"
#include "mlir/Bindings/Python/NanobindAdaptors.h"
#include "mlir/Bindings/Python/Nanobind.h"
#include "mlir/Bindings/Python/NanobindAdaptors.h"

namespace nb = nanobind;

Expand Down Expand Up @@ -70,8 +70,17 @@ static void populateTransformInterpreterSubmodule(nb::module_ &m) {

MlirLogicalResult result = mlirTransformApplyNamedSequence(
payloadRoot, transformRoot, transformModule, options.options);
if (mlirLogicalResultIsSuccess(result))
if (mlirLogicalResultIsSuccess(result)) {
// Even in cases of success, we might have diagnostics to report:
std::string msg;
if ((msg = scope.takeMessage()).size() > 0) {
fprintf(stderr,
"Diagnostic generated while applying "
"transform.named_sequence:\n%s",
msg.data());
}
return;
}

throw nb::value_error(
("Failed to apply named transform sequence.\nDiagnostic message " +
Expand Down