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

Method run_op

src/gpu/cl/kernels/ClScatterKernel.cpp:212–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212void ClScatterKernel::run_op(ITensorPack &tensors, const Window &window, cl::CommandQueue &queue)
213{
214 const auto updates =
215 utils::cast::polymorphic_downcast<const ICLTensor *>(tensors.get_const_tensor(TensorType::ACL_SRC_0));
216 const auto indices =
217 utils::cast::polymorphic_downcast<const ICLTensor *>(tensors.get_const_tensor(TensorType::ACL_SRC_1));
218 auto dst = utils::cast::polymorphic_downcast<ICLTensor *>(tensors.get_tensor(TensorType::ACL_DST));
219
220 const ITensorInfo *dst_info = dst->info();
221 const ITensorInfo *upd_info = updates->info();
222 const int num_dims = dst_info->num_dimensions();
223 const int ind_dims = indices->info()->num_dimensions();
224 const int index_len = indices->info()->dimension(0);
225
226 bool unsupported_padding_config =
227 num_dims == index_len && index_len > 1 && (dst_info->has_padding() || upd_info->has_padding());
228 if (unsupported_padding_config)
229 {
230 ARM_COMPUTE_ERROR("Unsupported Configuration! Padding not supported with these shapes.");
231 }
232
233 // calculate m-dimensional data block strides in updates and destination tensors
234 const int upt_block_stride =
235 updates->info()->strides_in_bytes()[updates->info()->num_dimensions() - (ind_dims - 1)];
236
237 const int out_block_stride = dst_info->strides_in_bytes()[num_dims - index_len];
238
239 unsigned int idx = 0;
240
241 add_2D_tensor_argument(idx, updates, window);
242 add_2D_tensor_argument(idx, indices, window);
243 add_2D_tensor_argument(idx, dst, window);
244
245 _kernel.setArg<cl_int>(idx++, upt_block_stride);
246 _kernel.setArg<cl_int>(idx++, out_block_stride);
247
248 enqueue(queue, *this, window, lws_hint());
249}
250
251} // namespace kernels
252} // namespace opencl

Callers

nothing calls this directly

Calls 6

get_const_tensorMethod · 0.80
get_tensorMethod · 0.45
infoMethod · 0.45
num_dimensionsMethod · 0.45
dimensionMethod · 0.45
has_paddingMethod · 0.45

Tested by

no test coverage detected