aboutsummaryrefslogtreecommitdiff
path: root/src/gpu/cl/kernels/ClHeightConcatenateKernel.cpp
diff options
context:
space:
mode:
authorramelg01 <ramy.elgammal@arm.com>2022-02-08 23:01:31 +0000
committerRamy Elgammal <ramy.elgammal@arm.com>2022-02-11 11:01:10 +0000
commit89aa4eb56d56c81a9d53f94dffa5fa88742e986c (patch)
tree64ac3cb37d44fcfb8cf7add9100a8f0230a51d8f /src/gpu/cl/kernels/ClHeightConcatenateKernel.cpp
parent2134d1bdb81e4959560d5becea06c43c083a9811 (diff)
downloadComputeLibrary-89aa4eb56d56c81a9d53f94dffa5fa88742e986c.tar.gz
Improve start-up time for concatenation layers
- pass tensor's dimensions at runtime rather than compile time - Add guard macro to compile only kernel of internest Resolves: COMPMID-5121 Signed-off-by: Ramy Elgammal <ramy.elgammal@arm.com> Change-Id: I76b7c0cf56d803f58ebff5494c904ace2a86ef5a Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/7097 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/gpu/cl/kernels/ClHeightConcatenateKernel.cpp')
-rw-r--r--src/gpu/cl/kernels/ClHeightConcatenateKernel.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gpu/cl/kernels/ClHeightConcatenateKernel.cpp b/src/gpu/cl/kernels/ClHeightConcatenateKernel.cpp
index 688308098a..95eca69bde 100644
--- a/src/gpu/cl/kernels/ClHeightConcatenateKernel.cpp
+++ b/src/gpu/cl/kernels/ClHeightConcatenateKernel.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2021 Arm Limited.
+ * Copyright (c) 2019-2022 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -89,7 +89,6 @@ void ClHeightConcatenateKernel::configure(const CLCompileContext &compile_contex
build_opts.add_option("-DDATA_TYPE=" + get_cl_unsigned_type_from_element_size(src->element_size()));
build_opts.add_option("-DVEC_SIZE=" + support::cpp11::to_string(num_elems_processed_per_iteration));
build_opts.add_option("-DHEIGHT_OFFSET=" + support::cpp11::to_string(_height_offset));
- build_opts.add_option("-DDEPTH=" + support::cpp11::to_string(src->dimension(2)));
build_opts.add_option("-DVEC_SIZE_LEFTOVER=" + support::cpp11::to_string(src->dimension(0) % num_elems_processed_per_iteration));
if(is_data_type_quantized_asymmetric(src->data_type()) && src->quantization_info() != dst->quantization_info())
@@ -102,9 +101,15 @@ void ClHeightConcatenateKernel::configure(const CLCompileContext &compile_contex
build_opts.add_option("-DSCALE_IN1=" + float_to_string_with_full_precision(iq_info.scale));
build_opts.add_option("-DSCALE_OUT=" + float_to_string_with_full_precision(oq_info.scale));
}
+ _depth = src->dimension(2);
+
+ std::string kernel_name = "concatenate_height";
+
+ // A macro guard to compile ONLY the kernel of interest
+ build_opts.add_option("-D" + upper_string(kernel_name));
// Create kernel
- _kernel = create_kernel(compile_context, "concatenate_height", build_opts.options());
+ _kernel = create_kernel(compile_context, kernel_name, build_opts.options());
// Configure kernel window
// The window needs to be based on src as we copy all the heights of src
@@ -125,6 +130,7 @@ void ClHeightConcatenateKernel::run_op(ITensorPack &tensors, const Window &windo
unsigned int idx = 0;
add_4D_tensor_argument(idx, src, window);
add_4D_tensor_argument(idx, dst, window);
+ _kernel.setArg<cl_uint>(idx++, _depth);
enqueue(queue, *this, window, lws_hint());
}
} // namespace kernels