Skip to content

Commit 3b94875

Browse files
committed
fx
1 parent 9302c26 commit 3b94875

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

mlir/docs/Remarks.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ them to a pluggable **streamer**. By default, MLIR integrates with LLVM’s
1414
- Stream remarks as passes run
1515
- Serialize them to **YAML** or **LLVM bitstream** for tooling
1616

17-
______________________________________________________________________
17+
***
1818

1919
## Key Points
2020

@@ -24,7 +24,7 @@ ______________________________________________________________________
2424
- **Kinds**`Passed`, `Missed`, `Failure`, `Analysis`.
2525
- **API** – Lightweight streaming interface using `<<` (like MLIR diagnostics).
2626

27-
______________________________________________________________________
27+
***
2828

2929
## How It Works
3030

@@ -45,7 +45,7 @@ remark format and writes YAML/bitstream via `llvm::remarks::RemarkStreamer`.
4545
4646
**Ownership flow:** `MLIRContext` → `RemarkEngine` → `MLIRRemarkStreamerBase`
4747
48-
______________________________________________________________________
48+
***
4949
5050
## Categories
5151
@@ -55,15 +55,15 @@ MLIR provides four built-in remark categories (extendable if needed):
5555
5656
Optimization/transformation succeeded.
5757
58-
```c++
58+
```
5959
[Passed] RemarkName | Category:Vectorizer:myPass1 | Function=foo | Remark="vectorized loop", tripCount=128
6060
```
6161
6262
#### 2. **Missed**
6363
6464
Optimization/transformation didn’t apply — ideally with actionable feedback.
6565
66-
```c++
66+
```
6767
[Missed] | Category:Unroll | Function=foo | Reason="tripCount=4 < threshold=256", Suggestion="increase unroll to 128"
6868
```
6969
@@ -79,20 +79,20 @@ compiler, but the attempt fails for some reason:
7979
$ your-compiler -use-max-register=100 mycode.xyz
8080
```
8181

82-
```c++
82+
```
8383
[Failed] Category:RegisterAllocator | Reason="Limiting to use-max-register=100 failed; it now uses 104 registers for better performance"
8484
```
8585

8686
#### 4. **Analysis**
8787

8888
Neutral analysis results.
8989

90-
```c++
90+
```
9191
[Analysis] Category:Register | Remark="Kernel uses 168 registers"
9292
[Analysis] Category:Register | Remark="Kernel uses 10kB local memory"
9393
```
9494

95-
______________________________________________________________________
95+
***
9696

9797
## Emitting Remarks
9898

@@ -101,12 +101,12 @@ You append strings or key–value metrics using `<<`.
101101

102102
### Remark Options
103103

104-
When constructing a remark, you typically provide four fields:
104+
When constructing a remark, you typically provide four fields that are `StringRef`:
105105

106-
* **Remark name** – identifiable name
107-
* **Category** – high-level classification
108-
* **Sub-category** – more fine-grained classification
109-
* **Function name** – the function where the remark originates
106+
1. **Remark name** – identifiable name
107+
2. **Category** – high-level classification
108+
3. **Sub-category** – more fine-grained classification
109+
4. **Function name** – the function where the remark originates
110110

111111

112112
### Example
@@ -145,7 +145,7 @@ LogicalResult MyPass::runOnOperation() {
145145
}
146146
```
147147

148-
______________________________________________________________________
148+
***
149149

150150
### Metrics and Shortcuts
151151

@@ -187,7 +187,7 @@ Passing a plain string (e.g. `<< "vectorized loop"`) is equivalent to:
187187
metric("Remark", "vectorized loop")
188188
```
189189

190-
______________________________________________________________________
190+
***
191191

192192
## Enabling Remarks
193193

@@ -220,7 +220,7 @@ args:
220220

221221
**Bitstream format** – compact binary for large runs.
222222

223-
______________________________________________________________________
223+
***
224224

225225
### 2. **With `mlir::emitRemarks` (No Streamer)**
226226

@@ -237,7 +237,7 @@ remark::enableOptimizationRemarks(
237237
/*printAsEmitRemarks=*/true);
238238
```
239239
240-
______________________________________________________________________
240+
***
241241
242242
### 3. **With a Custom Streamer**
243243

0 commit comments

Comments
 (0)