Skip to content

Conversation

@yifuwang
Copy link
Collaborator

@yifuwang yifuwang commented Oct 25, 2024

Stack from ghstack (oldest at bottom):

Currently, there's two cases where we are not allowed to change the strides (e.g. padding, honor channels-last preference) of a node during GraphLowering.run_node():

  • If a node is a user-visible output, the result's strides must match the original output's strides.
  • If a node is an input to as_strided, the result's strides must match node.meta["val"].stride().

Currently, we use is_input_for_as_strided and is_user_visible to keep track of these cases. The code is rather confusing and would likely get worse if we introduce new sources of stride requirements.

This PR refactors the above logic into get_stride_requirement. If it returns a stride, GraphLowering.run_node() will honor it.

Maybe relevant to #137979

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @ColinPeppler @amjames @desertfire @chauhang @aakhundov

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Oct 25, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/138946

Note: Links to docs will display an error until the docs builds have been completed.

❌ 67 New Failures

As of commit 861f3d9 with merge base 5ea6777 (image):

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

yifuwang pushed a commit that referenced this pull request Oct 25, 2024
ghstack-source-id: c9e7cc7
Pull Request resolved: #138946
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy yf225 chenyang78 kadeng muchulee8 ColinPeppler amjames desertfire chauhang aakhundov

[ghstack-poisoned]
yifuwang pushed a commit that referenced this pull request Oct 25, 2024
ghstack-source-id: 1f760e6
Pull Request resolved: #138946
@yifuwang yifuwang changed the title refactor [Inductor] refactor the require_stride_order logic in GraphLowering Oct 25, 2024
@yifuwang yifuwang added the topic: not user facing topic category label Oct 25, 2024
@yifuwang yifuwang closed this Nov 1, 2024
@github-actions github-actions bot deleted the gh/yifuwang/159/head branch December 2, 2024 02:12
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.

2 participants