diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2018-03-21 17:52:35 +0000 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:49:16 +0000 |
commit | 9a8c672dd6eb21448fbfb4b636104323d128de88 (patch) | |
tree | 345615b62b3941f2c2db442758fcc12269137156 /arm_compute | |
parent | 36a559e49a3d5b832b1cffd47f2298f452616bb9 (diff) | |
download | ComputeLibrary-9a8c672dd6eb21448fbfb4b636104323d128de88.tar.gz |
COMPMID-1011: Create struct for the graph config parameters
Change-Id: I9c164a817c0cc5f264a5c71a59256dacc6314cb0
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/125456
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'arm_compute')
-rw-r--r-- | arm_compute/graph2/GraphContext.h | 25 | ||||
-rw-r--r-- | arm_compute/graph2/Types.h | 9 | ||||
-rw-r--r-- | arm_compute/graph2/backends/Utils.h | 2 | ||||
-rw-r--r-- | arm_compute/graph2/frontend/Stream.h | 10 | ||||
-rw-r--r-- | arm_compute/graph2/frontend/Types.h | 1 |
5 files changed, 22 insertions, 25 deletions
diff --git a/arm_compute/graph2/GraphContext.h b/arm_compute/graph2/GraphContext.h index 72ed96e7a0..f38e25dd61 100644 --- a/arm_compute/graph2/GraphContext.h +++ b/arm_compute/graph2/GraphContext.h @@ -56,26 +56,18 @@ public: GraphContext &operator=(const GraphContext &) = delete; /** Default move assignment operator */ GraphContext &operator=(GraphContext &&) = default; - /** Enables tuning + /** Graph configuration accessor * - * @param[in] enable_tuning Enables tuning if true - */ - void enable_tuning(bool enable_tuning); - /** Checks if tuning is enabled - * - * @return True if tuning is enabled else false - */ - bool is_tuning_enabled() const; - /** Enables memory management + * @note Every alteration has to be done before graph finalization * - * @param[in] enable_mm Enables mm if true + * @return The graph configuration */ - void enable_memory_managenent(bool enable_mm); - /** Checks if memory management is enabled + const GraphConfig &config() const; + /** Sets graph configuration * - * @return True if memory management is enabled else false + * @param[in] config Configuration to use */ - bool is_memory_management_enabled(); + void set_config(const GraphConfig &config); /** Inserts a memory manager context * * @param[in] memory_ctx Memory manage context @@ -94,8 +86,7 @@ public: void finalize(); private: - bool _tunable; /**< Specifies if the Graph should use a tunable object */ - bool _memory_managed; /**< Specifies if the Graph should use a memory managed */ + GraphConfig _config; /**< Graph configuration */ std::map<Target, MemoryManagerContext> _memory_managers; /**< Memory managers for each target */ }; } // namespace graph2 diff --git a/arm_compute/graph2/Types.h b/arm_compute/graph2/Types.h index 4cbfc7267b..b619cf1673 100644 --- a/arm_compute/graph2/Types.h +++ b/arm_compute/graph2/Types.h @@ -71,6 +71,15 @@ constexpr EdgeID EmptyEdgeID = std::numeric_limits<EdgeID>::max(); // Forward declarations class TensorDescriptor; +/** Graph configuration structure */ +struct GraphConfig +{ + bool use_function_memory_manager{ false }; /**< Use a memory manager to manage per-funcion auxilary memory */ + bool use_transition_memory_manager{ false }; /**< Use a memory manager to manager transition buffer memory */ + bool use_tuner{ false }; /**< Use a tuner in tunable backends */ + unsigned int num_threads{ 0 }; /**< Number of threads to use (thread capable backends), if 0 the backend will auto-initialize */ +}; + /**< Data layout format */ enum class DataLayout { diff --git a/arm_compute/graph2/backends/Utils.h b/arm_compute/graph2/backends/Utils.h index cc6f5163f2..bba75757eb 100644 --- a/arm_compute/graph2/backends/Utils.h +++ b/arm_compute/graph2/backends/Utils.h @@ -87,7 +87,7 @@ inline bool is_in_place_operation(void *input, void *output) */ inline std::shared_ptr<IMemoryManager> get_memory_manager(GraphContext &ctx, Target target) { - bool enabled = ctx.is_memory_management_enabled() && (ctx.memory_management_ctx(target) != nullptr); + bool enabled = ctx.config().use_function_memory_manager && (ctx.memory_management_ctx(target) != nullptr); return enabled ? ctx.memory_management_ctx(target)->mm : nullptr; } } // namespace backends diff --git a/arm_compute/graph2/frontend/Stream.h b/arm_compute/graph2/frontend/Stream.h index 6100975958..bfefe12225 100644 --- a/arm_compute/graph2/frontend/Stream.h +++ b/arm_compute/graph2/frontend/Stream.h @@ -61,14 +61,10 @@ public: Stream &operator=(Stream &&) = default; /** Finalizes the stream for an execution target * - * @note enable_tuning only works if the target is OpenCL. - * @note tuning increases the execution time of first run of the graph - * - * @param[in] target Execution target - * @param[in] enable_tuning (Optional) Enables the tuning interface. Defaults to false - * @param[in] enable_memory_management (Optional) Enables the memory management interface. Defaults to false + * @param[in] target Execution target + * @param[in] config (Optional) Graph configuration to use */ - void finalize(Target target, bool enable_tuning = false, bool enable_memory_management = false); + void finalize(Target target, const GraphConfig &config); /** Executes the stream **/ void run(); diff --git a/arm_compute/graph2/frontend/Types.h b/arm_compute/graph2/frontend/Types.h index 234b998126..d433d1547b 100644 --- a/arm_compute/graph2/frontend/Types.h +++ b/arm_compute/graph2/frontend/Types.h @@ -47,6 +47,7 @@ using graph2::ConvolutionMethod; using graph2::DepthwiseConvolutionMethod; using graph2::TensorDescriptor; using graph2::DimensionRoundingType; +using graph2::GraphConfig; /** Branch layer merging method */ enum class BranchMergeMethod |