[Mlir-commits] [mlir] [mlir] Make emitWarning/emitRemark to use OpWithFlags (PR #217804)
lonely eagle
llvmlistbot at llvm.org
Fri Aug 21 02:05:17 PDT 2026
linuxlonelyeagle wrote:
> Can you show before/after for a typical case?
Here is a clear example from my setup. Each remark represents the result of an analysis on the loop structure. As you can see, emitting remarks directly on the loop creates far too much output.
Before
```
a.mlir:4:3: remark: message0
affine.for %i = 0 to %arg1 {
^
a.mlir:4:3: note: see current operation:
affine.for %arg2 = 0 to %arg1 {
affine.for %arg3 = 1 to %arg1 {
%0 = affine.load %arg0[%arg3, %arg2] : memref<?x?xf32>
%1 = affine.load %arg0[%arg2, %arg3 - 1] : memref<?x?xf32>
%2 = arith.addf %0, %0 : f32
affine.store %2, %arg0[%arg2, %arg3] : memref<?x?xf32>
}
}
a.mlir:4:3: remark: message1
affine.for %i = 0 to %arg1 {
^
a.mlir:4:3: note: see current operation:
affine.for %arg2 = 0 to %arg1 {
affine.for %arg3 = 1 to %arg1 {
%0 = affine.load %arg0[%arg3, %arg2] : memref<?x?xf32>
%1 = affine.load %arg0[%arg2, %arg3 - 1] : memref<?x?xf32>
%2 = arith.addf %0, %0 : f32
affine.store %2, %arg0[%arg2, %arg3] : memref<?x?xf32>
}
}
a.mlir:4:3: remark: message2
affine.for %i = 0 to %arg1 {
^
a.mlir:4:3: note: see current operation:
affine.for %arg2 = 0 to %arg1 {
affine.for %arg3 = 1 to %arg1 {
%0 = affine.load %arg0[%arg3, %arg2] : memref<?x?xf32>
%1 = affine.load %arg0[%arg2, %arg3 - 1] : memref<?x?xf32>
%2 = arith.addf %0, %0 : f32
affine.store %2, %arg0[%arg2, %arg3] : memref<?x?xf32>
}
}
a.mlir:4:3: remark: message3
affine.for %i = 0 to %arg1 {
^
a.mlir:4:3: note: see current operation:
affine.for %arg2 = 0 to %arg1 {
affine.for %arg3 = 1 to %arg1 {
%0 = affine.load %arg0[%arg3, %arg2] : memref<?x?xf32>
%1 = affine.load %arg0[%arg2, %arg3 - 1] : memref<?x?xf32>
%2 = arith.addf %0, %0 : f32
affine.store %2, %arg0[%arg2, %arg3] : memref<?x?xf32>
}
}
a.mlir:4:3: remark: message4
```
After
```
a.mlir:4:3: remark: message0
affine.for %i = 0 to %arg1 {
^
a.mlir:4:3: note: see current operation: affine.for %arg2 = 0 to %arg1 {...}
a.mlir:4:3: remark: message1
affine.for %i = 0 to %arg1 {
^
a.mlir:4:3: note: see current operation: affine.for %arg2 = 0 to %arg1 {...}
a.mlir:4:3: remark: message2
affine.for %i = 0 to %arg1 {
^
a.mlir:4:3: note: see current operation: affine.for %arg2 = 0 to %arg1 {...}
a.mlir:4:3: remark: message3
affine.for %i = 0 to %arg1 {
^
a.mlir:4:3: note: see current operation: affine.for %arg2 = 0 to %arg1 {...}
a.mlir:4:3: remark: message4
affine.for %i = 0 to %arg1 {
```
https://github.com/llvm/llvm-project/pull/217804
More information about the Mlir-commits
mailing list