diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2017-12-22 15:27:52 +0000 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:49:16 +0000 |
commit | d8734b55d89f05901ba9a75349761a9c955d9243 (patch) | |
tree | e23d53a0fb73251f7416993e4d3a7241e533e79e /utils/GraphUtils.h | |
parent | 7390e05561a5c49306ebbf2eb2dcb1848546f201 (diff) | |
download | ComputeLibrary-d8734b55d89f05901ba9a75349761a9c955d9243.tar.gz |
COMPMID-793 : Add graph intermediate representation
Change-Id: Ic1685de4e19e0ac79669ef2da64e1dc96c7ea0bf
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/115248
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'utils/GraphUtils.h')
-rw-r--r-- | utils/GraphUtils.h | 24 |
1 files changed, 24 insertions, 0 deletions
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 <array> #include <random> #include <string> @@ -308,6 +312,26 @@ inline std::unique_ptr<graph::ITensorAccessor> get_output_accessor(const std::st return arm_compute::support::cpp14::make_unique<TopNPredictionsAccessor>(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 |