Skip to content
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
14 changes: 2 additions & 12 deletions musa_ext/kernels/math/musa_conv2d_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,7 @@ Status RunMusaConv2D(OpKernelContext* ctx, const Tensor& input,
static_cast<int>(status));
}

mConvolution::Algorithm algo;
status = conv.GetRecommendForwardAlgorithm(handle, algo, y, x, w);
if (status != mStatus::SUCCESS) {
return errors::Internal(
"muDNN Convolution::GetRecommendForwardAlgorithm failed. status=",
static_cast<int>(status), ", data_format=NHWC",
", input_shape=", input.shape().DebugString(),
", filter_shape=", filter.shape().DebugString(),
", output_shape=", output->shape().DebugString());
}
const mConvolution::Algorithm algo = mConvolution::Algorithm::IMPLICIT_GEMM;

size_t workspace_size = 0;
status = conv.GetForwardWorkspaceSize(handle, workspace_size, y, x, w, algo);
Expand Down Expand Up @@ -325,8 +316,7 @@ class MusaConv2DOp : public MusaOpKernel {
return;
}

const bool use_tf32 =
tf32_enabled_ && dilation_h_ == 1 && dilation_w_ == 1;
const bool use_tf32 = tf32_enabled_ && dilation_h_ == 1 && dilation_w_ == 1;

if (data_format_ == FORMAT_NHWC) {
OP_REQUIRES_OK(
Expand Down
11 changes: 11 additions & 0 deletions test/ops/conv2d_op_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,17 @@ def testConv2DPointwise1x1NHWC(self):
padding="SAME",
data_format="NHWC")

def testConv2DResNet50Conv4ShapeNHWC(self):
"""ResNet50 conv4_block1_2 shape should not use an unstable algorithm."""
self._test_conv2d(
input_shape=[1, 14, 14, 256],
filter_shape=[3, 3, 256, 256],
dtype=tf.float32,
strides=[1, 1, 1, 1],
padding="SAME",
data_format="NHWC",
seed=2027)

def testConv2DValidNCHW(self):
"""NCHW + VALID + stride=1."""
for dtype in [tf.float32, tf.float16]:
Expand Down
Loading