Skip to content

Add torch.aten.as_strided to tensor.extract_slice conversion #4268

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

Closed
wants to merge 2 commits into from

Conversation

michizhou
Copy link

Adds support for conversion of torch.aten.as_strided ops to tensor.extract_slice ops. Certain MoE models like DeepSeek V3 have multiple instances of the as_strided op included in their top-level IRs. As a result, this pattern is required to support the lowering of such models in pipelines like the Torch to Linalg IR backend conversion pipeline. Otherwise, leaving as_strided ops as-is causes some dependent torch.constant.int ops to be retained (for which legalization should not be supported).

@michizhou michizhou marked this pull request as ready for review July 10, 2025 22:36
@vivekkhandelwal1 vivekkhandelwal1 self-requested a review July 11, 2025 07:24
@vivekkhandelwal1
Copy link
Collaborator

@michizhou Did you check the test locally? Was it working?

I tested your patch and the lowering does not seem to work.

@vivekkhandelwal1
Copy link
Collaborator

Hi @michizhou, I have added the support for this op here: #4269 since it was blocking us. You can close this PR now. Sorry, it was a priority issue hence I go ahead and fixed it.

@michizhou
Copy link
Author

Hi @vivekkhandelwal1, no worries I completely understand. Thank you so much for taking up the work to add E2E support for this op in your PR. I will go ahead with closing this PR accordingly.

@michizhou michizhou closed this Jul 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants