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

[Inductor cutlass GEMM backend] Fix for operand memory layout change between autotuning and CUTLASSGEMMTemplate.render #113366

Closed
wants to merge 23 commits into from

Conversation

kadeng
Copy link
Contributor

@kadeng kadeng commented Nov 9, 2023

Stack from ghstack (oldest at bottom):

When compiling a Meta-internal model using torch.compile with Cutlass GEMM backend enabled, compilation errors were produced since the input memory layouts changed between autotuning and call to CutlassGEMMTemplate.render.

Note:

Neither fixing the layout directly after autotuning nor this fix would lead to optimal results in every case. Open to suggestions what the best fix would be ( freezing the layout?)

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @peterbell10 @ipiszy @yf225 @chenyang78 @muchulee8 @aakhundov @ColinPeppler

…between autotuning and CUTLASSGEMMTemplate.render

[ghstack-poisoned]
Copy link

pytorch-bot bot commented Nov 9, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/113366

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure

As of commit bea32f3 with merge base afe6d27 (image):

NEW FAILURE - The following job has failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

…out change between autotuning and CUTLASSGEMMTemplate.render"


When compiling a Meta-internal model using torch.compile with Cutlass GEMM backend enabled, compilation errors were produced since the input memory layouts changed between autotuning and call to CutlassGEMMTemplate.render.

Note:

Neither fixing the layout directly after autotuning nor this fix would lead to optimal results in every case. Open to suggestions what the best fix would be ( freezing the layout?)


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler

[ghstack-poisoned]

# The layouts might have changed between autotuning and this call if they were FlexibleLayout
# we need to adapt, which might lead to suboptimal performance.
# @TODO kadeng: Find a way to solve this better
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe, this TODO is sufficient :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just FYI: This is addressed later in the diff stack..

…out change between autotuning and CUTLASSGEMMTemplate.render"


When compiling a Meta-internal model using torch.compile with Cutlass GEMM backend enabled, compilation errors were produced since the input memory layouts changed between autotuning and call to CutlassGEMMTemplate.render.

Note:

Neither fixing the layout directly after autotuning nor this fix would lead to optimal results in every case. Open to suggestions what the best fix would be ( freezing the layout?)


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler

[ghstack-poisoned]
…out change between autotuning and CUTLASSGEMMTemplate.render"


When compiling a Meta-internal model using torch.compile with Cutlass GEMM backend enabled, compilation errors were produced since the input memory layouts changed between autotuning and call to CutlassGEMMTemplate.render.

Note:

Neither fixing the layout directly after autotuning nor this fix would lead to optimal results in every case. Open to suggestions what the best fix would be ( freezing the layout?)


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler

[ghstack-poisoned]
…out change between autotuning and CUTLASSGEMMTemplate.render"


When compiling a Meta-internal model using torch.compile with Cutlass GEMM backend enabled, compilation errors were produced since the input memory layouts changed between autotuning and call to CutlassGEMMTemplate.render.

Note:

Neither fixing the layout directly after autotuning nor this fix would lead to optimal results in every case. Open to suggestions what the best fix would be ( freezing the layout?)


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler

[ghstack-poisoned]
…out change between autotuning and CUTLASSGEMMTemplate.render"


When compiling a Meta-internal model using torch.compile with Cutlass GEMM backend enabled, compilation errors were produced since the input memory layouts changed between autotuning and call to CutlassGEMMTemplate.render.

Note:

Neither fixing the layout directly after autotuning nor this fix would lead to optimal results in every case. Open to suggestions what the best fix would be ( freezing the layout?)


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler

[ghstack-poisoned]
…out change between autotuning and CUTLASSGEMMTemplate.render"


When compiling a Meta-internal model using torch.compile with Cutlass GEMM backend enabled, compilation errors were produced since the input memory layouts changed between autotuning and call to CutlassGEMMTemplate.render.

Note:

Neither fixing the layout directly after autotuning nor this fix would lead to optimal results in every case. Open to suggestions what the best fix would be ( freezing the layout?)


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler

[ghstack-poisoned]
…out change between autotuning and CUTLASSGEMMTemplate.render"


When compiling a Meta-internal model using torch.compile with Cutlass GEMM backend enabled, compilation errors were produced since the input memory layouts changed between autotuning and call to CutlassGEMMTemplate.render.

Note:

Neither fixing the layout directly after autotuning nor this fix would lead to optimal results in every case. Open to suggestions what the best fix would be ( freezing the layout?)


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler

[ghstack-poisoned]
…out change between autotuning and CUTLASSGEMMTemplate.render"


When compiling a Meta-internal model using torch.compile with Cutlass GEMM backend enabled, compilation errors were produced since the input memory layouts changed between autotuning and call to CutlassGEMMTemplate.render.

Note:

Neither fixing the layout directly after autotuning nor this fix would lead to optimal results in every case. Open to suggestions what the best fix would be ( freezing the layout?)


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler

[ghstack-poisoned]
…out change between autotuning and CUTLASSGEMMTemplate.render"


When compiling a Meta-internal model using torch.compile with Cutlass GEMM backend enabled, compilation errors were produced since the input memory layouts changed between autotuning and call to CutlassGEMMTemplate.render.

Note:

Neither fixing the layout directly after autotuning nor this fix would lead to optimal results in every case. Open to suggestions what the best fix would be ( freezing the layout?)


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler

