| 537 | */ |
| 538 | template <typename T, unsigned int dimension_size> |
| 539 | void ICLKernel::add_array_argument( |
| 540 | unsigned &idx, const ICLArray<T> *array, const Strides &strides, unsigned int num_dimensions, const Window &window) |
| 541 | { |
| 542 | ARM_COMPUTE_ERROR_ON(array == nullptr); |
| 543 | |
| 544 | // Calculate offset to the start of the window |
| 545 | unsigned int offset_first_element = 0; |
| 546 | |
| 547 | for (unsigned int n = 0; n < num_dimensions; ++n) |
| 548 | { |
| 549 | offset_first_element += window[n].start() * strides[n]; |
| 550 | } |
| 551 | |
| 552 | unsigned int idx_start = idx; |
| 553 | _kernel.setArg(idx++, array->cl_buffer()); |
| 554 | |
| 555 | for (unsigned int dimension = 0; dimension < dimension_size; dimension++) |
| 556 | { |
| 557 | _kernel.setArg<cl_uint>(idx++, strides[dimension]); |
| 558 | _kernel.setArg<cl_uint>(idx++, strides[dimension] * window[dimension].step()); |
| 559 | } |
| 560 | |
| 561 | _kernel.setArg<cl_uint>(idx++, offset_first_element); |
| 562 | |
| 563 | ARM_COMPUTE_ERROR_ON_MSG_VAR(idx_start + num_arguments_per_array<dimension_size>() != idx, |
| 564 | "add_%dD_array_argument() is supposed to add exactly %d arguments to the kernel", |
| 565 | dimension_size, num_arguments_per_array<dimension_size>()); |
| 566 | ARM_COMPUTE_UNUSED(idx_start); |
| 567 | } |
| 568 | } // namespace arm_compute |
| 569 | #endif /*ARM_COMPUTE_ICLKERNEL_H */ |