MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / calcPackedSize

Function calcPackedSize

src/backend/oneapi/fftconvolve.cpp:39–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37
38template<typename T>
39dim4 calcPackedSize(Array<T> const& i1, Array<T> const& i2, const dim_t rank) {
40 const dim4& i1d = i1.dims();
41 const dim4& i2d = i2.dims();
42
43 dim_t pd[4] = {1, 1, 1, 1};
44
45 // Pack both signal and filter on same memory array, this will ensure
46 // better use of batched cuFFT capabilities
47 pd[0] = nextpow2(static_cast<unsigned>(
48 static_cast<int>(ceil(i1d[0] / 2.f)) + i2d[0] - 1));
49
50 for (dim_t k = 1; k < rank; k++) {
51 pd[k] = nextpow2(static_cast<unsigned>(i1d[k] + i2d[k] - 1));
52 }
53
54 dim_t i1batch = 1;
55 dim_t i2batch = 1;
56 for (int k = rank; k < 4; k++) {
57 i1batch *= i1d[k];
58 i2batch *= i2d[k];
59 }
60 pd[rank] = (i1batch + i2batch);
61
62 return dim4(pd[0], pd[1], pd[2], pd[3]);
63}
64
65template<typename T>
66Array<T> fftconvolve(Array<T> const& signal, Array<T> const& filter,

Callers

nothing calls this directly

Calls 4

nextpow2Function · 0.85
ceilFunction · 0.85
dim4Class · 0.50
dimsMethod · 0.45

Tested by

no test coverage detected