diff options
Diffstat (limited to 'arm_compute/core')
-rw-r--r-- | arm_compute/core/CPP/CPPTypes.h | 41 | ||||
-rw-r--r-- | arm_compute/core/Types.h | 4 |
2 files changed, 43 insertions, 2 deletions
diff --git a/arm_compute/core/CPP/CPPTypes.h b/arm_compute/core/CPP/CPPTypes.h index 9ffb4840a3..0ac8bf6e52 100644 --- a/arm_compute/core/CPP/CPPTypes.h +++ b/arm_compute/core/CPP/CPPTypes.h @@ -26,6 +26,7 @@ #include "arm_compute/core/Error.h" +#include <array> #include <string> #include <vector> @@ -46,6 +47,19 @@ enum class CPUModel A55r1 }; +/** Global memory policy. + * The functions in the runtime will use different strategies based on the policy currently set. + * + * MINIMIZE will try to reduce the amount allocated by the functions at the expense of performance normally. + * NORMAL won't try to save any memory and will favor speed over memory consumption + * + */ +enum class MemoryPolicy +{ + MINIMIZE, + NORMAL +}; + /** Convert a cpumodel value to a string * * @param val CPUModel value to be converted @@ -180,6 +194,33 @@ private: unsigned int _L2_cache_size = 262144; }; +class MEMInfo final +{ +public: + MEMInfo(); + + /** Return the total amount of RAM memory in the system expressed in KB. + * + * @return Total memory + */ + size_t get_total_in_kb() const; + + static void set_policy(MemoryPolicy policy); + static MemoryPolicy get_policy(); + + /** Common memory sizes expressed in Kb to avoid having them + * duplicated throughout the code. + */ + static const size_t ONE_GB_IN_KB = { 1035842 }; + static const size_t TWO_GB_IN_KB = { ONE_GB_IN_KB * 2 }; + +private: + size_t _total; + size_t _free; + size_t _buffer; + static MemoryPolicy _policy; +}; + /** Information about executing thread and CPU. */ struct ThreadInfo { diff --git a/arm_compute/core/Types.h b/arm_compute/core/Types.h index 0240916da8..8df5c65e1e 100644 --- a/arm_compute/core/Types.h +++ b/arm_compute/core/Types.h @@ -940,8 +940,8 @@ public: * @param[in] weights (Optional)Weights [wx, wy, ww, wh] for the deltas. Defaults to all ones * @param[in] bbox_xform_clip (Optional)Minimum bounding box width and height after bounding box transformation in log-space. Defaults to log(1000/16) */ - BoundingBoxTransformInfo(float img_width, float img_height, float scale, bool apply_scale = false, const std::array<float, 4> weights = { 1.0, 1.0, 1.0, 1.0 }, float bbox_xform_clip = - 4.135166556742356) + BoundingBoxTransformInfo(float img_width, float img_height, float scale, bool apply_scale = false, const std::array<float, 4> weights = { { 1.f, 1.f, 1.f, 1.f } }, float bbox_xform_clip = + 4.135166556742356f) : _img_width(img_width), _img_height(img_height), _scale(scale), _apply_scale(apply_scale), _weights(weights), _bbox_xform_clip(bbox_xform_clip) { } |