-
Notifications
You must be signed in to change notification settings - Fork 24.2k
[inductor] dtype promotion error in cat decomp #152995
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/152995
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 10302c4 with merge base cbcb57d ( UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
…k/inductor_cat_dtype_promote
torch/_inductor/decomposition.py
Outdated
@@ -389,7 +393,7 @@ def non_empty_tensor(x: torch.Tensor) -> bool: | |||
|
|||
filtered_tensors = list(filter(non_empty_tensor, tensors)) | |||
|
|||
if len(filtered_tensors) == 1: | |||
if len(filtered_tensors) == 1 and all_tensors_same_dtype(tensors): | |||
return filtered_tensors[0].clone() |
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.
Is it possible to use elementwise_dtypes()
to figure out the output dtype and do type conversion here?
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 thanks, didn't know about this. just updated.
torch/_inductor/decomposition.py
Outdated
*tensors, | ||
type_promotion_kind=ELEMENTWISE_TYPE_PROMOTION_KIND.DEFAULT, | ||
)[1] | ||
) != filtered_tensors[0].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.
With this, I don't think you need to check all_tensors_same_dtype
anymore?
return z * 2 | ||
|
||
model = Foo() | ||
inps = (torch.randn(4, 10, dtype=torch.bfloat16), torch.randn(4, 0)) |
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.
self.check_model
is the common utility for AOTI compile and check.
torch/_inductor/decomposition.py
Outdated
not all_tensors_same_dtype(tensors) | ||
and ( | ||
promoted_dtype := elementwise_dtypes( |
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.
+1 dont need both all_tensors_same_dtype
and elementwise_dtypes
.
promoted_dtype = elementwise_dtypes(...)[0]
filter_t = filter_t[0]
return filter_t if promoted_dtype != filter_t.dtype else filter_t.to(promoted_dtype)
@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 |
The merge job was canceled or timed out. This most often happen if two merge requests were issued for the same PR, or if merge job was waiting for more than 6 hours for tests to finish. In later case, please do not hesitate to reissue the merge command |
@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 |
The merge job was canceled or timed out. This most often happen if two merge requests were issued for the same PR, or if merge job was waiting for more than 6 hours for tests to finish. In later case, please do not hesitate to reissue the merge command |
…k/inductor_cat_dtype_promote
@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 |
cloning single tensor wasn't following dtype promotion rules
for SAM model: #152606
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @chenyang78 @kadeng @muchulee8 @amjames @chauhang @aakhundov