Commit 74bec5d
[GlobalOpt] Accept arith.maxnumf in the softmax matcher (#24466)
The stabilizing max of a softmax can be spelled with either arith.maximumf
(NaN-propagating, as emitted by e.g. StableHLO frontends) or arith.maxnumf
(NaN-ignoring). The latter is what linalg.softmax itself decomposes to
(SoftmaxOp::decomposeOperation and the iree-codegen-decompose-softmax pass
both use arith.maxnumf), so matching only arith.maximumf made the matcher
narrower than the op it raises to and missed that form.
Accept both ops for the max reduction. This is strictly safer: maxnumf is
the form linalg.softmax decomposes to, so raising it introduces no NaN
behavior change. Add a positive lit test for the maxnumf spelling.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Han || Alex <36247722+Alex-Wengg@users.noreply.github.com>1 parent 8c7f8c5 commit 74bec5d
2 files changed
Lines changed: 56 additions & 4 deletions
Lines changed: 13 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
639 | 639 | | |
640 | 640 | | |
641 | 641 | | |
642 | | - | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
643 | 650 | | |
644 | 651 | | |
645 | | - | |
646 | | - | |
647 | | - | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
648 | 657 | | |
649 | 658 | | |
650 | 659 | | |
| |||
Lines changed: 43 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
171 | 214 | | |
172 | 215 | | |
173 | 216 | | |
| |||
0 commit comments