[PyTorch] avoid unnecessary call to empty_tensor_restride in empty()#48211
Closed
swolchok wants to merge 8 commits intogh/swolchok/18/basefrom
Closed
[PyTorch] avoid unnecessary call to empty_tensor_restride in empty()#48211swolchok wants to merge 8 commits intogh/swolchok/18/basefrom
swolchok wants to merge 8 commits intogh/swolchok/18/basefrom
Conversation
Our empty benchmark makes this call unconditionally. If MemoryFormat::Contiguous is indeed a common case (or if workloads are likely to use a consistent-ish memory format), then I'd expect checking first to be a win. Differential Revision: [D24914706](https://our.internmc.facebook.com/intern/diff/D24914706/) [ghstack-poisoned]
swolchok
added a commit
that referenced
this pull request
Nov 18, 2020
Our empty benchmark makes this call unconditionally. If MemoryFormat::Contiguous is indeed a common case (or if workloads are likely to use a consistent-ish memory format), then I'd expect checking first to be a win. Differential Revision: [D24914706](https://our.internmc.facebook.com/intern/diff/D24914706/) ghstack-source-id: 117055338 Pull Request resolved: #48211
Contributor
|
there's some discussion on the Phab diff |
💊 CI failures summary and remediationsAs of commit 177efff (more details on the Dr. CI page):
🚧 2 ongoing upstream failures:These were probably caused by upstream breakages that are not fixed yet:
ci.pytorch.org: 1 failedThis comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group. This comment has been revised 77 times. |
…in empty()" Our empty benchmark makes this call unconditionally. If MemoryFormat::Contiguous is indeed a common case (or if workloads are likely to use a consistent-ish memory format), then I'd expect checking first to be a win. Differential Revision: [D24914706](https://our.internmc.facebook.com/intern/diff/D24914706/) [ghstack-poisoned]
ngimel
approved these changes
Nov 30, 2020
bhosmer
approved these changes
Nov 30, 2020
…in empty()" Our empty benchmark makes this call unconditionally. If MemoryFormat::Contiguous is indeed a common case (or if workloads are likely to use a consistent-ish memory format), then I'd expect checking first to be a win. Differential Revision: [D24914706](https://our.internmc.facebook.com/intern/diff/D24914706/) [ghstack-poisoned]
swolchok
added a commit
that referenced
this pull request
Dec 1, 2020
Pull Request resolved: #48211 Our empty benchmark makes this call unconditionally. If MemoryFormat::Contiguous is indeed a common case (or if workloads are likely to use a consistent-ish memory format), then I'd expect checking first to be a win. ghstack-source-id: 117526627 Differential Revision: [D24914706](https://our.internmc.facebook.com/intern/diff/D24914706/)
…in empty()" Our empty benchmark makes this call unconditionally. If MemoryFormat::Contiguous is indeed a common case (or if workloads are likely to use a consistent-ish memory format), then I'd expect checking first to be a win. Differential Revision: [D24914706](https://our.internmc.facebook.com/intern/diff/D24914706/) [ghstack-poisoned]
swolchok
added a commit
that referenced
this pull request
Dec 1, 2020
Pull Request resolved: #48211 Our empty benchmark makes this call unconditionally. If MemoryFormat::Contiguous is indeed a common case (or if workloads are likely to use a consistent-ish memory format), then I'd expect checking first to be a win. ghstack-source-id: 117593009 Differential Revision: [D24914706](https://our.internmc.facebook.com/intern/diff/D24914706/)
…in empty()" Our empty benchmark makes this call unconditionally. If MemoryFormat::Contiguous is indeed a common case (or if workloads are likely to use a consistent-ish memory format), then I'd expect checking first to be a win. Differential Revision: [D24914706](https://our.internmc.facebook.com/intern/diff/D24914706/) [ghstack-poisoned]
swolchok
added a commit
that referenced
this pull request
Dec 3, 2020
Pull Request resolved: #48211 Our empty benchmark makes this call unconditionally. If MemoryFormat::Contiguous is indeed a common case (or if workloads are likely to use a consistent-ish memory format), then I'd expect checking first to be a win. ghstack-source-id: 117788212 Differential Revision: [D24914706](https://our.internmc.facebook.com/intern/diff/D24914706/)
…in empty()" Our empty benchmark makes this call unconditionally. If MemoryFormat::Contiguous is indeed a common case (or if workloads are likely to use a consistent-ish memory format), then I'd expect checking first to be a win. Differential Revision: [D24914706](https://our.internmc.facebook.com/intern/diff/D24914706/) [ghstack-poisoned]
swolchok
added a commit
that referenced
this pull request
Dec 4, 2020
Pull Request resolved: #48211 Our empty benchmark makes this call unconditionally. If MemoryFormat::Contiguous is indeed a common case (or if workloads are likely to use a consistent-ish memory format), then I'd expect checking first to be a win. ghstack-source-id: 117891791 Differential Revision: [D24914706](https://our.internmc.facebook.com/intern/diff/D24914706/)
…nsor_restride in empty()" Our empty benchmark makes this call unconditionally. If MemoryFormat::Contiguous is indeed a common case (or if workloads are likely to use a consistent-ish memory format), then I'd expect checking first to be a win. Differential Revision: [D24914706](https://our.internmc.facebook.com/intern/diff/D24914706/) [ghstack-poisoned]
swolchok
added a commit
that referenced
this pull request
Dec 7, 2020
Pull Request resolved: #48211 Our empty benchmark makes this call unconditionally. If MemoryFormat::Contiguous is indeed a common case (or if workloads are likely to use a consistent-ish memory format), then I'd expect checking first to be a win. ghstack-source-id: 118035402 Differential Revision: [D24914706](https://our.internmc.facebook.com/intern/diff/D24914706/)
…in empty()" Our empty benchmark makes this call unconditionally. If MemoryFormat::Contiguous is indeed a common case (or if workloads are likely to use a consistent-ish memory format), then I'd expect checking first to be a win. Differential Revision: [D24914706](https://our.internmc.facebook.com/intern/diff/D24914706/) [ghstack-poisoned]
swolchok
added a commit
that referenced
this pull request
Dec 9, 2020
Pull Request resolved: #48211 Our empty benchmark makes this call unconditionally. If MemoryFormat::Contiguous is indeed a common case (or if workloads are likely to use a consistent-ish memory format), then I'd expect checking first to be a win. ghstack-source-id: 118224990 Differential Revision: [D24914706](https://our.internmc.facebook.com/intern/diff/D24914706/)
laurentdupin
pushed a commit
to laurentdupin/pytorch
that referenced
this pull request
Apr 24, 2026
…ytorch#48211) Summary: Pull Request resolved: pytorch#48211 Our empty benchmark makes this call unconditionally. If MemoryFormat::Contiguous is indeed a common case (or if workloads are likely to use a consistent-ish memory format), then I'd expect checking first to be a win. ghstack-source-id: 118224990 Test Plan: Profiled empty benchmark with perf, saw time spent in empty_tensor_restride go down. Ran framework overhead benchmarks. ~7% win on empty(), 0.5-1.5% regression on InPlace, ~2% win on OutOfPlace. Seems like both the In/Out of place ones are likely to be noise because they don't exercise empty? Reviewed By: bhosmer Differential Revision: D24914706 fbshipit-source-id: 916771b335143f9b4ec9fae0d8118222ab6e8659
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack from ghstack:
Our empty benchmark makes this call unconditionally. If
MemoryFormat::Contiguous is indeed a common case (or if workloads are
likely to use a consistent-ish memory format), then I'd expect
checking first to be a win.
Differential Revision: D24914706