Repository navigation
Conversation
Previously, when the Cutlass backend was enabled, using dynamic shapes could lead to exceptions during JIT. With this change, there are guards in place to just disable the Cutlass backend if dynamic dimensions are involved. In addition, if no choices for a GEMM are available using the selected backends, then an ATen Kernel is used as fallback, even if the ATen backend is not enabled. Test: CI Additional unit test in test_cutlass_backend.py [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/121497
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New FailuresAs of commit 7a78dc8 with merge base 365e89a ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Previously, when the Cutlass backend was enabled, using dynamic shapes could lead to exceptions during JIT. With this change, there are guards in place to just disable the Cutlass backend if dynamic dimensions are involved. In addition, if no choices for a GEMM are available using the selected backends, then an ATen Kernel is used as fallback, even if the ATen backend is not enabled. Test: CI Additional unit test in test_cutlass_backend.py cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler amjames desertfire chauhang [ghstack-poisoned]
Previously, when the Cutlass backend was enabled, using dynamic shapes could lead to exceptions during JIT. With this change, there are guards in place to just disable the Cutlass backend if dynamic dimensions are involved. In addition, if no choices for a GEMM are available using the selected backends, then an ATen Kernel is used as fallback, even if the ATen backend is not enabled. Test: CI Additional unit test in test_cutlass_backend.py cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler amjames desertfire chauhang [ghstack-poisoned]
Previously, when the Cutlass backend was enabled, using dynamic shapes could lead to exceptions during JIT. With this change, there are guards in place to just disable the Cutlass backend if dynamic dimensions are involved. In addition, if no choices for a GEMM are available using the selected backends, then an ATen Kernel is used as fallback, even if the ATen backend is not enabled. Test: CI Additional unit test in test_cutlass_backend.py cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler amjames desertfire chauhang [ghstack-poisoned]
| # checks whether all input tensors and the output layout | ||
| # have a static shape by attempting to convert the dimensions | ||
| # to int |
There was a problem hiding this comment.
You probably want to use something like the is_statically_known_list_of_ints implemented in the wrapper.py, which uses the guards information that we already have to simplify the expression.
There was a problem hiding this comment.
Thanks for the code pointer. I looked it up, and now I'm not sure if that's what I want to use here. I see that the implementation underlying is_statically_known_list_of_ints is this function:
pytorch/torch/_inductor/codegen/wrapper.py
Lines 1527 to 1532 in a157a0d
There was a problem hiding this comment.
It doesn't have any side-effect. What it tries to do is use the knowledge from the guards / asserts that the user may have set, etc to evaluate the expression. Sometimes things that look dynamic, may be possibly static after some asserts in the code, some constant propagation, value range analysis, etc.
There was a problem hiding this comment.
Yes, that's also how I understood it. But it's return value is not used, see the code section I quoted ( val is assigned to but discarded). Maybe this is not intentional?
There was a problem hiding this comment.
Ah, yes, you found a bug there lol
There was a problem hiding this comment.
I started doubting I understood how this is working ;) I'll prepapre a small fix then...
Previously, when the Cutlass backend was enabled, using dynamic shapes could lead to exceptions during JIT. With this change, there are guards in place to just disable the Cutlass backend if dynamic dimensions are involved. In addition, if no choices for a GEMM are available using the selected backends, then an ATen Kernel is used as fallback, even if the ATen backend is not enabled. Test: CI Additional unit test in test_cutlass_backend.py cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler amjames desertfire chauhang [ghstack-poisoned]
Previously, when the Cutlass backend was enabled, using dynamic shapes could lead to exceptions during JIT. With this change, there are guards in place to just disable the Cutlass backend if dynamic dimensions are involved. In addition, if no choices for a GEMM are available using the selected backends, then an ATen Kernel is used as fallback, even if the ATen backend is not enabled. Test: CI Additional unit test in test_cutlass_backend.py cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler amjames desertfire chauhang [ghstack-poisoned]
Previously, when the Cutlass backend was enabled, using dynamic shapes could lead to exceptions during JIT. With this change, there are guards in place to just disable the Cutlass backend if dynamic dimensions are involved. In addition, if no choices for a GEMM are available using the selected backends, then an ATen Kernel is used as fallback, even if the ATen backend is not enabled. Test: CI Additional unit test in test_cutlass_backend.py cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler amjames desertfire chauhang [ghstack-poisoned]
Previously, when the Cutlass backend was enabled, using dynamic shapes could lead to exceptions during JIT. With this change, there are guards in place to just disable the Cutlass backend if dynamic dimensions are involved. In addition, if no choices for a GEMM are available using the selected backends, then an ATen Kernel is used as fallback, even if the ATen backend is not enabled. Test: CI Additional unit test in test_cutlass_backend.py cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler amjames desertfire chauhang [ghstack-poisoned]
Previously, when the Cutlass backend was enabled, using dynamic shapes could lead to exceptions during JIT. With this change, there are guards in place to just disable the Cutlass backend if dynamic dimensions are involved. In addition, if no choices for a GEMM are available using the selected backends, then an ATen Kernel is used as fallback, even if the ATen backend is not enabled. Test: CI Additional unit test in test_cutlass_backend.py cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler amjames desertfire chauhang [ghstack-poisoned]
Previously, when the Cutlass backend was enabled, using dynamic shapes could lead to exceptions during JIT. With this change, there are guards in place to just disable the Cutlass backend if dynamic dimensions are involved. In addition, if no choices for a GEMM are available using the selected backends, then an ATen Kernel is used as fallback, even if the ATen backend is not enabled. Test: CI Additional unit test in test_cutlass_backend.py cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler amjames desertfire chauhang [ghstack-poisoned]
…ckend] Tolerate dynamic shapes" Previously, when the Cutlass backend was enabled, using dynamic shapes could lead to exceptions during JIT. With this change, there are guards in place to just disable the Cutlass backend if dynamic dimensions are involved. In addition, if no choices for a GEMM are available using the selected backends, then an ATen Kernel is used as fallback, even if the ATen backend is not enabled. Test: CI Additional unit test in test_cutlass_backend.py cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 muchulee8 aakhundov ColinPeppler amjames desertfire chauhang [ghstack-poisoned]
|
Just FYI: I will be on PTO soon ( back after easter Monday ), I won't necessarily be able to react to comments until I return. |
…ing as class annotation (#123930) I previously added @skipIfRocm as a class annotation within test/inductor/test_cutlass_backend.py - turns out this annotation always skips if applied at class level, so I need to skip Cutlass tests on ROCm differently.. Pull Request resolved: #123930 Approved by: https://github.com/jansel ghstack dependencies: #121497
…els (#123932) If a Kernel does not return in a reasonable amount of time during autotuning, it can delay inductor compilation a lot. This change introduces soft / hard kill timeouts and a mechanism to kill Kernels being profiled in subprocesses if they take too long. Correspondingly, a few new config options are introduced within _inductor/config.py - all of them with inline docs. Test Plan: Existing tests within test_max_autotune.py and test_cutlass_backend.py ) cover the new codepaths. Pull Request resolved: #123932 Approved by: https://github.com/jansel ghstack dependencies: #121497, #123930
Add support for bmm ( batch matrix multiply ) op through the Cutlass backend. Test Plan: * CI * Added test in test_cutlass_backend.py Pull Request resolved: #121734 Approved by: https://github.com/eellison ghstack dependencies: #121497, #123930, #123932
This diff disables Cutlass backend EVT epilogue fusions. It does not yet contain the removal of most of the underlying implementation. Pull Request resolved: #124107 Approved by: https://github.com/jansel ghstack dependencies: #121497, #123930, #123932, #121734
…est setup (#124574) The diff #122661 introduces a new automatic cache refresh mechanism during all inductor-derived test cases. But this refresh mechanism seems not to work properly across process boundaries, specifically when using autotune_in_subproc, which many tests in test_cutlass_backend.py rely on. Solution: Set the env var INDUCTOR_TEST_DISABLE_FRESH_CACHE=1 early during test setup within test_cutlass_backend.py Test Plan: This is a change to unit tests only. Pull Request resolved: #124574 Approved by: https://github.com/aakhundov ghstack dependencies: #121497, #123930, #123932, #121734, #124107
…emm_choices (#124575) Clean up CUTLASSGemmTemplate.add_cutlass_gemm_choices, removing code that became unneccessary by removing EVT-based epilogue fusion. Test Plan: Already covered by test_cutlass_backend.py Pull Request resolved: #124575 Approved by: https://github.com/jansel ghstack dependencies: #121497, #123930, #123932, #121734, #124107, #124574
Previously, when the Cutlass backend was enabled, using dynamic shapes could lead to exceptions during JIT. With this change, there are guards in place to just disable the Cutlass backend if dynamic dimensions are involved. In addition, if no choices for a GEMM are available using the selected backends, then an ATen Kernel is used as fallback, even if the ATen backend is not enabled. Test: CI Additional unit test in test_cutlass_backend.py Pull Request resolved: #121497 Approved by: https://github.com/jansel
…ing as class annotation (#123930) I previously added @skipIfRocm as a class annotation within test/inductor/test_cutlass_backend.py - turns out this annotation always skips if applied at class level, so I need to skip Cutlass tests on ROCm differently.. Pull Request resolved: #123930 Approved by: https://github.com/jansel ghstack dependencies: #121497
…els (#123932) If a Kernel does not return in a reasonable amount of time during autotuning, it can delay inductor compilation a lot. This change introduces soft / hard kill timeouts and a mechanism to kill Kernels being profiled in subprocesses if they take too long. Correspondingly, a few new config options are introduced within _inductor/config.py - all of them with inline docs. Test Plan: Existing tests within test_max_autotune.py and test_cutlass_backend.py ) cover the new codepaths. Pull Request resolved: #123932 Approved by: https://github.com/jansel ghstack dependencies: #121497, #123930
Add support for bmm ( batch matrix multiply ) op through the Cutlass backend. Test Plan: * CI * Added test in test_cutlass_backend.py Pull Request resolved: pytorch#121734 Approved by: https://github.com/eellison ghstack dependencies: pytorch#121497, pytorch#123930, pytorch#123932
This diff disables Cutlass backend EVT epilogue fusions. It does not yet contain the removal of most of the underlying implementation. Pull Request resolved: #124107 Approved by: https://github.com/jansel ghstack dependencies: #121497, #123930, #123932, #121734
…est setup (#124574) The diff #122661 introduces a new automatic cache refresh mechanism during all inductor-derived test cases. But this refresh mechanism seems not to work properly across process boundaries, specifically when using autotune_in_subproc, which many tests in test_cutlass_backend.py rely on. Solution: Set the env var INDUCTOR_TEST_DISABLE_FRESH_CACHE=1 early during test setup within test_cutlass_backend.py Test Plan: This is a change to unit tests only. Pull Request resolved: #124574 Approved by: https://github.com/aakhundov ghstack dependencies: #121497, #123930, #123932, #121734, #124107
…emm_choices (#124575) Clean up CUTLASSGemmTemplate.add_cutlass_gemm_choices, removing code that became unneccessary by removing EVT-based epilogue fusion. Test Plan: Already covered by test_cutlass_backend.py Pull Request resolved: #124575 Approved by: https://github.com/jansel ghstack dependencies: #121497, #123930, #123932, #121734, #124107, #124574
) Summary: pytorch#121497 made "no choices found" into a soft error, falling back to the ATen kernel in those cases. However, when running benchmarks, we want to be certain that we are actually invoking a particular backend; if we can't, we should hard error. As such, I have added an `autotune_fallback_to_aten` flag to control this behavior. That PR also introduces a `NoValidChoicesError` type, and has catch blocks for it, but it seems that the code doesn't actually throw this exception. I have added the appropriate throws, as well as tests. Test Plan: python test/inductor/test_max_autotune.py Differential Revision: D56764094
Summary: #121497 made "no choices found" into a soft error, falling back to the ATen kernel in those cases. However, when running benchmarks, we want to be certain that we are actually invoking a particular backend; if we can't, we should hard error. As such, I have added an `autotune_fallback_to_aten` flag to control this behavior. That PR also introduces a `NoValidChoicesError` type, and has catch blocks for it, but it seems that the code doesn't actually throw this exception. I have added the appropriate throws, as well as tests. Test Plan: python test/inductor/test_max_autotune.py Differential Revision: D56764094
|
Just fyi @kadeng this broke some CUTLASS extensions for quantization, but somehow was still able to land. So we were either missing tests or this stack deleted the tests. This might already be resolved, I'm only adding this comment for reference. cc @HDCharles @alexsamardzic |
|
Just posted a fix for CUTLASS-based mixed dtypes GEMM auto-tuning for Ampere: PR 129058 - let's continue the discussion on the comments section of this PR. |
Stack from ghstack (oldest at bottom):
Previously, when the Cutlass backend was enabled, using dynamic shapes could lead to exceptions during JIT.
With this change, there are guards in place to just disable the Cutlass backend if dynamic dimensions are involved.
In addition, if no choices for a GEMM are available using the selected backends, then an ATen Kernel is used as fallback, even if the ATen backend is not enabled.
Test:
CI
Additional unit test in test_cutlass_backend.py
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @peterbell10 @ipiszy @yf225 @chenyang78 @muchulee8 @aakhundov @ColinPeppler @amjames @desertfire @chauhang