Skip to content

port masked_fill from TH to ATen - #33330

Closed
mingfeima wants to merge 1 commit into
pytorch:masterfrom
mingfeima:indexing/masked_fill
Closed

mingfeima wants to merge 1 commit into
pytorch:masterfrom
mingfeima:indexing/masked_fill

Conversation

@mingfeima

@mingfeima mingfeima commented Feb 14, 2020 •

Copy link
Copy Markdown
Collaborator

port masked_fill from TH to ATen with TensorIterator.

single core performance roughly stays the same, single socket performance has 3~16x boost.

masked_fill is missing from #24507

@mingfeima

Copy link
Copy Markdown
Collaborator Author

Below shows the performance compare between original and this pr, benchmark code available at this op_bench-py, to reproduce, ./run.sh masked_fillpy. Test machine is Xeon Skylake 6148 with 2*20 cores @2.40GHz.

The unit is ms per iteration, the lower the better.

single socket run

input size contiguous original this pr speedup
[128 1000] TRUE 0.481 0.134 3.59
[256 1000] TRUE 0.979 0.134 7.31
[512 1000] TRUE 1.021 0.149 6.85
[1024 1000] TRUE 1.046 0.239 4.38
[128 1000] FALSE 0.507 0.134 3.78
[256 1000] FALSE 1.017 0.135 7.53
[512 1000] FALSE 2.029 0.150 13.53
[1024 1000] FALSE 4.057 0.241 16.83

single core run

input size contiguous original this pr speedup
[128 1000] TRUE 0.481 0.493 0.98
[256 1000] TRUE 0.999 0.994 1.01
[512 1000] TRUE 1.925 1.980 0.97
[1024 1000] TRUE 3.859 3.953 0.98
[128 1000] FALSE 0.514 0.517 0.99
[256 1000] FALSE 1.028 0.997 1.03
[512 1000] FALSE 2.029 2.000 1.01
[1024 1000] FALSE 4.157 4.107 1.01

@yf225 yf225 added module: porting Issues related to porting TH/THNN legacy to ATen native triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module labels Feb 19, 2020
@yf225
yf225 requested a review from VitalyFedyunin February 19, 2020 21:09

@VitalyFedyunin VitalyFedyunin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@VitalyFedyunin

Copy link
Copy Markdown
Contributor

Please rebase

@mingfeima
mingfeima force-pushed the indexing/masked_fill branch from 1ab2557 to dbde790 Compare February 21, 2020 00:12
@mingfeima

Copy link
Copy Markdown
Collaborator Author

rebased.

@facebook-github-bot facebook-github-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@VitalyFedyunin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@VitalyFedyunin merged this pull request in cd0acf4.

hczhu pushed a commit that referenced this pull request Feb 28, 2020
Summary:
port `masked_fill` from TH to ATen with TensorIterator.

single core performance roughly stays the same, single socket performance has **3~16x** boost.

`masked_fill` is missing from #24507
Pull Request resolved: #33330

Differential Revision: D20098812

Pulled By: VitalyFedyunin

fbshipit-source-id: ff20712ffc00cc665550997abcfdfb8916c18e40
ttumiel pushed a commit to ttumiel/pytorch that referenced this pull request Mar 4, 2020
Summary:
port `masked_fill` from TH to ATen with TensorIterator.

single core performance roughly stays the same, single socket performance has **3~16x** boost.

`masked_fill` is missing from pytorch#24507
Pull Request resolved: pytorch#33330

Differential Revision: D20098812

Pulled By: VitalyFedyunin

fbshipit-source-id: ff20712ffc00cc665550997abcfdfb8916c18e40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged module: porting Issues related to porting TH/THNN legacy to ATen native open source triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants