MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / run_op

Method run_op

src/cpu/kernels/CpuCopyKernel.cpp:133–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133void CpuCopyKernel::run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info)
134{
135 ARM_COMPUTE_TRACE_EVENT(ARM_COMPUTE_PROF_CAT_CPU, ARM_COMPUTE_PROF_LVL_CPU, "CpuCopyKernel::run_op");
136 ARM_COMPUTE_UNUSED(info);
137 ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
138 ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(ICpuKernel::window(), window);
139
140 const auto src = tensors.get_const_tensor(TensorType::ACL_SRC);
141 auto dst = tensors.get_tensor(TensorType::ACL_DST);
142
143 if (_padding.empty())
144 {
145 Window dst_window{window};
146 dst_window.set(Window::DimX,
147 Window::Dimension(dst_window.x().start(), dst_window.x().end(), src->info()->dimension(0)));
148 Window out_slice = dst_window.first_slice_window_1D();
149 do
150 {
151 Iterator src_it(src, out_slice);
152 Iterator dst_it(dst, out_slice);
153
154 execute_window_loop(
155 out_slice,
156 [&](const Coordinates &)
157 { memcpy(dst_it.ptr(), src_it.ptr(), dst->info()->dimension(0) * dst->info()->element_size()); },
158 src_it, dst_it);
159 } while (dst_window.slide_window_slice_1D(out_slice));
160 }
161 else
162 {
163 Window src_window{window};
164 src_window.set(Window::DimX,
165 Window::Dimension(0, window.x().end() - _padding[0].first, src->info()->dimension(0)));
166
167 Iterator src_it(src, src_window);
168 Iterator dst_it(dst, window);
169 const size_t row_size_in_bytes = src->info()->dimension(0) * src->info()->element_size();
170 execute_window_loop(
171 window,
172 [&](const Coordinates &)
173 {
174 auto dst_ptr = dst_it.ptr() + _padding[0].first * dst->info()->element_size();
175 std::memcpy(dst_ptr, src_it.ptr(), row_size_in_bytes);
176 },
177 src_it, dst_it);
178 }
179}
180
181const char *CpuCopyKernel::name() const
182{

Callers

nothing calls this directly

Calls 14

get_const_tensorMethod · 0.80
first_slice_window_1DMethod · 0.80
slide_window_slice_1DMethod · 0.80
DimensionClass · 0.50
get_tensorMethod · 0.45
emptyMethod · 0.45
setMethod · 0.45
startMethod · 0.45
xMethod · 0.45
endMethod · 0.45
dimensionMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected