Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added bit-serial operators for AArch64 #17374

Open
wants to merge 1 commit into
base: v0.16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
34 changes: 24 additions & 10 deletions python/tvm/relay/op/strategy/arm_cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,11 +601,18 @@ def bitserial_conv2d_strategy_arm_cpu(attrs, inputs, out_type, target):
name="bitserial_conv2d_nchw.arm_cpu",
)
elif layout == "NHWC":
strategy.add_implementation(
wrap_compute_bitserial_conv2d(topi.arm_cpu.bitserial_conv2d_nhwc),
wrap_topi_schedule(topi.arm_cpu.schedule_bitserial_conv2d_nhwc),
name="bitserial_conv2d_nhwc.arm_cpu",
)
if target.features.is_aarch64:
strategy.add_implementation(
wrap_compute_bitserial_conv2d(topi.arm_cpu.bitserial_conv2d_nhwc_aarch64),
wrap_topi_schedule(topi.arm_cpu.schedule_bitserial_conv2d_nhwc_aarch64),
name="bitserial_conv2d_nhwc.arm_cpu",
)
else:
strategy.add_implementation(
wrap_compute_bitserial_conv2d(topi.arm_cpu.bitserial_conv2d_nhwc),
wrap_topi_schedule(topi.arm_cpu.schedule_bitserial_conv2d_nhwc),
name="bitserial_conv2d_nhwc.arm_cpu",
)
else:
raise ValueError(f"Data layout {layout} not supported.")
return strategy
Expand All @@ -615,11 +622,18 @@ def bitserial_conv2d_strategy_arm_cpu(attrs, inputs, out_type, target):
def schedule_bitserial_dense_arm_cpu(attrs, inputs, out_type, target):
"""bitserial_dense arm cpu strategy"""
strategy = _op.OpStrategy()
strategy.add_implementation(
wrap_compute_bitserial_dense(topi.arm_cpu.bitserial_dense),
wrap_topi_schedule(topi.arm_cpu.schedule_bitserial_dense),
name="bitserial_dense.arm_cpu",
)
if target.features.is_aarch64:
strategy.add_implementation(
wrap_compute_bitserial_dense(topi.arm_cpu.bitserial_dense_aarch64),
wrap_topi_schedule(topi.arm_cpu.schedule_bitserial_dense_aarch64),
name="bitserial_dense.arm_cpu",
)
else:
strategy.add_implementation(
wrap_compute_bitserial_dense(topi.arm_cpu.bitserial_dense),
wrap_topi_schedule(topi.arm_cpu.schedule_bitserial_dense),
name="bitserial_dense.arm_cpu",
)
return strategy


Expand Down
2 changes: 2 additions & 0 deletions python/tvm/topi/arm_cpu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
from .conv2d_int8 import *
from . import conv2d_alter_op
from .bitserial_conv2d import *
from .bitserial_conv2d_aarch64 import *
from .bitserial_dense import *
from .bitserial_dense_aarch64 import *
from .injective import *
from .group_conv2d import *
from .pooling import *
Expand Down
Loading
Loading