Commit 201a1fa
committed
[MLIR][OpenMP][OMPIRBuilder] Error propagation across callbacks
This is a small proof of concept showing an approach to communicate errors
between MLIR to LLVM IR translation of the OpenMP dialect and the OMPIRBuilder.
It only implements the approach for a single case, so it doesn't compile or
run, since it's only intended to show how it could look like and discuss it
before investing too much effort on a full implementation.
The main idea is to use `llvm::Error` objects returned by callbacks passed to
`OMPIRBuilder` codegen functions that they can then check and forward back to
the caller to avoid continuing after an error has been hit. The caller then
emits an MLIR error diagnostic based on that and stops the translation process.
This should prevent encountering any unsupported operations or arguments, or
any other unexpected error from resulting in a compiler crash. Instead, a
descriptive error message is presented to users.1 parent 15d8576 commit 201a1fa
File tree
3 files changed
+36
-25
lines changed- llvm
- include/llvm/Frontend/OpenMP
- lib/Frontend/OpenMP
- mlir/lib/Target/LLVMIR/Dialect/OpenMP
3 files changed
+36
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
589 | 589 | | |
590 | 590 | | |
591 | 591 | | |
| 592 | + | |
| 593 | + | |
592 | 594 | | |
593 | | - | |
| 595 | + | |
594 | 596 | | |
595 | 597 | | |
596 | 598 | | |
597 | 599 | | |
598 | 600 | | |
| 601 | + | |
| 602 | + | |
599 | 603 | | |
600 | | - | |
| 604 | + | |
601 | 605 | | |
602 | 606 | | |
603 | 607 | | |
| |||
607 | 611 | | |
608 | 612 | | |
609 | 613 | | |
| 614 | + | |
| 615 | + | |
610 | 616 | | |
611 | | - | |
| 617 | + | |
612 | 618 | | |
613 | 619 | | |
614 | 620 | | |
| |||
626 | 632 | | |
627 | 633 | | |
628 | 634 | | |
629 | | - | |
630 | | - | |
631 | | - | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
632 | 638 | | |
633 | 639 | | |
634 | 640 | | |
| |||
1262 | 1268 | | |
1263 | 1269 | | |
1264 | 1270 | | |
1265 | | - | |
1266 | | - | |
1267 | | - | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
1268 | 1274 | | |
1269 | 1275 | | |
1270 | 1276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2048 | 2048 | | |
2049 | 2049 | | |
2050 | 2050 | | |
2051 | | - | |
| 2051 | + | |
2052 | 2052 | | |
2053 | 2053 | | |
2054 | 2054 | | |
| |||
2066 | 2066 | | |
2067 | 2067 | | |
2068 | 2068 | | |
2069 | | - | |
| 2069 | + | |
| 2070 | + | |
2070 | 2071 | | |
2071 | 2072 | | |
2072 | 2073 | | |
| |||
Lines changed: 18 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
| 140 | + | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
| 218 | + | |
| 219 | + | |
222 | 220 | | |
223 | 221 | | |
224 | 222 | | |
| |||
1145 | 1143 | | |
1146 | 1144 | | |
1147 | 1145 | | |
1148 | | - | |
1149 | | - | |
| 1146 | + | |
1150 | 1147 | | |
1151 | | - | |
| 1148 | + | |
1152 | 1149 | | |
1153 | 1150 | | |
1154 | | - | |
1155 | | - | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
1156 | 1154 | | |
| 1155 | + | |
1157 | 1156 | | |
1158 | 1157 | | |
1159 | | - | |
1160 | | - | |
1161 | | - | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
1162 | 1166 | | |
1163 | 1167 | | |
1164 | 1168 | | |
| |||
0 commit comments