From d8734b55d89f05901ba9a75349761a9c955d9243 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Fri, 22 Dec 2017 15:27:52 +0000 Subject: COMPMID-793 : Add graph intermediate representation Change-Id: Ic1685de4e19e0ac79669ef2da64e1dc96c7ea0bf Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/115248 Tested-by: Jenkins Reviewed-by: Anthony Barbier --- utils/GraphUtils.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'utils') diff --git a/utils/GraphUtils.h b/utils/GraphUtils.h index cc6f40417e..b4c3ad8afa 100644 --- a/utils/GraphUtils.h +++ b/utils/GraphUtils.h @@ -29,6 +29,10 @@ #include "arm_compute/graph/ITensorAccessor.h" #include "arm_compute/graph/Types.h" +#include "arm_compute/core/CL/OpenCL.h" + +#include "arm_compute/graph2/Types.h" + #include #include #include @@ -308,6 +312,26 @@ inline std::unique_ptr get_output_accessor(const std::st return arm_compute::support::cpp14::make_unique(labels_path, top_n, output_stream); } } + +/** Utility function to return the TargetHint + * + * @param[in] target Integer value which expresses the selected target. Must be 0 for NEON or 1 for OpenCL or 2 (OpenCL with Tuner) + * + * @return the TargetHint + */ +inline graph2::Target set_target_hint2(int target) +{ + ARM_COMPUTE_ERROR_ON_MSG(target > 2, "Invalid target. Target must be 0 (NEON) or 1 (OpenCL)"); + if((target == 1 || target == 2) && arm_compute::opencl_is_available()) + { + // If type of target is OpenCL, check if OpenCL is available and initialize the scheduler + return graph2::Target::CL; + } + else + { + return graph2::Target::NEON; + } +} } // namespace graph_utils } // namespace arm_compute -- cgit v1.2.1