Commit befdc4e
authored
[Fix][TIR] LowerCrossThreadReduction with write-back predicate (#14199)
Prior to this PR, the cross-thread reduction lowering pass does not
add a store predicate to the write-back block. This is in consideration
that for a certain write-back buffer position, all values being stored
(by all the threads) in the write-back block are the same. Since all
threads are writing the same value, we were assuming that not having a
write-back block predicate is fine, because the result will not be wrong
in any way.
However, recently we noticed that some GPU backend compiler will capture
this behavior (multiple threads writing a same position) as a race
condition and thus throw compilation error. The compiler does not take
the fact that all values being stored are the same, and insist on
complaining.
This means that we will still need the write-back block predicate to
make things work. And this PR does this change. I have done integration
tests locally to make sure that the generated kernels is right and
produces the right results numerically.1 parent baedf7f commit befdc4e
File tree
2 files changed
+21
-1
lines changed- src/tir/transforms
- tests/python/unittest
2 files changed
+21
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
410 | 416 | | |
411 | 417 | | |
412 | | - | |
| 418 | + | |
413 | 419 | | |
414 | 420 | | |
415 | 421 | | |
| |||
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
| |||
136 | 137 | | |
137 | 138 | | |
138 | 139 | | |
| 140 | + | |
139 | 141 | | |
140 | 142 | | |
141 | 143 | | |
| |||
183 | 185 | | |
184 | 186 | | |
185 | 187 | | |
| 188 | + | |
186 | 189 | | |
187 | 190 | | |
188 | 191 | | |
| |||
264 | 267 | | |
265 | 268 | | |
266 | 269 | | |
| 270 | + | |
267 | 271 | | |
268 | 272 | | |
269 | 273 | | |
| |||
326 | 330 | | |
327 | 331 | | |
328 | 332 | | |
| 333 | + | |
329 | 334 | | |
330 | 335 | | |
331 | 336 | | |
| |||
428 | 433 | | |
429 | 434 | | |
430 | 435 | | |
| 436 | + | |
431 | 437 | | |
432 | 438 | | |
433 | 439 | | |
| |||
467 | 473 | | |
468 | 474 | | |
469 | 475 | | |
| 476 | + | |
470 | 477 | | |
471 | 478 | | |
472 | 479 | | |
| |||
636 | 643 | | |
637 | 644 | | |
638 | 645 | | |
| 646 | + | |
639 | 647 | | |
640 | 648 | | |
641 | 649 | | |
| |||
676 | 684 | | |
677 | 685 | | |
678 | 686 | | |
| 687 | + | |
679 | 688 | | |
680 | 689 | | |
681 | 690 | | |
| |||
865 | 874 | | |
866 | 875 | | |
867 | 876 | | |
| 877 | + | |
868 | 878 | | |
869 | 879 | | |
870 | 880 | | |
| |||
907 | 917 | | |
908 | 918 | | |
909 | 919 | | |
| 920 | + | |
910 | 921 | | |
911 | 922 | | |
912 | 923 | | |
| |||
1018 | 1029 | | |
1019 | 1030 | | |
1020 | 1031 | | |
| 1032 | + | |
1021 | 1033 | | |
1022 | 1034 | | |
1023 | 1035 | | |
| |||
1109 | 1121 | | |
1110 | 1122 | | |
1111 | 1123 | | |
| 1124 | + | |
1112 | 1125 | | |
1113 | 1126 | | |
1114 | 1127 | | |
| |||
1227 | 1240 | | |
1228 | 1241 | | |
1229 | 1242 | | |
| 1243 | + | |
1230 | 1244 | | |
1231 | 1245 | | |
1232 | 1246 | | |
| |||
0 commit comments