From 4841c97170b85be0706b65d424e967e561cef932 Mon Sep 17 00:00:00 2001 From: SiCong Li Date: Wed, 3 Feb 2021 12:17:35 +0000 Subject: Add mlgo to graph examples Resolves COMPMID-3847 Change-Id: I99f73bfc8eda66e8ce1dd1f2a18be76e9d826569 Signed-off-by: SiCong Li Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5033 Reviewed-by: Georgios Pinitas Tested-by: Arm Jenkins Comments-Addressed: Arm Jenkins --- src/graph/backends/CL/CLDeviceBackend.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/graph/backends/CL/CLDeviceBackend.cpp') diff --git a/src/graph/backends/CL/CLDeviceBackend.cpp b/src/graph/backends/CL/CLDeviceBackend.cpp index 50dd799ee1..f8e22ca7a0 100644 --- a/src/graph/backends/CL/CLDeviceBackend.cpp +++ b/src/graph/backends/CL/CLDeviceBackend.cpp @@ -65,7 +65,7 @@ bool file_exists(const std::string &filename) static detail::BackendRegistrar CLDeviceBackend_registrar(Target::CL); CLDeviceBackend::CLDeviceBackend() - : _context_count(0), _tuner(), _allocator(nullptr), _tuner_file() + : _context_count(0), _tuner(), _gemm_heuristics(), _allocator(nullptr), _tuner_file() { } @@ -87,7 +87,7 @@ void CLDeviceBackend::set_kernel_tuning_mode(CLTunerMode tuning_mode) void CLDeviceBackend::initialize_backend() { // Setup Scheduler - CLScheduler::get().default_init(&_tuner); + CLScheduler::get().default_init(&_tuner, &_gemm_heuristics); // Create allocator with new context _allocator = std::make_unique(nullptr /* legacy path for CLCoreRuntimeContext */); } @@ -123,6 +123,10 @@ void CLDeviceBackend::setup_backend_context(GraphContext &ctx) set_kernel_tuning(ctx.config().use_tuner); set_kernel_tuning_mode(ctx.config().tuner_mode); + // Attempt to load mlgo heuristics + ARM_COMPUTE_ERROR_ON(CLScheduler::get().gemm_heuristics() == nullptr); + CLScheduler::get().gemm_heuristics()->reload_from_file(ctx.config().mlgo_file); + // Setup a management backend if(ctx.memory_management_ctx(Target::CL) == nullptr) { -- cgit v1.2.1