Skip to content

[PyTorch] avoid unnecessary call to empty_tensor_restride in empty()#48211

Closed
swolchok wants to merge 8 commits intogh/swolchok/18/basefrom
gh/swolchok/18/head
Closed

[PyTorch] avoid unnecessary call to empty_tensor_restride in empty()#48211
swolchok wants to merge 8 commits intogh/swolchok/18/basefrom
gh/swolchok/18/head

Conversation

@swolchok
Copy link
Copy Markdown
Contributor

@swolchok swolchok commented Nov 18, 2020

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

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
@ezyang
Copy link
Copy Markdown
Contributor

ezyang commented Nov 18, 2020

there's some discussion on the Phab diff

@dr-ci
Copy link
Copy Markdown

dr-ci Bot commented Nov 18, 2020

💊 CI failures summary and remediations

As of commit 177efff (more details on the Dr. CI page):


  • 1/3 failures possibly* introduced in this PR
    • 1/1 non-CircleCI failure(s)
  • 2/3 broken upstream at merge base 9f7fb54 since Dec 09

🚧 2 ongoing upstream failures:

These were probably caused by upstream breakages that are not fixed yet:


ci.pytorch.org: 1 failed


This 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.

See how this bot performed.

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]
…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/)
@facebook-github-bot facebook-github-bot deleted the gh/swolchok/18/head branch December 15, 2020 15:21
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
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.

5 participants