| 82 | } |
| 83 | |
| 84 | void CpuConcatenateWidthKernel::run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) |
| 85 | { |
| 86 | ARM_COMPUTE_TRACE_EVENT(ARM_COMPUTE_PROF_CAT_CPU, ARM_COMPUTE_PROF_LVL_CPU, "CpuConcatenateWidthKernel::run_op"); |
| 87 | ARM_COMPUTE_UNUSED(info); |
| 88 | ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this); |
| 89 | ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(ICpuKernel::window(), window); |
| 90 | |
| 91 | const auto src = tensors.get_const_tensor(TensorType::ACL_SRC); |
| 92 | auto dst = tensors.get_tensor(TensorType::ACL_DST); |
| 93 | |
| 94 | // Offset output pointer to the correct position |
| 95 | uint8_t *dst_ptr = dst->buffer() + dst->info()->offset_first_element_in_bytes() + |
| 96 | _width_offset * dst->info()->strides_in_bytes()[0]; |
| 97 | |
| 98 | const auto window_start_x = static_cast<int>(window.x().start()); |
| 99 | const auto window_end_x = static_cast<int>(window.x().end()) * static_cast<int>(dst->info()->element_size()); |
| 100 | constexpr int window_step_x = 16; |
| 101 | |
| 102 | Window win{window}; |
| 103 | win.set(Window::DimX, Window::Dimension(0, 1, 1)); |
| 104 | |
| 105 | // Create iterators |
| 106 | Iterator src_it(src, win); |
| 107 | Iterator dst_it(dst, win); |
| 108 | const DataType dt = src->info()->data_type(); |
| 109 | const UniformQuantizationInfo &src_qinfo = src->info()->quantization_info().uniform(); |
| 110 | const UniformQuantizationInfo &dst_qinfo = dst->info()->quantization_info().uniform(); |
| 111 | if (dt == DataType::QASYMM8 && src_qinfo != dst_qinfo) |
| 112 | { |
| 113 | execute_window_loop( |
| 114 | win, |
| 115 | [&](const Coordinates &) |
| 116 | { |
| 117 | int x = window_start_x; |
| 118 | for (; x <= (window_end_x - window_step_x); x += window_step_x) |
| 119 | { |
| 120 | vst1q_u8(dst_ptr + dst_it.offset() + x, |
| 121 | vquantize(vdequantize(vld1q_u8(src_it.ptr() + x), src_qinfo), dst_qinfo)); |
| 122 | } |
| 123 | |
| 124 | // Compute left-over elements |
| 125 | for (; x < window_end_x; ++x) |
| 126 | { |
| 127 | *(dst_ptr + dst_it.offset() + x) = |
| 128 | quantize_qasymm8(dequantize_qasymm8(*(src_it.ptr() + x), src_qinfo), dst_qinfo); |
| 129 | } |
| 130 | }, |
| 131 | src_it, dst_it); |
| 132 | } |
| 133 | else if (dt == DataType::QASYMM8_SIGNED && src_qinfo != dst_qinfo) |
| 134 | { |
| 135 | execute_window_loop( |
| 136 | win, |
| 137 | [&](const Coordinates &) |
| 138 | { |
| 139 | int x = window_start_x; |
| 140 | for (; x <= (window_end_x - window_step_x); x += window_step_x) |
| 141 | { |
nothing calls this directly
no test coverage detected