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

[Fori_loop|While_loop] Placeholder lower torch.while_loop with python dispatch for simple addition test case #6532

Merged

Conversation

ManfeiBai
Copy link
Collaborator

@ManfeiBai ManfeiBai commented Feb 14, 2024

This is the step one PR:

Due to torch.while_loop is defined in torch/_higher_order_ops/while_loop.py, not described in native_functions.yaml, lower torch.while_loop via python dispatch like PR#5763

TODO: current status need to patch the python dispatch in PyTorch code, we need modify this PR to enable the python dispatch from PyTorch/XLA code

child PR: #6529

PR resource: #6527

@ManfeiBai ManfeiBai force-pushed the while_loop-lowering-with-simplecalculation-dispatch-in-torch branch from f35899a to 122d6e5 Compare February 20, 2024 05:49
@ManfeiBai ManfeiBai marked this pull request as ready for review February 20, 2024 21:57
@ManfeiBai
Copy link
Collaborator Author

CI failed due to ERROR: Failed to query remote execution capabilities: Unexpected error refreshing access token, local test passed

Copy link
Collaborator

@mbzomowski mbzomowski left a comment

Choose a reason for hiding this comment

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

LGTM for the TPU CI portion: https://github.com/pytorch/xla/actions/runs/7980785965/job/21791172250

But I'll leave it to pt/xla folks to approve.

from torch._higher_order_ops.while_loop import while_loop_op


@while_loop_op.py_impl(DispatchKey.XLA)
Copy link
Contributor

Choose a reason for hiding this comment

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

Great to see that this is working!

Copy link
Contributor

@yeounoh yeounoh left a comment

Choose a reason for hiding this comment

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

LGTM, left some minor comments.

@ManfeiBai ManfeiBai changed the title [Fori_loop|While_loop] Lower torch.while_loop with python dispatch for simple addition test case [Fori_loop|While_loop] Placeholder lower torch.while_loop with python dispatch for simple addition test case Feb 22, 2024
@ManfeiBai ManfeiBai merged commit 5405c4d into master Feb 22, 2024
19 checks passed
amithrm pushed a commit to amithrm/xla that referenced this pull request Mar 1, 2024
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.

4 participants