aboutsummaryrefslogtreecommitdiff
path: root/arm_compute
diff options
context:
space:
mode:
Diffstat (limited to 'arm_compute')
-rw-r--r--arm_compute/graph2/GraphContext.h25
-rw-r--r--arm_compute/graph2/Types.h9
-rw-r--r--arm_compute/graph2/backends/Utils.h2
-rw-r--r--arm_compute/graph2/frontend/Stream.h10
-rw-r--r--arm_compute/graph2/frontend/Types.h1
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