grant-arm commented on a change in pull request #8909:
URL: https://github.com/apache/tvm/pull/8909#discussion_r701122082
##########
File path: python/tvm/topi/x86/nn.py
##########
@@ -65,18 +49,49 @@ def schedule_softmax(outs):
)
# only parallelize outer dimensions up to axis
- outer_axes = [s[softmax].op.axis[i] for i in range(0, axis)]
- fused_outer_axes = s[softmax].fuse(*outer_axes)
- s[softmax].parallel(fused_outer_axes)
+ outer_axes = [s[softmax_op].op.axis[i] for i in range(0, axis)]
+ fused_outer_axes = s[softmax_op].fuse(*outer_axes)
+ s[softmax_op].parallel(fused_outer_axes)
# move computations with the same outer dimensions under the same root
- s[max_elem].compute_at(s[softmax], fused_outer_axes)
- s[expsum].compute_at(s[softmax], fused_outer_axes)
+ s[max_elem].compute_at(s[softmax_op], fused_outer_axes)
+ s[expsum].compute_at(s[softmax_op], fused_outer_axes)
if delta is not None:
s[exp].compute_inline()
s[delta].compute_inline()
if exp is not None:
- s[exp].compute_at(s[softmax], fused_outer_axes)
+ s[exp].compute_at(s[softmax_op], fused_outer_axes)
+
+ if softmax_op != outs[0].op:
+ # fuse softmax output with following elemwise ops.
Review comment:
```suggestion
# fuse softmax output with following elemtwise ops.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]