Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a362004
[microTVM] Update support for ARMv7m intrinsic
sergio-grovety Sep 12, 2021
13dee66
Merge branch 'apache:main' into update-arm-simd-intrinsic
sergio-grovety Sep 14, 2021
0ea201e
[microTVM] Update support for ARMv7m intrinsic
sergio-grovety Sep 12, 2021
1d4288a
Merge branch 'update-arm-simd-intrinsic' of https://github.com/sergey…
sergio-grovety Sep 14, 2021
6d7bdaa
Issue 8717 Add schedule for depthwise_conv2d_nhwc
sergio-grovety Sep 16, 2021
36aa10d
Implemented discussed changes.
sergio-grovety Sep 17, 2021
605cb1b
Removed unnecessary test files.
sergio-grovety Sep 17, 2021
8dc5a3c
Formatting fixed.
sergio-grovety Sep 17, 2021
4cdf12c
Formatting fixed2.
sergio-grovety Sep 17, 2021
5288a52
Formatting fixed3.
sergio-grovety Sep 17, 2021
f844d74
Formatting fixed4.
sergio-grovety Sep 17, 2021
47e3db2
Formatting fixed5.
sergio-grovety Sep 17, 2021
84ac766
Fixed test time result checking.
sergio-grovety Sep 20, 2021
c265113
Check rebuild.
sergio-grovety Sep 20, 2021
83a86dd
Formatting fixed.
sergio-grovety Sep 20, 2021
3d8b944
Formatting fixed.
sergio-grovety Sep 20, 2021
af04a38
Merge branch 'update-arm-simd-intrinsic' of https://github.com/sergey…
sergio-grovety Sep 22, 2021
0ccb5a0
Add default DepthwiseConv2D schedule in NHWC layout for arm cpu
sergio-grovety Sep 23, 2021
e927567
Merge branch 'update-arm-simd-intrinsic' of https://github.com/sergey…
sergio-grovety Sep 24, 2021
80f936e
Fixed micro model library test. Checking size reduced to 16 bytes fro…
sergio-grovety Sep 27, 2021
11c688f
Revert "Merge branch 'update-arm-simd-intrinsic' of https://github.co…
Sep 28, 2021
e64aea9
Revert "fix test_export_model_library_format_workspace"
Sep 28, 2021
3c19f9c
move schedule_depthwise_conv2d_nhwc to generic conv2d, add test for s…
Sep 29, 2021
456a365
Revert wrong merge changes
Sep 29, 2021
6c04d38
Merge remote-tracking branch 'origin/preview-issue8717' into issue871…
Sep 29, 2021
918f0c8
empty commit to force pipeline restart
Sep 30, 2021
bb79260
Add condition to use compute_at for generic schedule_depthwise_conv2d…
Sep 30, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions python/tvm/relay/op/strategy/arm_cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from tvm import topi
from ....target import arm_isa
from ....topi.generic import conv2d as conv2d_generic
from .generic import *
from .. import op as _op

Expand Down Expand Up @@ -197,11 +198,19 @@ def conv2d_strategy_arm_cpu(attrs, inputs, out_type, target):
)
elif layout == "NHWC":
assert kernel_layout == "HWOI"
strategy.add_implementation(
wrap_compute_conv2d(topi.arm_cpu.compute_depthwise_conv2d_nhwc),
wrap_topi_schedule(topi.arm_cpu.schedule_depthwise_conv2d_nhwc),
name="depthwise_conv2d_nhwc.arm_cpu",
)
is_aarch64 = topi.arm_cpu.arm_utils.is_aarch64_arm()
if is_aarch64 or "+neon" in target.mattr:
strategy.add_implementation(
wrap_compute_conv2d(topi.arm_cpu.compute_depthwise_conv2d_nhwc),
wrap_topi_schedule(topi.arm_cpu.schedule_depthwise_conv2d_nhwc),
name="depthwise_conv2d_nhwc.arm_cpu",
)
else:
strategy.add_implementation(
wrap_compute_conv2d(topi.nn.depthwise_conv2d_nhwc),
wrap_topi_schedule(conv2d_generic.schedule_depthwise_conv2d_nhwc),
name="depthwise_conv2d_nhwc.generic",
)
else:
raise RuntimeError("Unsupported depthwise_conv2d layout {} for arm cpu".format(layout))
else: # group_conv2d
Expand Down
31 changes: 30 additions & 1 deletion python/tvm/topi/generic/conv2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from tvm import te
from tvm import autotvm
from tvm.autotvm.task.space import SplitEntity, OtherOptionEntity
from ..utils import get_const_tuple
from ..utils import get_const_tuple, traverse_inline


def fallback_schedule_cpu_common_int8(cfg, wkl, int32_lanes, num_int8_elements):
Expand Down Expand Up @@ -361,3 +361,32 @@ def schedule_conv_NCHWc_cpu_1x1_int8(
raise ValueError("Unsupported output ndim: %s" % out_ndim)

return s


def schedule_depthwise_conv2d_nhwc(outs):
"""Create schedule for depthwise conv2d in NHWC layout.
Parameters
----------
outs : list[te.tensor.Tensor]
The output tensors.
Returns
-------
s : tvm.te.schedule.Schedule
The computation schedule for depthwise conv2d.
"""
outs = [outs] if isinstance(outs, te.tensor.Tensor) else outs
s = te.create_schedule([x.op for x in outs])

def _callback(op):
"""Traverse operators from computation graph"""
if "depthwise_conv2d_nhwc" in op.tag:
out = outs[0]
depthwise_conv2d_out = op.output(0)
data_pad = depthwise_conv2d_out.op.input_tensors[0]
s[data_pad].compute_inline()
if depthwise_conv2d_out != out:
s[depthwise_conv2d_out].compute_at(s[out], s[out].op.axis[3])
s[out].fuse(*s[out].op.axis)

traverse_inline(s, outs[0].op, _callback)
return s
6 changes: 5 additions & 1 deletion tests/python/topi/python/test_topi_depthwise_conv2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from tvm.contrib.pickle_memoize import memoize
from tvm.topi.nn.depthwise_conv2d import _get_workload
from tvm.topi.x86.depthwise_conv2d import _fallback_schedule
from tvm.topi.generic import conv2d as conv2d_generic


_depthwise_conv2d_implement = {
Expand All @@ -53,7 +54,10 @@
],
},
"NHWC": {
"generic": [(topi.nn.depthwise_conv2d_nhwc, topi.generic.schedule_depthwise_conv2d_nhwc)],
"generic": [
(topi.nn.depthwise_conv2d_nhwc, topi.generic.schedule_depthwise_conv2d_nhwc),
(topi.nn.depthwise_conv2d_nhwc, conv2d_generic.schedule_depthwise_conv2d_nhwc),
],
"arm_cpu": [
(
topi.arm_cpu.compute_depthwise_conv2d_nhwc,
Expand Down