diff options
| author | Guray Ozen <guray.ozen@gmail.com> | 2025-08-21 16:02:31 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-21 16:02:31 +0200 |
| commit | 3d41197d6803183cdcd88894d568a29215fd2afb (patch) | |
| tree | ca4a100cecf98b7d3c3fcde0cd310e5bc17a14ed /lldb/packages/Python/lldbsuite/test/lldbtest.py | |
| parent | 5d4aa87ca5176a54b8395141df565255e3fde9ed (diff) | |
| download | llvm-3d41197d6803183cdcd88894d568a29215fd2afb.zip llvm-3d41197d6803183cdcd88894d568a29215fd2afb.tar.gz llvm-3d41197d6803183cdcd88894d568a29215fd2afb.tar.bz2 | |
[MLIR] Introduce RemarkEngine + pluggable remark streaming (YAML/Bitstream) (#152474)
This PR implements structured, tooling-friendly optimization remarks
with zero cost unless enabled. It implements:
- `RemarkEngine` collects finalized remarks within `MLIRContext`.
- `MLIRRemarkStreamerBase` abstract class streams them to a backend.
- Backends: `MLIRLLVMRemarkStreamer` (bridges to llvm::remarks →
YAML/Bitstream) or your own custom streamer.
- Optional mirroring to DiagnosticEngine (printAsEmitRemarks +
categories).
- Off by default; no behavior change unless enabled. Thread-safe;
ordering best-effort.
## Overview
```
Passes (reportOptimization*)
│
▼
+-------------------+
| RemarkEngine | collects
+-------------------+
│ │
│ mirror │ stream
▼ ▼
emitRemark MLIRRemarkStreamerBase (abstract)
│
├── MLIRLLVMRemarkStreamer → llvm::remarks → YAML | Bitstream
└── CustomStreamer → your sink
```
## Enable Remark engine and Plug LLVM's Remark streamer
```
// Enable once per MLIRContext. This uses `MLIRLLVMRemarkStreamer`
mlir::remark::enableOptimizationRemarksToFile(
ctx, path, llvm::remarks::Format::YAML, cats);
```
## API to emit remark
```
// Emit from a pass
remark::passed(loc, categoryVectorizer, myPassname1)
<< "vectorized loop";
remark::missed(loc, categoryUnroll, "MyPass")
<< remark::reason("not profitable at this size") // Creates structured reason arg
<< remark::suggest("increase unroll factor to >=4"); // Creates structured suggestion arg
remark::passed(loc, categoryVectorizer, myPassname1)
<< "vectorized loop"
<< remark::metric("tripCount", 128); // Create structured metric on-the-fly
```
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/lldbtest.py')
0 files changed, 0 insertions, 0 deletions
