[Mlir-commits] [mlir] [MLIR] Add option to postpone remark emission (PR #157434)

Guray Ozen llvmlistbot at llvm.org
Thu Sep 18 00:11:23 PDT 2025


grypp wrote:

`RemarkEngine` calls `MLIRRemarkStreamerBase` through a configurable callback.

You can configure this callback as shown below. In that case, you don’t need to call `postpone()` when printing the remark—you can implement your own postponing mechanism directly in the streamer.

```
class MyPostponer : public remark::detail::MLIRRemarkStreamerBase {
public:
  DenseSet<Remark> remarks;
  void streamOptimizationRemark(const remark::detail::Remark &remark) override {
    remarks.insert(remark);
  }
  ~MyPostponer() {
    for (const auto &remark : remarks) {
      // sort remarks and etc.
      print(remark)
    }
  }
};

// Configure with the postponer
remark::enableOptimizationRemarks(context, std::make_unique<MyPostponer>(), ...);
```

https://github.com/llvm/llvm-project/pull/157434


More information about the Mlir-commits mailing list