aboutsummaryrefslogtreecommitdiff
path: root/src/core/CL/CLHelpers.cpp
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2021-05-04 10:11:09 +0100
committerGeorgios Pinitas <georgios.pinitas@arm.com>2021-05-05 17:39:44 +0000
commit908f6163155e07e0c2e58c4d05389e0c68122e45 (patch)
tree74cf6a57b3569bf055f9a852a0ebaa2b33e2bcbc /src/core/CL/CLHelpers.cpp
parentef516e8bb8eb7f55b410268587f3b88b77e2fd8e (diff)
downloadComputeLibrary-908f6163155e07e0c2e58c4d05389e0c68122e45.tar.gz
Creates ClKerneLibrary to serve just as a kernel container without build logic
Moves all the kernels out of the legacy CLKernelLibrary into a separate class that its planned responsibility is to only handle the kernel strings. Currently CLKernelLibrary mixes kernel inventory and building logic, thus coupling multiple responsibilities. By separating compilation logic, the kernel library removes any dependencies from the OpenCL and simplifies maintainance but also increases flexibility. Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com> Change-Id: Idcd491783b5a413bd944d385956075ead0204362 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5572 Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com> Reviewed-by: Aleksandr Nikolaev <aleksandr.nikolaev@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core/CL/CLHelpers.cpp')
-rw-r--r--src/core/CL/CLHelpers.cpp30
1 files changed, 10 insertions, 20 deletions
diff --git a/src/core/CL/CLHelpers.cpp b/src/core/CL/CLHelpers.cpp
index aff897738a..6af378c7ab 100644
--- a/src/core/CL/CLHelpers.cpp
+++ b/src/core/CL/CLHelpers.cpp
@@ -22,12 +22,13 @@
* SOFTWARE.
*/
#include "arm_compute/core/CL/CLHelpers.h"
-#include "arm_compute/core/CL/CLCoreRuntimeContext.h"
-#include "arm_compute/core/CL/CLKernelLibrary.h"
#include "arm_compute/core/CL/CLTypes.h"
#include "arm_compute/core/Error.h"
#include "arm_compute/core/Log.h"
#include "arm_compute/core/Types.h"
+#include "src/core/gpu/cl/ClCompileContext.h"
+
+#include "src/core/gpu/cl/ClKernelLibrary.h"
#include <utility>
#include <vector>
@@ -386,26 +387,15 @@ size_t get_cl_image_pitch_alignment(const cl::Device &device)
}
}
-cl::Kernel create_opencl_kernel(CLCoreRuntimeContext *ctx, const std::string &kernel_name, const CLBuildOptions &build_opts)
-{
- if(ctx && ctx->kernel_library())
- {
- // New api going through the core context
- return static_cast<cl::Kernel>(ctx->kernel_library()->create_kernel(kernel_name, build_opts.options()));
- }
- else
- {
- // Legacy code through the singleton
- return static_cast<cl::Kernel>(CLKernelLibrary::get().create_kernel(kernel_name, build_opts.options()));
- }
-}
-
cl::Kernel create_kernel(const CLCompileContext &ctx, const std::string &kernel_name, const std::set<std::string> &build_opts)
{
- const std::string program_name = CLKernelLibrary::get().get_program_name(kernel_name);
- std::pair<std::string, bool> kernel_src = CLKernelLibrary::get().get_program(program_name);
- const std::string kernel_path = CLKernelLibrary::get().get_kernel_path();
- return static_cast<cl::Kernel>(ctx.create_kernel(kernel_name, program_name, kernel_src.first, kernel_path, build_opts, kernel_src.second));
+ opencl::ClKernelLibrary &klib = opencl::ClKernelLibrary::get();
+
+ const std::string program_name = klib.program_name(kernel_name);
+ auto kernel_src = klib.program(program_name);
+ const std::string kernel_path = klib.kernel_path();
+
+ return static_cast<cl::Kernel>(ctx.create_kernel(kernel_name, program_name, kernel_src.program, kernel_path, build_opts, kernel_src.is_binary));
}
cl::NDRange create_lws_hint_parallel_implementations(unsigned int input_dimension, unsigned int vector_size)