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
[AOTI] Support ReinterpretView in abi mode #114169
Conversation
#113967 added support for ReinterpretView but it turnes out we codegen it differently in abi compat mode. This PR adds support for abi compat mode as well. [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/114169
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 9bf3290 with merge base 8f8722e (): 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. |
@@ -60,7 +60,9 @@ def is_aligned( | |||
https://github.com/openai/triton/blob/5282ed890d453e10b9ee30076ef89115dd197761/python/triton/runtime/jit.py#L208-L222 | |||
""" | |||
if isinstance(x, TensorArg): | |||
if x.buffer.startswith("reinterpret_tensor"): | |||
if x.buffer.startswith("reinterpret_tensor") or x.buffer.startswith( | |||
"RAIIAtenTensorHandle" |
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.
This looks like too general? Many things can start with RAIIAtenTensorHandle
: do we want to return False
on all of them?
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.
Well all we know at this point is that the name is RAIIAtenTensorHandle(tmp_tensor_handle_0)
. Previously other RAIIAtenTensorHandle would have failed because there would be no matching tensor in self.name_to_node
, so returning False on all of them is the right direction.
The longer term fix would be to remove these prefixes from tensor names, even better not use tensor names to do these comparisons.
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 share a similar concern that checking RAIIAtenTensorHandle
in a general purpose utility function config_of
seems to be too aggressive. I am wondering if we could lift the check to its caller in this particular case, i.e.:
pytorch/torch/_inductor/codegen/wrapper.py
Lines 893 to 899 in 3686946
triton_meta = { | |
"signature": signature_to_meta(signature, size_dtype=index_dtype), | |
"device": V.graph.scheduler.current_device.index, | |
"device_type": V.graph.scheduler.current_device.type, | |
"constants": constants, | |
"configs": [config_of(signature)], | |
} |
where we could check if the kernel is of ReinterpretView, then we just set False to the "configs" field of triton_meta
. Otherwise, we call the general config_of
function. In this way, we would not pollute the general utility function.
Is |
pytorch/torch/_inductor/codegen/wrapper.py Lines 2004 to 2090 in 77f16eb
in this code for On my test case, the emitted code is P887066630 |
#113967 added support for ReinterpretView but it turnes out we codegen it differently in abi compat mode. This PR adds support for abi compat mode as well. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 kadeng muchulee8 aakhundov ColinPeppler [ghstack-poisoned]
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.
Looks more clean and specific now. Thanks!
@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 |
This IR node mutates in place, it needs to use the argument not the target. Fixes #113440 Pull Request resolved: #114436 Approved by: https://github.com/jansel ghstack dependencies: #114169
This IR node mutates in place, it needs to use the argument not the target. Fixes pytorch#113440 Pull Request resolved: pytorch#114436 Approved by: https://github.com/jansel ghstack dependencies: pytorch#114169
Stack from ghstack (oldest at bottom):
#113967 added support for
ReinterpretView but it turnes out we codegen it differently in abi
compat mode. This PR adds support for abi compat mode as well.
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @peterbell10 @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @aakhundov @ColinPeppler