toTensor cleanup on sparsenn & static runtime ops#51113
Closed
swolchok wants to merge 1 commit intogh/swolchok/89/basefrom
Closed
toTensor cleanup on sparsenn & static runtime ops#51113swolchok wants to merge 1 commit intogh/swolchok/89/basefrom
swolchok wants to merge 1 commit intogh/swolchok/89/basefrom
Conversation
toTensor() on an lvalue IValue returns a reference; no need to copy. Differential Revision: [D26051766](https://our.internmc.facebook.com/intern/diff/D26051766/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D26051766/)! [ghstack-poisoned]
Contributor
💊 CI failures summary and remediationsAs of commit 84efd95 (more details on the Dr. CI page):
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 to the (internal) Dr. CI Users group. |
swolchok
added a commit
that referenced
this pull request
Jan 26, 2021
toTensor() on an lvalue IValue returns a reference; no need to copy. Differential Revision: [D26051766](https://our.internmc.facebook.com/intern/diff/D26051766/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D26051766/)! ghstack-source-id: 120317233 Pull Request resolved: #51113
Codecov Report
@@ Coverage Diff @@
## gh/swolchok/89/base #51113 +/- ##
====================================================
Coverage 80.91% 80.91%
====================================================
Files 1926 1926
Lines 210014 210014
====================================================
Hits 169942 169942
Misses 40072 40072 |
Contributor
|
This pull request has been merged in 83bfab2. |
laurentdupin
pushed a commit
to laurentdupin/pytorch
that referenced
this pull request
Apr 24, 2026
Summary: Pull Request resolved: pytorch#51113 toTensor() on an lvalue IValue returns a reference; no need to copy. ghstack-source-id: 120317233 Test Plan: fitsships Compared `perf stat` results before/after (was on top of a diff stack so don't take baseline as where master is) Before: ``` 74,178.77 msec task-clock # 0.999 CPUs utilized ( +- 0.31% ) 17,125 context-switches # 0.231 K/sec ( +- 3.41% ) 3 cpu-migrations # 0.000 K/sec 109,535 page-faults # 0.001 M/sec ( +- 1.04% ) 146,803,364,372 cycles # 1.979 GHz ( +- 0.30% ) (50.03%) 277,726,600,254 instructions # 1.89 insn per cycle ( +- 0.02% ) (50.03%) 43,299,659,815 branches # 583.720 M/sec ( +- 0.03% ) (50.03%) 130,504,094 branch-misses # 0.30% of all branches ( +- 1.14% ) (50.03%) ``` After: ``` 72,695.01 msec task-clock # 0.999 CPUs utilized ( +- 1.18% ) 15,994 context-switches # 0.220 K/sec ( +- 5.21% ) 3 cpu-migrations # 0.000 K/sec 107,743 page-faults # 0.001 M/sec ( +- 1.55% ) 145,647,684,269 cycles # 2.004 GHz ( +- 0.30% ) (50.05%) 277,341,084,993 instructions # 1.90 insn per cycle ( +- 0.02% ) (50.04%) 43,200,717,263 branches # 594.273 M/sec ( +- 0.02% ) (50.05%) 143,873,086 branch-misses # 0.33% of all branches ( +- 0.59% ) (50.05%) ``` Looks like an 0.7% cycles win (barely outside the noise) and an 0.1% instructions win. Reviewed By: hlu1 Differential Revision: D26051766 fbshipit-source-id: 05f8d71d8120d79f7cd80aca747dfc537bf7d382
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:
toTensor() on an lvalue IValue returns a reference; no need to copy.
Differential Revision: D26051766
NOTE FOR REVIEWERS: This PR has internal Facebook specific changes or comments, please review them on Phabricator!