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

[inductor] Slightly faster memory allocation on CPU #118171

Closed
wants to merge 4 commits into from

Conversation

jansel
Copy link
Contributor

@jansel jansel commented Jan 24, 2024

Copy link

pytorch-bot bot commented Jan 24, 2024

🔗 Helpful Links

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

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

✅ No Failures

As of commit 8f31079 with merge base d59c2d6 (image):
💚 Looks good so far! There are no failures yet. 💚

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

jansel added a commit that referenced this pull request Jan 24, 2024
ghstack-source-id: 22c9c87d75ed07ed3288ffa9d908d281afb7e10c
Pull Request resolved: #118171
Copy link
Collaborator

@jgong5 jgong5 left a comment

Choose a reason for hiding this comment

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

Do we have test to cover the allocation of >8D tensors?


static PyObject* _empty_strided_cpu(PyObject* dummy, PyObject* args) {
// at::empty_strided is surprising slow. This is a lower-overhead
// version that saves ~2us on every allocation. Though it is
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess the extra overhead comes from the ATen dispatching which should apply to GPU too but GPU can overlap the device and host compute.

torch/csrc/dynamo/guards.cpp Outdated Show resolved Hide resolved
torch/_inductor/codegen/wrapper.py Outdated Show resolved Hide resolved
torch/csrc/dynamo/guards.cpp Outdated Show resolved Hide resolved
Based on `python benchmarks/dynamo/microbenchmarks/overheads.py`:
- Before `12.2us`
- After `10.7us`

This is inspired by a2c17a2 -- but in Python rather than C++


[ghstack-poisoned]
jansel added a commit that referenced this pull request Jan 25, 2024
ghstack-source-id: 6b6f39e6a4d82437dce4d04b7a22e4ac6395fbeb
Pull Request resolved: #118171
torch/csrc/dynamo/guards.cpp Outdated Show resolved Hide resolved
Based on `python benchmarks/dynamo/microbenchmarks/overheads.py`:
- Before `12.2us`
- After `10.5us`

This is inspired by a2c17a2 -- but in Python rather than C++


[ghstack-poisoned]
@jansel
Copy link
Contributor Author

jansel commented Jan 25, 2024

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Jan 25, 2024
@jansel jansel added the topic: not user facing topic category label Jan 25, 2024
@pytorchmergebot
Copy link
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: 1 jobs have failed, first few of them are: trunk / macos-12-py3-arm64 / build

Details for Dev Infra team Raised by workflow job

Based on `python benchmarks/dynamo/microbenchmarks/overheads.py`:
- Before `12.2us`
- After `10.5us`

This is inspired by a2c17a2 -- but in Python rather than C++


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

[ghstack-poisoned]
@jansel
Copy link
Contributor Author

jansel commented Jan 25, 2024

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

pytorchmergebot pushed a commit that referenced this pull request Jan 25, 2024
@facebook-github-bot facebook-github-bot deleted the gh/jansel/224/head branch January 29, 2024 15:23
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.

None yet

4 participants