Commit 7798dad
authored
[TKW] Add missing validation and error messages (#432)
This is a collection of small changes adding additional validation or
more verbose error messages to TKW.
Includes:
- More verbose (or any) error messages for existing asserts and
exceptions. Maybe this is too much, but the current messages frequently
don't tell you what's going wrong. I think it's better to err on the
side of too much information. If these get annoying for some reason we
can trim them.
- Transforming some builtin `KeyError` into more specific error messages
with context
- Making the validation if `get_custom` is passed an op an error
instead. I think this more likely than not points to a bug, so it's
better for it to be an error. I can't remember the specific case in
which I hit it.
- Adding earlier validation if there's a type mismatch between a reduce
op init and return types.
- Adding earlier validation if there's an issue when decomposing reduce
ops and the local reduction doesn't match the accumulator reduction.
- Reporting the argument that has an issue if there's a failure in
decomposing reduce ops.
- Printing which node had an issue if there's a failure during codegen
- Validating that reduction and generated for loop have the same number
of arguments. This otherwise results in a failure later on, but we can
give more useful information here. I reported
#384 for the bug that
causes this to fire.
- Validating MMA shapes. `m` has to be in `lhs` and `n` in `rhs`.
Locally, I actually have much more restrictive validation that lhs had
to be `[..., m, k]` and rhs `[..., n, k]`. In theory it looks like Wave
is supposed to figure things out if that isn't the setup, but I never
had a case where it actually worked, so it seems like you need walk some
narrow path. This version is the less restrictive one though.
- Reporting more information if IREE invocation fails.
- Removing assumption that a reduction has users in `get_users`
- Removing some unused variables and arguments
- Adding a `__str__` method for IndexingContext and `__repr__` methods
to `ExpansionInfo` and `ReductionInfo`. Maybe these should be data
classes?
- Adding some missing types to some functions
One note is that I'm not really sure what the convention is for
Exception types in the project, so a lot of these are just RuntimeError.
That's not awesome, but I think it's still a lot more helpful than
nothing. I tried to avoid `raise ... from` as in my experience these
usually result in unhelpfully verbose stacks.1 parent 7230825 commit 7798dad
File tree
12 files changed
+200
-49
lines changed- iree/turbine/kernel
- _support
- compiler
- ops
- wave
- analysis
- codegen
- expansion
- utils
12 files changed
+200
-49
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
120 | 132 | | |
121 | 133 | | |
122 | 134 | | |
| |||
157 | 169 | | |
158 | 170 | | |
159 | 171 | | |
160 | | - | |
| 172 | + | |
161 | 173 | | |
162 | 174 | | |
163 | 175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
349 | | - | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
350 | 356 | | |
351 | 357 | | |
352 | 358 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
357 | | - | |
358 | | - | |
| 357 | + | |
359 | 358 | | |
360 | 359 | | |
361 | 360 | | |
| |||
549 | 548 | | |
550 | 549 | | |
551 | 550 | | |
552 | | - | |
| 551 | + | |
553 | 552 | | |
554 | 553 | | |
555 | 554 | | |
| |||
1407 | 1406 | | |
1408 | 1407 | | |
1409 | 1408 | | |
1410 | | - | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
1411 | 1415 | | |
1412 | 1416 | | |
1413 | 1417 | | |
| |||
1689 | 1693 | | |
1690 | 1694 | | |
1691 | 1695 | | |
1692 | | - | |
| 1696 | + | |
| 1697 | + | |
1693 | 1698 | | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
1694 | 1704 | | |
1695 | 1705 | | |
1696 | 1706 | | |
| |||
1703 | 1713 | | |
1704 | 1714 | | |
1705 | 1715 | | |
1706 | | - | |
| 1716 | + | |
1707 | 1717 | | |
1708 | 1718 | | |
1709 | 1719 | | |
| |||
1715 | 1725 | | |
1716 | 1726 | | |
1717 | 1727 | | |
1718 | | - | |
| 1728 | + | |
1719 | 1729 | | |
1720 | 1730 | | |
1721 | | - | |
1722 | | - | |
| 1731 | + | |
| 1732 | + | |
1723 | 1733 | | |
1724 | 1734 | | |
1725 | 1735 | | |
| |||
1882 | 1892 | | |
1883 | 1893 | | |
1884 | 1894 | | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
1885 | 1904 | | |
1886 | 1905 | | |
1887 | 1906 | | |
| |||
Lines changed: 35 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
125 | 127 | | |
126 | 128 | | |
127 | 129 | | |
| |||
685 | 687 | | |
686 | 688 | | |
687 | 689 | | |
688 | | - | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
689 | 697 | | |
690 | 698 | | |
691 | 699 | | |
| |||
741 | 749 | | |
742 | 750 | | |
743 | 751 | | |
744 | | - | |
745 | | - | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
746 | 771 | | |
747 | 772 | | |
748 | 773 | | |
| |||
753 | 778 | | |
754 | 779 | | |
755 | 780 | | |
756 | | - | |
| 781 | + | |
| 782 | + | |
757 | 783 | | |
758 | 784 | | |
759 | 785 | | |
| |||
774 | 800 | | |
775 | 801 | | |
776 | 802 | | |
777 | | - | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
778 | 806 | | |
779 | 807 | | |
780 | 808 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
115 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
116 | 121 | | |
117 | 122 | | |
118 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
| 394 | + | |
394 | 395 | | |
395 | | - | |
396 | | - | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
397 | 403 | | |
398 | 404 | | |
399 | 405 | | |
| |||
768 | 774 | | |
769 | 775 | | |
770 | 776 | | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
771 | 782 | | |
772 | 783 | | |
773 | 784 | | |
| |||
785 | 796 | | |
786 | 797 | | |
787 | 798 | | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
788 | 805 | | |
789 | 806 | | |
790 | 807 | | |
| |||
907 | 924 | | |
908 | 925 | | |
909 | 926 | | |
910 | | - | |
| 927 | + | |
911 | 928 | | |
912 | 929 | | |
913 | 930 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
188 | 187 | | |
189 | 188 | | |
190 | 189 | | |
| |||
205 | 204 | | |
206 | 205 | | |
207 | 206 | | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | 207 | | |
214 | 208 | | |
215 | 209 | | |
| |||
242 | 236 | | |
243 | 237 | | |
244 | 238 | | |
245 | | - | |
246 | | - | |
247 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
248 | 253 | | |
249 | 254 | | |
250 | 255 | | |
| |||
258 | 263 | | |
259 | 264 | | |
260 | 265 | | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
261 | 279 | | |
262 | 280 | | |
263 | 281 | | |
| |||
0 commit comments