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

Method run_op

src/cpu/kernels/CpuCastKernel.cpp:283–1178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

281#endif // __aarch64__
282
283void CpuCastKernel::run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info)
284{
285 ARM_COMPUTE_TRACE_EVENT(ARM_COMPUTE_PROF_CAT_CPU, ARM_COMPUTE_PROF_LVL_CPU, "CpuCastKernel::run_op");
286 ARM_COMPUTE_UNUSED(info);
287 ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
288 ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(IKernel::window(), window);
289
290 const auto window_start_x = static_cast<int>(window.x().start());
291 const auto window_end_x = static_cast<int>(window.x().end());
292 const int window_step_x = 16;
293
294 const ITensor *_src = tensors.get_const_tensor(TensorType::ACL_SRC);
295 ITensor *_dst = tensors.get_tensor(TensorType::ACL_DST);
296 ARM_COMPUTE_ERROR_ON_NULLPTR(_src, _dst);
297 ARM_COMPUTE_ERROR_ON(_src == _dst);
298
299 ARM_COMPUTE_ERROR_ON_NULLPTR(_src, _dst);
300
301 Window win{window};
302 win.set(Window::DimX, Window::Dimension(0, 1, 1));
303
304 Iterator src(_src, win);
305 Iterator dst(_dst, win);
306
307 /*ukernel runs only when using fp16, so we validate it isn't a nullptr only before using it */
308 const auto *uk = CpuCastKernel::get_implementation(
309 CastDataTypeISASelectorData{_src->info()->data_type(), _dst->info()->data_type(), CPUInfo::get().get_isa()});
310
311 switch (_src->info()->data_type())
312 {
313#ifdef __aarch64__
314 case DataType::U64:
315 {
316 switch (_dst->info()->data_type())
317 {
318 case DataType::F32:
319 {
320 convert64<uint64_t, float>(src, dst, win, window_start_x, window_end_x, window_step_x);
321 break;
322 }
323 default:
324 ARM_COMPUTE_ERROR("dst data type not supported");
325 }
326 break;
327 }
328 case DataType::S64:
329 {
330 switch (_dst->info()->data_type())
331 {
332 case DataType::F32:
333 {
334 convert64<int64_t, float>(src, dst, win, window_start_x, window_end_x, window_step_x);
335 break;
336 }
337 default:
338 ARM_COMPUTE_ERROR("dst data type not supported");
339 }
340 break;

Callers

nothing calls this directly

Calls 12

get_const_tensorMethod · 0.80
get_isaMethod · 0.80
DimensionClass · 0.50
get_implementationFunction · 0.50
startMethod · 0.45
xMethod · 0.45
endMethod · 0.45
get_tensorMethod · 0.45
setMethod · 0.45
data_typeMethod · 0.45
infoMethod · 0.45
ptrMethod · 0.45

Tested by

no test coverage detected