Commit 8c7f8c5
[GlobalOpt] Reimplement softmax matcher natively (#24466)
Replace the wholesale relocation of the iree-dialects TransformMatchers
DSL with a self-contained, native matcher in RaiseSpecialOps.cpp, per the
review feedback that this should port only what RaiseSpecialOps needs
rather than carry the generic StructuredOpMatcher framework into
GlobalOptimization.
- Add a local matchSoftmax() plus small helpers that walk the softmax
linalg-op graph directly (reduce_max -> sub -> exp -> reduce_add ->
mul/reciprocal or div), handling both implicit (projected map) and
explicit (pass-through generic) broadcasts. This is behaviorally
faithful to makeSoftmaxMatcher, including the same-source invariant.
- Delete GlobalOptimization/TransformMatchers.{h,cpp} (~3000 lines) and
drop the transform-dialect build deps that only existed for them. The
iree-dialects deps stay removed.
- Add negative lit cases (wrong max init, mismatched source) alongside
the existing softmax raising tests.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Han || Alex <36247722+Alex-Wengg@users.noreply.github.com>1 parent 7da62a7 commit 8c7f8c5
6 files changed
Lines changed: 391 additions & 3071 deletions
File tree
- compiler/src/iree/compiler/GlobalOptimization
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | 74 | | |
76 | 75 | | |
77 | 76 | | |
78 | 77 | | |
79 | 78 | | |
80 | | - | |
81 | 79 | | |
82 | 80 | | |
83 | 81 | | |
| |||
107 | 105 | | |
108 | 106 | | |
109 | 107 | | |
110 | | - | |
111 | 108 | | |
112 | 109 | | |
113 | 110 | | |
114 | 111 | | |
115 | | - | |
116 | 112 | | |
117 | 113 | | |
118 | 114 | | |
119 | | - | |
120 | 115 | | |
121 | 116 | | |
122 | 117 | | |
123 | 118 | | |
124 | 119 | | |
125 | 120 | | |
126 | | - | |
127 | 121 | | |
128 | 122 | | |
129 | 123 | | |
130 | 124 | | |
131 | 125 | | |
132 | 126 | | |
133 | | - | |
134 | | - | |
135 | 127 | | |
136 | 128 | | |
137 | 129 | | |
| |||
Lines changed: 0 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
| |||
63 | 62 | | |
64 | 63 | | |
65 | 64 | | |
66 | | - | |
67 | 65 | | |
68 | 66 | | |
69 | 67 | | |
70 | 68 | | |
71 | 69 | | |
72 | 70 | | |
73 | 71 | | |
74 | | - | |
75 | 72 | | |
76 | 73 | | |
77 | 74 | | |
78 | | - | |
79 | 75 | | |
80 | 76 | | |
81 | 77 | | |
82 | | - | |
83 | 78 | | |
84 | 79 | | |
85 | 80 | | |
86 | 81 | | |
87 | 82 | | |
88 | 83 | | |
89 | | - | |
90 | 84 | | |
91 | 85 | | |
92 | 86 | | |
93 | 87 | | |
94 | 88 | | |
95 | 89 | | |
96 | | - | |
97 | | - | |
98 | 90 | | |
99 | 91 | | |
100 | 92 | | |
| |||
0 commit comments