masahi commented on a change in pull request #10310:
URL: https://github.com/apache/tvm/pull/10310#discussion_r810780520
##########
File path: python/tvm/topi/arm_cpu/conv2d_alter_op.py
##########
@@ -333,6 +343,70 @@ def _alter_conv2d_layout(attrs, inputs, tinfos, out_type):
)
dispatch_ctx.update(target, new_workload, cfg)
return relay.nn.contrib_depthwise_conv2d_nchwc(*inputs, **new_attrs)
+
+ if topi_tmpl == "conv2d_NCHWc_int8.arm_cpu":
+ assert data_layout == "NCHW" and kernel_layout == "OIHW"
+ if cfg.is_fallback:
+ _get_default_config_int8(
+ cfg,
+ data_tensor,
+ kernel_tensor,
+ strides,
+ padding,
+ dilation,
+ out_dtype,
+ False,
+ data_layout,
+ )
+
+ batch_size, in_channel, height, width =
get_const_tuple(data_tensor.shape)
+ out_channel, channel_multiplier, kh, kw =
get_const_tuple(kernel_tensor.shape)
+ ic_bn, oc_bn = cfg["tile_ic"].size[-1], cfg["tile_oc"].size[-1]
+ n_elems = 8
+
+ # convert kernel data layout from 4D to 7D
+ data_expr, kernel_expr = inputs
+ kernel_IHWO = relay.transpose(kernel_expr, axes=(1, 2, 3, 0))
+ kernel_IHWOo = relay.reshape(kernel_IHWO, (in_channel, kh, kw,
out_channel // oc_bn, oc_bn))
+ kernel_OHWoI = relay.transpose(kernel_IHWOo, axes=(3, 1, 2, 4, 0))
+ kernel_OHWoIi = relay.reshape(
+ kernel_OHWoI, (out_channel // oc_bn, kh, kw, oc_bn, in_channel //
ic_bn, ic_bn)
+ )
+ kernel_OHWoIie = relay.reshape(
+ kernel_OHWoIi,
+ (out_channel // oc_bn, kh, kw, oc_bn, in_channel // ic_bn, ic_bn
// n_elems, n_elems),
+ )
+ kernel_OIHWioe = relay.transpose(kernel_OHWoIie, axes=(0, 4, 1, 2, 5,
3, 6))
Review comment:
Can clean this up since https://github.com/apache/tvm/pull/9996 is
merged. See the change there.
--
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]