-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
ENH: add neon intrinsics to fft radix2&4 #17231
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
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b84ed1b
ENH: add neon intrinsics to fft radix2&4
DumbMice da95959
ENH: add universal intrinsics to fft radix2&4
DumbMice 6a0aecf
ENH: add universal intrinsics to fft radix2&4
DumbMice 295ce15
ENH: add universal intrinsics to fft radix2&4
DumbMice 19387d4
BENCH: add bench_fft.py
DumbMice 976289c
ENH: add universal intrinsics to fft radix2&4
DumbMice File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from .common import Benchmark | ||
|
||
import numpy as np | ||
|
||
class FFT(Benchmark): | ||
params = [2**x for x in range(6,26)] | ||
param_names = ['size'] | ||
|
||
def setup(self,size): | ||
self.x1=np.ones(size,dtype=np.complex) | ||
self.x1+=1j | ||
self.x2=np.ones((size,4),dtype=np.complex) | ||
self.x2+=1j | ||
|
||
def time_1dfft(self,size): | ||
np.fft.fft(self.x1) | ||
|
||
def time_1difft(self,size): | ||
np.fft.ifft(self.x1) | ||
|
||
def time_2dfft(self,size): | ||
np.fft.fft2(self.x2) | ||
|
||
def time_2difft(self,size): | ||
np.fft.ifft2(self.x2) |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef NPY_SIMD | ||
#error "Not a standalone header" | ||
#endif | ||
|
||
#include "memory.h" // load* | ||
#include "reorder.h" // npyv_zip* | ||
|
||
#ifndef _NPY_SIMD_AVX2_INTERLEAVE_H | ||
#define _NPY_SIMD_AVX2_INTERLEAVE_H | ||
|
||
NPY_FINLINE npyv_f64x2 npyv_load_deinterleave_f64x2(const double *ptr) | ||
{ | ||
npyv_f64 ab0 = npyv_load_f64(ptr); | ||
npyv_f64 ab1 = npyv_load_f64(ptr + npyv_nlanes_f64); | ||
npyv_f64x2 ab, swap_halves = npyv_combine_f64(ab0, ab1); | ||
ab.val[0] = _mm256_unpacklo_pd(swap_halves.val[0], swap_halves.val[1]); | ||
ab.val[1] = _mm256_unpackhi_pd(swap_halves.val[0], swap_halves.val[1]); | ||
return ab; | ||
} | ||
|
||
NPY_FINLINE void npyv_store_interleave_f64x2(double *ptr, npyv_f64x2 a) | ||
{ | ||
npyv_f64x2 zip = npyv_zip_f64(a.val[0], a.val[1]); | ||
npyv_store_f64(ptr, zip.val[0]); | ||
npyv_store_f64(ptr + npyv_nlanes_f64, zip.val[1]); | ||
} | ||
#endif // _NPY_SIMD_AVX2_INTERLEAVE_H |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef NPY_SIMD | ||
#error "Not a standalone header" | ||
#endif | ||
|
||
#include "memory.h" // load* | ||
#include "reorder.h" // npyv_zip* | ||
|
||
#ifndef _NPY_SIMD_AVX512_INTERLEAVE_H | ||
#define _NPY_SIMD_AVX512_INTERLEAVE_H | ||
|
||
NPY_FINLINE npyv_f64x2 npyv_load_deinterleave_f64x2(const double *ptr) | ||
{ | ||
npyv_f64 ab0 = npyv_load_f64(ptr); | ||
npyv_f64 ab1 = npyv_load_f64(ptr + npyv_nlanes_f64); | ||
npyv_f64x2 ab; | ||
ab.val[0] = _mm512_permutex2var_pd(ab0, _mm512_setr_epi64(0, 2, 4, 6, 8, 10, 12, 14), ab1); | ||
ab.val[1] = _mm512_permutex2var_pd(ab0, _mm512_setr_epi64(1, 3, 5, 7, 9, 11, 13, 15), ab1); | ||
return ab; | ||
} | ||
|
||
NPY_FINLINE void npyv_store_interleave_f64x2(double *ptr, npyv_f64x2 a) | ||
{ | ||
npyv_f64x2 zip = npyv_zip_f64(a.val[0], a.val[1]); | ||
npyv_store_f64(ptr, zip.val[0]); | ||
npyv_store_f64(ptr + npyv_nlanes_f64, zip.val[1]); | ||
} | ||
#endif // _NPY_SIMD_AVX512_INTERLEAVE_H |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef NPY_SIMD | ||
#error "Not a standalone header" | ||
#endif | ||
|
||
#ifndef _NPY_SIMD_NEON_INTERLEAVE_H | ||
#define _NPY_SIMD_NEON_INTERLEAVE_H | ||
|
||
#if NPY_SIMD_F64 | ||
NPY_FINLINE npyv_f64x2 npyv_load_deinterleave_f64x2(const double *ptr) | ||
{ return vld2q_f64(ptr); } | ||
|
||
NPY_FINLINE void npyv_store_interleave_f64x2(double *ptr, npyv_f64x2 a) | ||
{ vst2q_f64(ptr, a); } | ||
#endif // NPY_SIMD_F64 | ||
|
||
#endif |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#ifndef NPY_SIMD | ||
#error "Not a standalone header" | ||
#endif | ||
|
||
#include "memory.h" // load* | ||
#include "reorder.h" // npyv_zip* | ||
|
||
#ifndef _NPY_SIMD_SSE_INTERLEAVE_H | ||
#define _NPY_SIMD_SSE_INTERLEAVE_H | ||
|
||
NPY_FINLINE npyv_f64x2 npyv_load_deinterleave_f64x2(const double *ptr) | ||
{ | ||
npyv_f64 a = npyv_load_f64(ptr); | ||
npyv_f64 b = npyv_load_f64(ptr + npyv_nlanes_f64); | ||
return npyv_zip_f64(a, b); | ||
} | ||
|
||
NPY_FINLINE void npyv_store_interleave_f64x2(double *ptr, npyv_f64x2 a) | ||
{ | ||
npyv_f64x2 zip = npyv_zip_f64(a.val[0], a.val[1]); | ||
npyv_store_f64(ptr, zip.val[0]); | ||
npyv_store_f64(ptr + npyv_nlanes_f64, zip.val[1]); | ||
} | ||
#endif // _NPY_SIMD_SSE_INTERLEAVE_H |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#ifndef NPY_SIMD | ||
#error "Not a standalone header" | ||
#endif | ||
|
||
#include "memory.h" // load* | ||
#include "reorder.h" // npyv_zip* | ||
|
||
#ifndef _NPY_SIMD_VSX_INTERLEAVE_H | ||
#define _NPY_SIMD_VSX_INTERLEAVE_H | ||
|
||
NPY_FINLINE npyv_f64x2 npyv_load_deinterleave_f64x2(const double *ptr) | ||
{ | ||
npyv_f64 a = npyv_load_f64(ptr); | ||
npyv_f64 b = npyv_load_f64(ptr + npyv_nlanes_f64); | ||
return npyv_zip_f64(a, b); | ||
} | ||
|
||
NPY_FINLINE void npyv_store_interleave_f64x2(double *ptr, npyv_f64x2 a) | ||
{ | ||
npyv_f64x2 zip = npyv_zip_f64(a.val[0], a.val[1]); | ||
npyv_store_f64(ptr, zip.val[0]); | ||
npyv_store_f64(ptr + npyv_nlanes_f64, zip.val[1]); | ||
} | ||
#endif // _NPY_SIMD_VSX_INTERLEAVE_H |
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.