[ghstack-poisoned]
…out change between autotuning and CUTLASSGEMMTemplate.render"


When compiling a Meta-internal model using torch.compile with Cutlass GEMM backend enabled, compilation errors were produced since the input memory layouts changed between autotuning and call to CutlassGEMMTemplate.render.

Note:

Neither fixing the layout directly after autotuning nor this fix would lead to optimal results in every case. Open to suggestions what the best fix would be ( freezing the layout?)


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler

[ghstack-poisoned]
…out change between autotuning and CUTLASSGEMMTemplate.render"


When compiling a Meta-internal model using torch.compile with Cutlass GEMM backend enabled, compilation errors were produced since the input memory layouts changed between autotuning and call to CutlassGEMMTemplate.render.

Note:

Neither fixing the layout directly after autotuning nor this fix would lead to optimal results in every case. Open to suggestions what the best fix would be ( freezing the layout?)


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler

[ghstack-poisoned]
…out change between autotuning and CUTLASSGEMMTemplate.render"


When compiling a Meta-internal model using torch.compile with Cutlass GEMM backend enabled, compilation errors were produced since the input memory layouts changed between autotuning and call to CutlassGEMMTemplate.render.

Note:

Neither fixing the layout directly after autotuning nor this fix would lead to optimal results in every case. Open to suggestions what the best fix would be ( freezing the layout?)


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler

[ghstack-poisoned]
…out change between autotuning and CUTLASSGEMMTemplate.render"


When compiling a Meta-internal model using torch.compile with Cutlass GEMM backend enabled, compilation errors were produced since the input memory layouts changed between autotuning and call to CutlassGEMMTemplate.render.

Note:

Neither fixing the layout directly after autotuning nor this fix would lead to optimal results in every case. Open to suggestions what the best fix would be ( freezing the layout?)


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler

[ghstack-poisoned]
…out change between autotuning and CUTLASSGEMMTemplate.render"


When compiling a Meta-internal model using torch.compile with Cutlass GEMM backend enabled, compilation errors were produced since the input memory layouts changed between autotuning and call to CutlassGEMMTemplate.render.

Note:

Neither fixing the layout directly after autotuning nor this fix would lead to optimal results in every case. Open to suggestions what the best fix would be ( freezing the layout?)


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler

[ghstack-poisoned]
…out change between autotuning and CUTLASSGEMMTemplate.render"


When compiling a Meta-internal model using torch.compile with Cutlass GEMM backend enabled, compilation errors were produced since the input memory layouts changed between autotuning and call to CutlassGEMMTemplate.render.

Note:

Neither fixing the layout directly after autotuning nor this fix would lead to optimal results in every case. Open to suggestions what the best fix would be ( freezing the layout?)


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler

[ghstack-poisoned]
…out change between autotuning and CUTLASSGEMMTemplate.render"


When compiling a Meta-internal model using torch.compile with Cutlass GEMM backend enabled, compilation errors were produced since the input memory layouts changed between autotuning and call to CutlassGEMMTemplate.render.

Note:

Neither fixing the layout directly after autotuning nor this fix would lead to optimal results in every case. Open to suggestions what the best fix would be ( freezing the layout?)


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler

[ghstack-poisoned]
@kadeng kadeng marked this pull request as ready for review December 9, 2023 17:45
Comment on lines 463 to 464
[X, W, Bias, Y],
[op.A.layout, op.B.layout, op.C.layout, op.D.layout],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
[X, W, Bias, Y],
[op.A.layout, op.B.layout, op.C.layout, op.D.layout],
(X, W, Bias, Y),
(op.A.layout, op.B.layout, op.C.layout, op.D.layout),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

…out change between autotuning and CUTLASSGEMMTemplate.render"


When compiling a Meta-internal model using torch.compile with Cutlass GEMM backend enabled, compilation errors were produced since the input memory layouts changed between autotuning and call to CutlassGEMMTemplate.render.

Note:

Neither fixing the layout directly after autotuning nor this fix would lead to optimal results in every case. Open to suggestions what the best fix would be ( freezing the layout?)


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler

[ghstack-poisoned]
…out change between autotuning and CUTLASSGEMMTemplate.render"


When compiling a Meta-internal model using torch.compile with Cutlass GEMM backend enabled, compilation errors were produced since the input memory layouts changed between autotuning and call to CutlassGEMMTemplate.render.

Note:

Neither fixing the layout directly after autotuning nor this fix would lead to optimal results in every case. Open to suggestions what the best fix would be ( freezing the layout?)


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler

[ghstack-poisoned]
…out change between autotuning and CUTLASSGEMMTemplate.render"


When compiling a Meta-internal model using torch.compile with Cutlass GEMM backend enabled, compilation errors were produced since the input memory layouts changed between autotuning and call to CutlassGEMMTemplate.render.

Note:

Neither fixing the layout directly after autotuning nor this fix would lead to optimal results in every case. Open to suggestions what the best fix would be ( freezing the layout?)


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler

[ghstack-poisoned]
@kadeng
Copy link
Contributor Author

kadeng commented Dec 15, 2023

Moved to a (draft) feature branch, see #115919

@kadeng kadeng closed this Dec 15, 2023
@facebook-github-bot facebook-github-bot deleted the gh/kadeng/18/head branch January 14, 2024 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants