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

Fix restrictions for vecload condition (iGemm v4r1 Bwd, 1x1) #933

Merged
merged 3 commits into from
May 20, 2021
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
18 changes: 13 additions & 5 deletions src/solver/conv_hip_implicit_gemm_bwd_v4r1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,21 @@ PerformanceImplicitGemmBwdDataV4R1::CalculateGemmBBlockCopyPerformanceParameters
SrcDataPerRead_GemmN = gcd(SrcDataPerRead_GemmN, GemmNPerBlock);

// calculate vector length on gemmn dimension
const auto y = ConvolutionContextInterpreter::GetFilterHeightY(ctx);
const auto x = ConvolutionContextInterpreter::GetFilterWidthX(ctx);
const auto y = ConvolutionContextInterpreter::GetFilterHeightY(ctx);
const auto x = ConvolutionContextInterpreter::GetFilterWidthX(ctx);
const auto left_pad_h = ConvolutionContextInterpreter::GetInputLeftPadH(ctx);
const auto left_pad_w = ConvolutionContextInterpreter::GetInputLeftPadW(ctx);
const auto right_pad_h = ConvolutionContextInterpreter::GetAdjustedInputRightPadH(ctx);
const auto right_pad_w = ConvolutionContextInterpreter::GetAdjustedInputRightPadW(ctx);

// \todo too conversative
if(ctx.Is3d())
{
const auto z = ConvolutionContextInterpreter::GetFilterDepthZ(ctx);
if(z == 1 && y == 1 && x == 1)
const auto z = ConvolutionContextInterpreter::GetFilterDepthZ(ctx);
const auto left_pad_d = ConvolutionContextInterpreter::GetInputLeftPadD(ctx);
const auto right_pad_d = ConvolutionContextInterpreter::GetAdjustedInputRightPadD(ctx);
if(z == 1 && y == 1 && x == 1 && left_pad_h == 0 && left_pad_w == 0 &&
left_pad_d == 0 && right_pad_h == 0 && right_pad_w == 0 && right_pad_d == 0)
{
const auto dout = ConvolutionContextInterpreter::GetOutputDepthDo(ctx);
const auto ho = ConvolutionContextInterpreter::GetOutputHeightHo(ctx);
Expand All @@ -278,7 +285,8 @@ PerformanceImplicitGemmBwdDataV4R1::CalculateGemmBBlockCopyPerformanceParameters
}
else
{
if(y == 1 && x == 1)
if(y == 1 && x == 1 && left_pad_h == 0 && left_pad_w == 0 && right_pad_h == 0 &&
right_pad_w == 0)
{
const auto ho = ConvolutionContextInterpreter::GetOutputHeightHo(ctx);
const auto wo = ConvolutionContextInterpreter::GetOutputWidthWo(ctx);
Expand Down
11 changes: 8 additions & 3 deletions src/solver/conv_hip_implicit_gemm_bwd_v4r1_xdlops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,16 @@ PerformanceImplicitGemmBwdDataV4R1Xdlops::CalculateGemmBBlockCopyPerformancePara
SrcDataPerRead_GemmN = gcd(SrcDataPerRead_GemmN, GemmNPerBlock);

// calculate vector length on gemmn dimension
const auto y = ConvolutionContextInterpreter::GetFilterHeightY(ctx);
const auto x = ConvolutionContextInterpreter::GetFilterWidthX(ctx);
const auto y = ConvolutionContextInterpreter::GetFilterHeightY(ctx);
const auto x = ConvolutionContextInterpreter::GetFilterWidthX(ctx);
const auto left_pad_h = ConvolutionContextInterpreter::GetInputLeftPadH(ctx);
const auto left_pad_w = ConvolutionContextInterpreter::GetInputLeftPadW(ctx);
const auto right_pad_h = ConvolutionContextInterpreter::GetAdjustedInputRightPadH(ctx);
const auto right_pad_w = ConvolutionContextInterpreter::GetAdjustedInputRightPadW(ctx);

// \todo too conversative
if(y == 1 && x == 1)
if(y == 1 && x == 1 && left_pad_h == 0 && left_pad_w == 0 && right_pad_h == 0 &&
right_pad_w == 0)
{
const auto ho = ConvolutionContextInterpreter::GetOutputHeightHo(ctx);
const auto wo = ConvolutionContextInterpreter::GetOutputWidthWo(ctx);
Expand Down
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ COMMAND $<TARGET_FILE:test_conv2d> ${IMPLICITGEMM_ARGS} --verbose --input 128
COMMAND $<TARGET_FILE:test_conv2d> ${IMPLICITGEMM_ARGS} --verbose --input 128 832 7 7 --weights 128 832 1 1 --pads_strides_dilations 0 0 1 1 2 2
COMMAND $<TARGET_FILE:test_conv2d> ${IMPLICITGEMM_ARGS} --verbose --input 16 2048 7 7 --weights 192 2048 1 1 --pads_strides_dilations 0 0 1 1 2 2
COMMAND $<TARGET_FILE:test_conv2d> ${IMPLICITGEMM_ARGS} --verbose --input 64 32 28 28 --weights 192 32 3 3 --pads_strides_dilations 1 1 2 2 1 1
COMMAND $<TARGET_FILE:test_conv2d> ${IMPLICITGEMM_ARGS} --verbose --input 8 16 14 14 --weights 32 16 1 1 --pads_strides_dilations 1 1 1 1 1 1
COMMAND $<TARGET_FILE:test_conv2d> ${IMPLICITGEMM_ARGS} --verbose --input 64 32 14 14 --weights 192 32 3 3 --pads_strides_dilations 1 1 2 2 1 1
COMMAND $<TARGET_FILE:test_conv2d> ${IMPLICITGEMM_ARGS} --verbose --input 64 32 7 7 --weights 192 32 3 3 --pads_strides_dilations 1 1 2 2 1 1
COMMAND $<TARGET_FILE:test_conv2d> ${IMPLICITGEMM_ARGS} --verbose --input 64 32 28 28 --weights 192 32 3 3 --pads_strides_dilations 2 2 2 2 1 1
Expand Down