forked from apache/tvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TOPI][ARM] Improve injective schedule (apache#2801)
- Loading branch information
Showing
4 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# pylint: disable=invalid-name, unused-variable | ||
"""Schedule for pooling operators""" | ||
import tvm | ||
from .. import generic | ||
|
||
@generic.schedule_injective.register(["arm_cpu"]) | ||
def schedule_injective(outs): | ||
"""ARM CPU schedule for injective op. | ||
Parameters | ||
---------- | ||
outs: Array of Tensor | ||
The computation graph description of injective in the format | ||
of an array of tensors. | ||
Returns | ||
------- | ||
sch: Schedule | ||
The computation schedule for the op. | ||
""" | ||
outs = [outs] if isinstance(outs, tvm.tensor.Tensor) else outs | ||
s = tvm.create_schedule([x.op for x in outs]) | ||
x = outs[0] | ||
if list(s[x].op.axis): | ||
# do not vectorize for broadcast | ||
(io, ii) = s[x].split(list(s[x].op.axis)[-1], 8) | ||
s[x].vectorize(ii) | ||
tvm.schedule.AutoInlineInjective(s) | ||
if len(s[x].op.axis) >= 4: | ||
fused = s[x].fuse(s[x].op.axis[0], s[x].op.axis[1], s[x].op.axis[2]) | ||
s[x].parallel(fused) | ||
elif len(s[x].op.axis) >= 3: | ||
fused = s[x].fuse(s[x].op.axis[0], s[x].op.axis[1]) | ||
s[x].parallel(fused) | ||
elif len(s[x].op.axis) >= 2: | ||
s[x].parallel(s[x].op.axis[0]) | ||
return s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters