Skip to content

toTensor cleanup on sparsenn & static runtime ops#51113

Closed
swolchok wants to merge 1 commit intogh/swolchok/89/basefrom
gh/swolchok/89/head
Closed

toTensor cleanup on sparsenn & static runtime ops#51113
swolchok wants to merge 1 commit intogh/swolchok/89/basefrom
gh/swolchok/89/head

Conversation

@swolchok
Copy link
Copy Markdown
Contributor

@swolchok swolchok commented Jan 26, 2021

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!

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]
@facebook-github-bot
Copy link
Copy Markdown
Contributor

facebook-github-bot commented Jan 26, 2021

💊 CI failures summary and remediations

As of commit 84efd95 (more details on the Dr. CI page):


  • 1/1 failures possibly* introduced in this PR
    • 1/1 non-CircleCI failure(s)

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.

@facebook-github-bot facebook-github-bot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Jan 26, 2021
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
Copy link
Copy Markdown

codecov Bot commented Jan 26, 2021

Codecov Report

Merging #51113 (84efd95) into gh/swolchok/89/base (f7b339d) will not change coverage.
The diff coverage is n/a.

@@                 Coverage Diff                  @@
##           gh/swolchok/89/base   #51113   +/-   ##
====================================================
  Coverage                80.91%   80.91%           
====================================================
  Files                     1926     1926           
  Lines                   210014   210014           
====================================================
  Hits                    169942   169942           
  Misses                   40072    40072           

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in 83bfab2.

@facebook-github-bot facebook-github-bot deleted the gh/swolchok/89/head branch January 30, 2021 15:21
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed Merged oncall: jit Add this issue/PR to JIT oncall triage queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants