Commit beb6d3f
[mlir][Transforms] Dialect conversion: Add flag to disable rollback (llvm#136490)
This commit adds a new flag to `ConversionConfig` to disallow the
rollback of IR modification. This commit is in preparation of the
One-Shot Dialect Conversion refactoring, which will remove the ability
to roll back IR modifications from the conversion driver.
RFC:
https://discourse.llvm.org/t/rfc-a-new-one-shot-dialect-conversion-driver/79083/46
By default, this flag is set to "true". I.e., the rollback of IR
modifications is allowed. When set to "false", the conversion driver
will report a fatal LLVM error when an IR rollback is requested. The
name of the rolled back pattern is included in the error message.
Moreover, the original IR is no longer restored after a failed
conversion.
Example:
```
within split at llvm-project/mlir/test/Conversion/ArithToSPIRV/fast-math.mlir:1 offset :11:8: error: pattern '(anonymous namespace)::CmpFOpNanKernelPattern' produced IR that could not be legalized
%0 = arith.cmpf ord, %arg0, %arg1 fastmath<fast> : f32
^
within split at llvm-project/mlir/test/Conversion/ArithToSPIRV/fast-math.mlir:1 offset :11:8: note: see current operation: %1 = "arith.cmpf"(%arg0, %arg1) <{fastmath = #arith.fastmath<fast>, predicate = 7 : i64}> : (f32, f32) -> i1
pattern '(anonymous namespace)::CmpFOpNanKernelPattern' rollback of IR modifications requested
UNREACHABLE executed at llvm-project/mlir/lib/Transforms/Utils/DialectConversion.cpp:1231!
```
The majority of patterns in MLIR have already been updated such that
they do not trigger any rollbacks, but a few SPIRV patterns remain. More
information in the RFC.1 parent 200a0dc commit beb6d3f
File tree
2 files changed
+62
-14
lines changed- mlir
- include/mlir/Transforms
- lib/Transforms/Utils
2 files changed
+62
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1239 | 1239 | | |
1240 | 1240 | | |
1241 | 1241 | | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
1242 | 1262 | | |
1243 | 1263 | | |
1244 | 1264 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
861 | 861 | | |
862 | 862 | | |
863 | 863 | | |
864 | | - | |
865 | | - | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
866 | 868 | | |
867 | 869 | | |
868 | 870 | | |
| |||
873 | 875 | | |
874 | 876 | | |
875 | 877 | | |
876 | | - | |
877 | | - | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
878 | 881 | | |
879 | 882 | | |
880 | 883 | | |
| |||
1204 | 1207 | | |
1205 | 1208 | | |
1206 | 1209 | | |
1207 | | - | |
| 1210 | + | |
| 1211 | + | |
1208 | 1212 | | |
1209 | | - | |
| 1213 | + | |
1210 | 1214 | | |
1211 | 1215 | | |
1212 | 1216 | | |
| |||
1216 | 1220 | | |
1217 | 1221 | | |
1218 | 1222 | | |
1219 | | - | |
| 1223 | + | |
| 1224 | + | |
1220 | 1225 | | |
1221 | | - | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
1222 | 1233 | | |
| 1234 | + | |
1223 | 1235 | | |
1224 | 1236 | | |
1225 | 1237 | | |
| |||
2158 | 2170 | | |
2159 | 2171 | | |
2160 | 2172 | | |
2161 | | - | |
| 2173 | + | |
2162 | 2174 | | |
2163 | 2175 | | |
2164 | 2176 | | |
| |||
2168 | 2180 | | |
2169 | 2181 | | |
2170 | 2182 | | |
2171 | | - | |
2172 | | - | |
| 2183 | + | |
| 2184 | + | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
2173 | 2190 | | |
2174 | 2191 | | |
2175 | 2192 | | |
| |||
2674 | 2691 | | |
2675 | 2692 | | |
2676 | 2693 | | |
2677 | | - | |
2678 | | - | |
2679 | | - | |
| 2694 | + | |
| 2695 | + | |
| 2696 | + | |
| 2697 | + | |
| 2698 | + | |
| 2699 | + | |
| 2700 | + | |
| 2701 | + | |
| 2702 | + | |
| 2703 | + | |
| 2704 | + | |
| 2705 | + | |
| 2706 | + | |
| 2707 | + | |
2680 | 2708 | | |
2681 | 2709 | | |
2682 | 2710 | | |
| |||
0 commit comments