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

2D and 3D NGCHW forward convolution solvers based on CK instances #3616

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from

Conversation

iq136boy
Copy link
Contributor

Implement 2d and 3d NGCHW forward convolution solvers base on CK NGCHW layout instances.
The solver utilize the fused CK convolution and layout transform kernels to avoid the tensor layout transform in MIOpen side.

@averinevg
Copy link
Contributor

@iq136boy Please add also unit_conv_solver_* tests for these solvers.

Copy link
Contributor

@averinevg averinevg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review comments on #3617 are also applicable to this PR.

#if MIOPEN_BACKEND_HIP && MIOPEN_USE_COMPOSABLEKERNEL

using InLayoutNCHW = ck::tensor_layout::convolution::NGCDHW;
using WeiLayout = ck::tensor_layout::convolution::GKZYXC;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout for the weights needs to be GKCZYX (same as WRW)

Comment on lines 145 to 149
wei_lengths = {G, K, C, Z, Y, X};

in_strides = {Di * Hi * Wi * C, Di * Hi * Wi * G * C, Di * Hi * Wi, Hi * Wi, Wi, 1};
out_strides = {Do * Ho * Wo * K, Do * Ho * Wo * G * K, Do * Ho * Wo, Ho * Wo, Wo, 1};
wei_strides = {K * Z * Y * X * C, Z * Y * X * C, 1, Y * X * C, X * C, C};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just reminder to flip lengths and strides once layout changes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, very surprised this isn't causing errors.
Looks like we are assuming the data is in NHWC layout, but it'll come in as NCHW layout from MIOpen side.

@BrianHarrisonAMD
Copy link
Contributor

I think we need to double check the verification is working properly for these tests.
It looks like the CK args would treat the MIOpen weights as a different layout than they are, and I am surprised that doesn't cause issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants