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] Fix triton compiler error in multilayer any #109325
Conversation
Fixes #109196 When we have a split reduction and the tensor is not an even multiple of the split size, we use `ops.masked` to pad to an even multiple. In the case here we generated: ```python tmp5 = tl.where(mask, tmp4, 0) ``` which implicitly promotes our boolean value to `int32`. The fix is to give the default value the same dtype as `result`. [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/109325
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit 86f8837 with merge base 5f6216b ( FLAKY - The following job failed but was likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Fixes #109196 When we have a split reduction and the tensor is not an even multiple of the split size, we use `ops.masked` to pad to an even multiple. In the case here we generated: ```python tmp5 = tl.where(mask, tmp4, 0) ``` which implicitly promotes our boolean value to `int32`. The fix is to give the default value the same dtype as `result`. ghstack-source-id: d3294c05eb8f46e10eebbcec05299819b4c8dad1 Pull Request resolved: #109325
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nit, LGTM otherwise.
other = V.kernel.cse.generate( | ||
V.kernel.compute, | ||
f"tl.full({result}.shape, {triton_constant(other)}, {result}.dtype)", | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simply using triton_constant(other)
should work, as when both inputs are in the same category, no broadcasting happens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you mean? The previous code already used triton_constant
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, sorry, what I meant is that it would be enough to give it the right type. It could be simply by casting the 0
to int
, float
, bool
depending on the type of result
. But we don't have a way to know the dtype of result during compilation time so I guess this is alright.
We could also always use False
, but this would be really odd, so nvm.
@pytorchbot merge |
Merge failedReason: This PR needs a If not, please add the To add a label, you can comment to pytorchbot, for example For more information, see Details for Dev Infra teamRaised by workflow job |
@pytorchbot merge -r |
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
Fixes #109196 When we have a split reduction and the tensor is not an even multiple of the split size, we use `ops.masked` to pad to an even multiple. In the case here we generated: ```python tmp5 = tl.where(mask, tmp4, 0) ``` which implicitly promotes our boolean value to `int32`. The fix is to give the default value the same dtype as `result`. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx ipiszy ngimel yf225 chenyang78 kadeng muchulee8 aakhundov [ghstack-poisoned]
Successfully rebased |
Fixes #109196 When we have a split reduction and the tensor is not an even multiple of the split size, we use `ops.masked` to pad to an even multiple. In the case here we generated: ```python tmp5 = tl.where(mask, tmp4, 0) ``` which implicitly promotes our boolean value to `int32`. The fix is to give the default value the same dtype as `result`. ghstack-source-id: bfea77d766b16a4ddace24d366a501d56c8dc1a3 Pull Request resolved: #109325
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: 1 jobs have failed, first few of them are: inductor-periodic / cuda12.1-py3.10-gcc9-sm86-periodic-dynamo-benchmarks / test (aot_eager_torchbench, 1, 1, linux.g5.4xlarge.nvidia.gpu) Details for Dev Infra teamRaised by workflow job |
@pytorchbot rebase |
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
Fixes #109196 When we have a split reduction and the tensor is not an even multiple of the split size, we use `ops.masked` to pad to an even multiple. In the case here we generated: ```python tmp5 = tl.where(mask, tmp4, 0) ``` which implicitly promotes our boolean value to `int32`. The fix is to give the default value the same dtype as `result`. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx ipiszy ngimel yf225 chenyang78 kadeng muchulee8 aakhundov [ghstack-poisoned]
Successfully rebased |
Fixes #109196 When we have a split reduction and the tensor is not an even multiple of the split size, we use `ops.masked` to pad to an even multiple. In the case here we generated: ```python tmp5 = tl.where(mask, tmp4, 0) ``` which implicitly promotes our boolean value to `int32`. The fix is to give the default value the same dtype as `result`. ghstack-source-id: 59266820ba8a88b2a7538a489f2e3e242ed3f252 Pull Request resolved: #109325
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: 1 mandatory check(s) failed. The first few are: Dig deeper by viewing the failures on hud |
@pytorchbot merge -i |
Merge startedYour change will be merged while ignoring the following 1 checks: pull / linux-focal-py3.8-clang10 / test (dynamo, 1, 2, linux.2xlarge) Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
@pytorchbot drci (Please ignore this, I's testing Dr.CI) |
Fixes pytorch#109196 When we have a split reduction and the tensor is not an even multiple of the split size, we use `ops.masked` to pad to an even multiple. In the case here we generated: ```python tmp5 = tl.where(mask, tmp4, 0) ``` which implicitly promotes our boolean value to `int32`. The fix is to give the default value the same dtype as `result`. Pull Request resolved: pytorch#109325 Approved by: https://github.com/lezcano
Stack from ghstack (oldest at bottom):
Fixes #109196
When we have a split reduction and the tensor is not an even multiple of the split size,
we use
ops.masked
to pad to an even multiple. In the case here we generated:which implicitly promotes our boolean value to
int32
. The fix is to give the defaultvalue the same dtype as
result
.cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @ipiszy @ngimel @yf225 @chenyang78 @kadeng @muchulee8 @aakhundov