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

[TOPI][ADRENO] Add Group Conv2d texture schedule #17274

Merged
merged 4 commits into from
Aug 19, 2024
Merged
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
31 changes: 30 additions & 1 deletion python/tvm/relay/op/strategy/adreno.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,37 @@ def conv2d_strategy_adreno(attrs, inputs, out_type, target):
+ kernel_layout
+ ") - only support NCHW4c / OIHW4o and NHWC / HWOI layouts for conv2d"
)
elif (data_layout == "NCHW4c" or data_layout == "NCHW") and (
kernel_layout == "OIHW" or kernel_layout == "OIHW4o"
):
pad_in_chunks = (len(data.shape) == 5 and data.shape[1] % groups != 0) or (
len(data.shape) == 4 and data.shape[1] % (groups * 4) != 0
)
pad_out_chunks = (len(kernel.shape) == 5 and kernel.shape[0] % groups != 0) or (
len(kernel.shape) == 4 and kernel.shape[0] % (groups * 4) != 0
)

if not (pad_in_chunks or pad_out_chunks):
strategy.add_implementation(
wrap_compute_conv2d(topi.adreno.group_conv2d_nchwc),
wrap_topi_schedule(topi.adreno.schedule_group_conv2d_nchwc),
name="group_conv2d_nchwc.image2d",
plevel=10,
)
elif len(data.shape) == 4 and len(kernel.shape) == 4:
strategy.add_implementation(
wrap_compute_conv2d(topi.cuda.group_conv2d_nchw, has_groups=True),
wrap_topi_schedule(topi.cuda.schedule_group_conv2d_nchw),
name="group_conv2d_nchw.cuda",
)
else:
raise RuntimeError(
"General group convolution is not currently supported for NCHWc layouts"
)
else:
raise RuntimeError("General group convolution is not currently supported")
raise RuntimeError(
"General group convolution has limited support for NCHW(4c) layouts..."
)
return strategy


Expand Down
1 change: 1 addition & 0 deletions python/tvm/topi/adreno/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from .conv2d_nchw import *
from .depthwise_conv2d_nchw import *
from .conv2d_nhwc import *
from .group_conv2d_nchw import *
from .depthwise_conv2d_nhwc import *
from .pooling import *
from .conv2d_alter_op import *
Expand Down
Loading
Loading