8000 ENH: Improve the performance of einsum by using universal simd by Qiyu8 · Pull Request #17049 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

ENH: Improve the performance of einsum by using universal simd #17049

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
e26dcf7
new npyv intrinsics
Qiyu8 Aug 11, 2020
47118fb
einsum dispatch and usimd process
Qiyu8 Aug 11, 2020
ad0b3b4
update
Qiyu8 Aug 11, 2020
55200fc
add float32 benchmark case
Qiyu8 Aug 11, 2020
94cff77
Merge branch 'master' of github.com:numpy/numpy into einsum-usimd
Qiyu8 Aug 12, 2020
4d7d94d
update
Qiyu8 Aug 12, 2020
ae53e35
fix typos
Qiyu8 Aug 12, 2020
2e713b0
add avx512 reduce sum comments
Qiyu8 Aug 13, 2020
5e7cbd1
add non_contigous arrays ,improve reduce the sum
Qiyu8 Aug 20, 2020
80c0ed4
Merge branch 'master' of github.com:numpy/numpy into einsum-usimd
Qiyu8 Aug 24, 2020
9060231
rebase after split for a better review
Qiyu8 Aug 24, 2020
b0375dc
Merge branch 'einsum-usimd' of github.com:Qiyu8/numpy into einsum-usimd
Qiyu8 Aug 25, 2020
1990c13
headers reconstruct
Qiyu8 Aug 25, 2020
7b756af
use for loop replace begin repeat for readability
Qiyu8 Aug 25, 2020
4877e40
add ivdeps and handle header dependency
Qiyu8 Aug 26, 2020
168c6c9
Merge branch 'einsum-usimd' of github.com:Qiyu8/numpy into einsum-usimd
Qiyu8 Aug 26, 2020
954e642
revert to faster simd code
Qiyu8 Aug 27, 2020
50c6b7e
changed to baseline solution
Qiyu8 Aug 28, 2020
23e28c0
remove redundant typedef
Qiyu8 Aug 31, 2020
21f1c0b
update
Qiyu8 Sep 1, 2020
a07455a
Merge branch 'master' of github.com:numpy/numpy into einsum-usimd
Qiyu8 Sep 10, 2020
d298c8e
remove redundant intrinsics
Qiyu8 Sep 10, 2020
6dac52e
add blank lines
Qiyu8 Sep 11, 2020
985e5b2
add format
Qiyu8 Sep 14, 2020
88c2747
Update numpy/core/src/common/simd/avx512/arithmetic.h
Qiyu8 Sep 14, 2020
90026f9
Merge branch 'master' of github.com:numpy/numpy into einsum-usimd
Qiyu8 Sep 15, 2020
54943e0
modify the int to npy_intp
Qiyu8 Sep 15, 2020
e993af2
split benchmark and define common macro
Qiyu8 Sep 18, 2020
38f7382
avx2 test
Qiyu8 Sep 18, 2020
f351665
Merge branch 'einsum-usimd' of github.com:Qiyu8/numpy into einsum-usimd
Qiyu8 Sep 18, 2020
c6c1e30
explain for auto-vectorize part
Qiyu8 Sep 18, 2020
f18ade4
add explantion
Qiyu8 Sep 18, 2020
33b7d2a
remove duplicated message
Qiyu8 Sep 19, 2020
5a692ed
Update benchmarks/benchmarks/bench_linalg.py
Qiyu8 Sep 29, 2020
20d5cda
Update numpy/core/src/multiarray/einsum_sumprod.c.src
Qiyu8 Sep 30, 2020
83734bf
Merge branch 'master' of github.com:numpy/numpy into einsum-usimd
Qiyu8 Oct 9, 2020
f8f7482
Merge branch 'einsum-usimd' of github.com:Qiyu8/numpy into einsum-usimd
Qiyu8 Oct 9, 2020
1889738
Merge branch 'master' of github.com:numpy/numpy into einsum-usimd
Qiyu8 Oct 12, 2020
7ff7324
fix typos
Qiyu8 Oct 12, 2020
73f61c3
remove extra test
Qiyu8 Oct 13, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
einsum dispatch and usimd process
  • Loading branch information
Qiyu8 committed Aug 11, 2020
commit 47118fb6530e55f5f7164d2e652ff8b94f55d025
19 changes: 17 additions & 2 deletions benchmarks/benchmarks/bench_linalg.py
< 8000 td id="diff-097a32fc64cac91dfef1dac6d875d9ecbaa1eabd848e4659b1d242dd7bcb77a0L112" data-line-number="112" class="blob-num blob-num-context js-linkable-line-number">
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,14 @@ class Einsum(Benchmark):
def setup(self, dtype):
self.a = np.arange(2900, dtype=dtype)
self.b = np.arange(3000, dtype=dtype)
self.b1 = np.arange(240000, dtype=dtype).reshape(400, 600)
self.c = np.arange(24000, dtype=dtype).reshape(20, 30, 40)
self.c1 = np.arange(1200, dtype=dtype).reshape(30, 40)
self.c2 = np.arange(480000, dtype=dtype)
self.c3 = np.arange(600, dtype=dtype)
self.d = np.arange(10000, dtype=dtype).reshape(10,100,10)

#outer(a,b): trigger sum_of_products_contig_stride0_outcontig_two
# outer(a,b): trigger sum_of_products_contig_stride0_outcontig_two
def time_einsum_outer(self, dtype):
np.einsum("i,j", self.a, self.b, optimize=True)

Expand All @@ -130,4 +133,16 @@ def time_einsum_sum_mul(self, dtype):

# sum and multiply:trigger sum_of_products_stride0_contig_outstride0_two
def time_einsum_sum_mul2(self, dtype):
np.einsum("i...,->", self.d, 300, optimize=True)
np.einsum("i...,->", self.d, 300, optimize=True)

# scalar mul: trigger sum_of_products_stride0_contig_outcontig_two
def time_einsum_mul(self, dtype):
np.einsum("i,->i", self.c2, 300, optimize=True)

# trigger contig_contig_outstride0_two
def time_einsum_contig_contig(self, dtype):
np.einsum("ji,i->", self.b1, self.c3, optimize=True)

# trigger sum_of_products_contig_outstride0_one
def time_einsum_contig_outstride0(self, dtype):
np.einsum("i->", self.c2, optimize=True)
1 change: 1 addition & 0 deletions numpy/core/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,7 @@ def get_mathlib_info(*args):
join('src', 'multiarray', 'dragon4.c'),
join('src', 'multiarray', 'dtype_transfer.c'),
join('src', 'multiarray', 'einsum.c.src'),
join('src', 'multiarray', 'einsum.dispatch.c.src'),
join('src', 'multiarray', 'flagsobject.c'),
join('src', 'multiarray', 'getset.c'),
join('src', 'multiarray', 'hashdescr.c'),
Expand Down
Loading
0