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

Function packDataHelper

src/backend/oneapi/kernel/fftconvolve_pack.hpp:104–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102
103template<typename convT, typename T>
104void packDataHelper(Param<convT> packed, Param<T> sig, Param<T> filter,
105 const int rank, AF_BATCH_KIND kind) {
106 Param<T> sig_tmp, filter_tmp;
107 calcParamSizes(sig_tmp, filter_tmp, packed, sig, filter, rank, kind);
108
109 int sig_packed_elem = sig_tmp.info.strides[3] * sig_tmp.info.dims[3];
110
111 // Number of packed complex elements in dimension 0
112 int sig_half_d0 = divup(sig.info.dims[0], 2);
113 int sig_half_d0_odd = sig.info.dims[0] % 2;
114
115 int blocks = divup(sig_packed_elem, THREADS);
116
117 // Locate features kernel sizes
118 auto local = sycl::range(THREADS);
119 auto global = sycl::range(blocks * THREADS);
120
121 // Treat complex output as an array of scalars
122 using convScalarT = typename convT::value_type;
123 auto packed_num_elem = (*packed.data).get_range().size();
124 auto sig_tmp_buffer = (*packed.data)
125 .template reinterpret<convScalarT>(
126 sycl::range<1>{packed_num_elem * 2});
127
128 getQueue().submit([&](auto &h) {
129 read_accessor<T> d_sig = {*sig.data, h};
130 write_accessor<convScalarT> d_sig_tmp = {sig_tmp_buffer, h};
131 h.parallel_for(sycl::nd_range{global, local},
132 fftconvolve_packCreateKernel<T, convScalarT>(
133 d_sig_tmp, sig_tmp.info, d_sig, sig.info,
134 sig_half_d0, sig_half_d0_odd));
135 });
136
137 ONEAPI_DEBUG_FINISH(getQueue());
138}
139
140} // namespace kernel
141} // namespace oneapi

Callers

nothing calls this directly

Calls 3

calcParamSizesFunction · 0.70
rangeFunction · 0.70
getQueueFunction · 0.50

Tested by

no test coverage detected