aboutsummaryrefslogtreecommitdiff
path: root/arm_compute
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2021-01-12 15:51:07 +0000
committerGeorgios Pinitas <georgios.pinitas@arm.com>2021-02-25 08:05:31 +0000
commit8a5146fb5cc17d101e3b6c86654f5aca81e60335 (patch)
treef5ab3e60d33ebad7c771828810bcd6d4a914508f /arm_compute
parente5f2e7472725da11c14f3d6023a9c2d7b14e2ebd (diff)
downloadComputeLibrary-8a5146fb5cc17d101e3b6c86654f5aca81e60335.tar.gz
Introduce Context opaque object of the new interface
An AclContext is introduced as part of the new interface. This object is responsible for any constructural services that the operators and other objects might need. Main options that can be passed to a context object are: - a target: for which all the subsequent object should bind with - capabilities: which are the isa/target features to enable - a mode: for which different strategies can be selected in the backend Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com> Change-Id: I315549e55d4d064cbe94dfa29d070dc281b447de Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5088 Tested-by: Arm Jenkins <bsgcomp@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute')
-rw-r--r--arm_compute/Acl.h39
-rw-r--r--arm_compute/Acl.hpp381
-rw-r--r--arm_compute/AclEntrypoints.h68
-rw-r--r--arm_compute/AclOpenClExt.h69
-rw-r--r--arm_compute/AclTypes.h151
-rw-r--r--arm_compute/AclVersion.h56
6 files changed, 764 insertions, 0 deletions
diff --git a/arm_compute/Acl.h b/arm_compute/Acl.h
new file mode 100644
index 0000000000..6958f60bfd
--- /dev/null
+++ b/arm_compute/Acl.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2021 Arm Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_ACL_H_
+#define ARM_COMPUTE_ACL_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* Core headers */
+#include "arm_compute/AclEntrypoints.h"
+#include "arm_compute/AclTypes.h"
+#include "arm_compute/AclVersion.h"
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* ARM_COMPUTE_ACL_H_ */
diff --git a/arm_compute/Acl.hpp b/arm_compute/Acl.hpp
new file mode 100644
index 0000000000..b74e65430c
--- /dev/null
+++ b/arm_compute/Acl.hpp
@@ -0,0 +1,381 @@
+/*
+ * Copyright (c) 2021 Arm Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_ACL_HPP_
+#define ARM_COMPUTE_ACL_HPP_
+
+#include "arm_compute/Acl.h"
+
+#include <cstdlib>
+#include <memory>
+#include <string>
+
+#if defined(ARM_COMPUTE_EXCEPTIONS_ENABLED)
+#include <exception>
+#endif /* defined(ARM_COMPUTE_EXCEPTIONS_ENABLED) */
+
+// Helper Macros
+#define ARM_COMPUTE_IGNORE_UNUSED(x) (void)(x)
+
+namespace acl
+{
+// Forward declarations
+class Context;
+
+/**< Status code enum */
+enum class StatusCode
+{
+ Success = AclSuccess,
+ RuntimeError = AclRuntimeError,
+ OutOfMemory = AclOutOfMemory,
+ Unimplemented = AclUnimplemented,
+ UnsupportedTarget = AclUnsupportedTarget,
+ InvalidArgument = AclInvalidArgument,
+ InvalidTarget = AclInvalidTarget,
+ UnsupportedConfig = AclUnsupportedConfig,
+ InvalidObjectState = AclInvalidObjectState,
+};
+
+/**< Utility namespace containing helpers functions */
+namespace detail
+{
+/** Construct to handle destruction of objects
+ *
+ * @tparam T Object base type
+ */
+template <typename T>
+struct ObjectDeleter
+{
+};
+
+#define OBJECT_DELETER(obj, func) \
+ template <> \
+ struct ObjectDeleter<obj> \
+ \
+ { \
+ static inline AclStatus Destroy(obj v) \
+ { \
+ return func(v); \
+ } \
+ };
+
+OBJECT_DELETER(AclContext, AclDestroyContext)
+
+#undef OBJECT_DELETER
+
+/** Convert a strongly typed enum to an old plain c enum
+ *
+ * @tparam E Plain old C enum
+ * @tparam SE Strongly typed resulting enum
+ *
+ * @param[in] v Value to convert
+ *
+ * @return A corresponding plain old C enumeration
+ */
+template <typename E, typename SE>
+constexpr E as_cenum(SE v) noexcept
+{
+ return static_cast<E>(static_cast<typename std::underlying_type<SE>::type>(v));
+}
+
+/** Convert plain old enumeration to a strongly typed enum
+ *
+ * @tparam SE Strongly typed resulting enum
+ * @tparam E Plain old C enum
+ *
+ * @param[in] val Value to convert
+ *
+ * @return A corresponding strongly typed enumeration
+ */
+template <typename SE, typename E>
+constexpr SE as_enum(E val) noexcept
+{
+ return static_cast<SE>(val);
+}
+
+/** Object base class for library objects
+ *
+ * Class is defining basic common interface for all the library objects
+ *
+ * @tparam T Object type to be templated on
+ */
+template <typename T>
+class ObjectBase
+{
+public:
+ /** Destructor */
+ ~ObjectBase() = default;
+ /** Copy constructor */
+ ObjectBase(const ObjectBase<T> &) = default;
+ /** Move Constructor */
+ ObjectBase(ObjectBase<T> &&) = default;
+ /** Copy assignment operator */
+ ObjectBase<T> &operator=(const ObjectBase<T> &) = default;
+ /** Move assignment operator */
+ ObjectBase<T> &operator=(ObjectBase<T> &&) = default;
+ /** Reset object value
+ *
+ * @param [in] val Value to set
+ */
+ void reset(T *val)
+ {
+ _object.reset(val, detail::ObjectDeleter<T *>::Destroy);
+ }
+ /** Access uderlying object
+ *
+ * @return Underlying object
+ */
+ const T *get() const
+ {
+ return _object.get();
+ }
+ /** Access uderlying object
+ *
+ * @return Underlying object
+ */
+ T *get()
+ {
+ return _object.get();
+ }
+
+protected:
+ /** Constructor */
+ ObjectBase() = default;
+
+protected:
+ std::shared_ptr<T> _object{ nullptr }; /**< Library object */
+};
+
+/** Equality operator for library object
+ *
+ * @tparam T Parameter to template on
+ *
+ * @param[in] lhs Left hand-side argument
+ * @param[in] rhs Right hand-side argument
+ *
+ * @return True if objects are equal, else false
+ */
+template <typename T>
+bool operator==(const ObjectBase<T> &lhs, const ObjectBase<T> &rhs)
+{
+ return lhs.get() == rhs.get();
+}
+
+/** Inequality operator for library object
+ *
+ * @tparam T Parameter to template on
+ *
+ * @param[in] lhs Left hand-side argument
+ * @param[in] rhs Right hand-side argument
+ *
+ * @return True if objects are equal, else false
+ */
+template <typename T>
+bool operator!=(const ObjectBase<T> &lhs, const ObjectBase<T> &rhs)
+{
+ return !(lhs == rhs);
+}
+} // namespace detail
+
+#if defined(ARM_COMPUTE_EXCEPTIONS_ENABLED)
+/** Status class
+ *
+ * Class is an extension of std::exception and contains the underlying
+ * status construct and an error explanatory message to be reported.
+ *
+ * @note Class is visible only when exceptions are enabled during compilation
+ */
+class Status : public std::exception
+{
+public:
+ /** Constructor
+ *
+ * @param[in] status Status returned
+ * @param[in] msg Error message to be bound with the exception
+ */
+ Status(StatusCode status, const std::string &msg)
+ : _status(status), _msg(msg)
+ {
+ }
+ /** Returns an explanatory exception message
+ *
+ * @return Status message
+ */
+ const char *what() const noexcept override
+ {
+ return _msg.c_str();
+ }
+ /** Underlying status accessor
+ *
+ * @return Status code
+ */
+ StatusCode status() const
+ {
+ return _status;
+ }
+ /** Explicit status converter
+ *
+ * @return Status code
+ */
+ explicit operator StatusCode() const
+ {
+ return _status;
+ }
+
+private:
+ StatusCode _status; /**< Status code */
+ std::string _msg; /**< Status message */
+};
+
+/** Reports an error status and throws an exception object in case of failure
+ *
+ * @note This implementation is used when exceptions are enabled during compilation
+ *
+ * @param[in] status Status to report
+ * @param[in] msg Explanatory error messaged
+ *
+ * @return Status code
+ */
+static inline StatusCode report_status(StatusCode status, const std::string &msg)
+{
+ if(status != StatusCode::Success)
+ {
+ throw Status(status, msg);
+ }
+ return status;
+}
+#else /* defined(ARM_COMPUTE_EXCEPTIONS_ENABLED) */
+/** Reports a status code
+ *
+ * @note This implementation is used when exceptions are disabled during compilation
+ * @note Message is surpressed and not reported in this case
+ *
+ * @param[in] status Status to report
+ * @param[in] msg Explanatory error messaged
+ *
+ * @return Status code
+ */
+static inline StatusCode report_status(StatusCode status, const std::string &msg)
+{
+ ARM_COMPUTE_IGNORE_UNUSED(msg);
+ return status;
+}
+#endif /* defined(ARM_COMPUTE_EXCEPTIONS_ENABLED) */
+
+/**< Target enum */
+enum class Target
+{
+ Cpu = AclCpu, /**< Cpu target that leverages SIMD */
+ GpuOcl = AclGpuOcl /**< Gpu target that leverages OpenCL */
+};
+
+/**< Available execution modes */
+enum class ExecutionMode
+{
+ FastRerun = AclPreferFastRerun, /**< Prefer minimum latency in consecutive runs, might introduce higher startup times */
+ FastStart = AclPreferFastStart, /**< Prefer minimizing startup time */
+};
+
+/** Context class
+ *
+ * Context acts as a central aggregate service for further objects created from it.
+ * It provides, internally, common facilities in order to avoid the use of global
+ * statically initialized objects that can lead to important side-effect under
+ * specific execution contexts.
+ *
+ * For example context contains allocators for object creation, for further backing memory allocation,
+ * any serialization interfaces and other modules that affect the construction of objects,
+ * like program caches for OpenCL.
+ */
+class Context : public detail::ObjectBase<AclContext_>
+{
+public:
+ /**< Context options */
+ struct Options
+ {
+ /** Default Constructor
+ *
+ * @note By default no precision loss is enabled for operators
+ * @note By default the preferred execution mode is to favor multiple consecutive reruns of an operator
+ */
+ Options() = default;
+ /** Constructor
+ *
+ * @param[in] mode Execution mode to be used
+ * @param[in] caps Capabilities to be used
+ * @param[in] enable_fast_math Allow precision loss in favor of performance
+ * @param[in] kernel_config Kernel configuration file containing construction tuning meta-data
+ * @param[in] max_compute_units Max compute units that are expected to used
+ * @param[in] allocator Allocator to be used for internal memory allocation
+ */
+ Options(ExecutionMode mode,
+ AclTargetCapabilities caps,
+ bool enable_fast_math,
+ const char *kernel_config,
+ int32_t max_compute_units,
+ AclAllocator *allocator)
+ {
+ opts.mode = detail::as_cenum<AclExecutionMode>(mode);
+ opts.capabilities = caps;
+ opts.enable_fast_math = enable_fast_math;
+ opts.kernel_config_file = kernel_config;
+ opts.max_compute_units = max_compute_units;
+ opts.allocator = allocator;
+ }
+ AclContextOptions opts{ acl_default_ctx_options };
+ };
+
+public:
+ /** Constructor
+ *
+ * @note Serves as a simpler delegate constructor
+ * @note As context options, default conservative options will be used
+ *
+ * @param[in] target Target to create context for
+ * @param[out] status Status information if requested
+ */
+ explicit Context(Target target, StatusCode *status = nullptr)
+ : Context(target, Options(), status)
+ {
+ }
+ /** Constructor
+ *
+ * @param[in] target Target to create context for
+ * @param[in] options Context construction options
+ * @param[out] status Status information if requested
+ */
+ Context(Target target, const Options &options, StatusCode *status = nullptr)
+ {
+ AclContext ctx;
+ const auto st = detail::as_enum<StatusCode>(AclCreateContext(&ctx, detail::as_cenum<AclTarget>(target), &options.opts));
+ reset(ctx);
+ report_status(st, "Failure during context creation");
+ if(status)
+ {
+ *status = st;
+ }
+ }
+};
+} // namespace acl
+#undef ARM_COMPUTE_IGNORE_UNUSED
+#endif /* ARM_COMPUTE_ACL_HPP_ */
diff --git a/arm_compute/AclEntrypoints.h b/arm_compute/AclEntrypoints.h
new file mode 100644
index 0000000000..02e072f826
--- /dev/null
+++ b/arm_compute/AclEntrypoints.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2021 Arm Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_ACLENTRYPOINTS_H_
+#define ARM_COMPUTE_ACLENTRYPOINTS_H_
+
+#include "arm_compute/AclTypes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /** __cplusplus */
+
+/** Create a context object
+ *
+ * Context is responsible for retaining internal information and work as an aggregate service mechanism
+ *
+ * @param[in, out] ctx A valid non-zero context object if no failure occurs
+ * @param[in] target Target to create the context for
+ * @param[in] options Context options to be used for all the kernels that are created under the context
+ *
+ * @return Status code
+ *
+ * Returns:
+ * - @ref AclSuccess if function was completed successfully
+ * - @ref AclOutOfMemory if there was a failure allocating memory resources
+ * - @ref AclUnsupportedTarget if the requested target is unsupported
+ * - @ref AclInvalidArgument if a given argument is invalid
+ */
+AclStatus AclCreateContext(AclContext *ctx,
+ AclTarget target,
+ const AclContextOptions *options);
+
+/** Destroy a given context object
+ *
+ * @param[in] ctx A valid context object to destroy
+ *
+ * @return Status code
+ *
+ * Returns:
+ * - @ref AclSuccess if functions was completed successfully
+ * - @ref AclInvalidArgument if the provided context is invalid
+ */
+AclStatus AclDestroyContext(AclContext ctx);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* ARM_COMPUTE_ACLENTRYPOINTS_H_ */
diff --git a/arm_compute/AclOpenClExt.h b/arm_compute/AclOpenClExt.h
new file mode 100644
index 0000000000..f71cd37299
--- /dev/null
+++ b/arm_compute/AclOpenClExt.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2021 Arm Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_ACLOPENCLEXT_H_
+#define ARM_COMPUTE_ACLOPENCLEXT_H_
+
+#include "arm_compute/AclTypes.h"
+
+#ifndef CL_TARGET_OPENCL_VERSION
+#define CL_TARGET_OPENCL_VERSION 200
+#define CL_USE_DEPRECATED_OPENCL_1_1_APIS
+#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
+#endif /* CL_TARGET_OPENCL_VERSION */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Weffc++"
+#include "include/CL/cl.h"
+#pragma GCC diagnostic pop
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/** Extract the underlying OpenCL context used by a given Compute Library context object
+ *
+ * @note @ref AclContext should be of an OpenCL backend target
+ * @note @ref AclContext refcount should be 0, meaning not used by other objects
+ *
+ * @param[in] ctx A valid non-zero context
+ * @param[out] opencl_context Underlying OpenCL context used
+ *
+ * @return Status code
+ */
+AclStatus AclGetClContext(AclContext ctx, cl_context *opencl_context);
+
+/** Set the underlying OpenCL context used by a given Compute Library context object
+ *
+ * @note @ref AclContext should be of an OpenCL backend target
+ *
+ * @param[in] ctx A valid non-zero context object
+ * @param[out] opencl_context Underlying OpenCL context to be used
+ *
+ * @return Status code
+ */
+AclStatus AclSetClContext(AclContext ctx, cl_context opencl_context);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* ARM_COMPUTE_ACLOPENCLEXT_H_ */
diff --git a/arm_compute/AclTypes.h b/arm_compute/AclTypes.h
new file mode 100644
index 0000000000..3b022b7106
--- /dev/null
+++ b/arm_compute/AclTypes.h
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2021 Arm Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_ACLTYPES_H_
+#define ARM_COMPUTE_ACLTYPES_H_
+
+#include <stddef.h>
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**< Opaque Context object */
+typedef struct AclContext_ *AclContext;
+
+// Capabilities bitfield (Note: if multiple are enabled ComputeLibrary will pick the best possible)
+typedef uint64_t AclTargetCapabilities;
+
+/**< Error codes returned by the public entry-points */
+typedef enum AclStatus : int32_t
+{
+ AclSuccess = 0, /**< Call succeeded, leading to valid state for all involved objects/data */
+ AclRuntimeError = 1, /**< Call failed during execution */
+ AclOutOfMemory = 2, /**< Call failed due to failure to allocate resources */
+ AclUnimplemented = 3, /**< Call failed as requested capability is not implemented */
+ AclUnsupportedTarget = 4, /**< Call failed as an invalid backend was requested */
+ AclInvalidTarget = 5, /**< Call failed as invalid argument was passed */
+ AclInvalidArgument = 6, /**< Call failed as invalid argument was passed */
+ AclUnsupportedConfig = 7, /**< Call failed as configuration is unsupported */
+ AclInvalidObjectState = 8, /**< Call failed as an object has invalid state */
+} AclStatus;
+
+/**< Supported CPU targets */
+typedef enum AclTarget
+{
+ AclCpu = 0, /**< Cpu target that uses SIMD extensions */
+ AclGpuOcl = 1, /**< OpenCL target for GPU */
+} AclTarget;
+
+/** Execution mode types */
+typedef enum AclExecutionMode
+{
+ AclPreferFastRerun = 0, /**< Prioritize performance when multiple iterations are performed */
+ AclPreferFastStart = 1, /**< Prioritize performance when a single iterations is expected to be performed */
+} AclExecutionMode;
+
+/** Available CPU capabilities */
+typedef enum AclCpuCapabalities
+{
+ AclCpuCapabilitiesAuto = 0, /**< Automatic discovery of capabilities */
+
+ AclCpuCapabilitiesNeon = (1 << 0), /**< Enable NEON optimized paths */
+ AclCpuCapabilitiesSve = (1 << 1), /**< Enable SVE optimized paths */
+ AclCpuCapabilitiesSve2 = (1 << 2), /**< Enable SVE2 optimized paths */
+ // Reserve 3, 4, 5, 6
+
+ AclCpuCapabilitiesFp16 = (1 << 7), /**< Enable float16 data-type support */
+ AclCpuCapabilitiesBf16 = (1 << 8), /**< Enable bfloat16 data-type support */
+ // Reserve 9, 10, 11, 12
+
+ AclCpuCapabilitiesDot = (1 << 13), /**< Enable paths that use the udot/sdot instructions */
+ AclCpuCapabilitiesMmlaInt8 = (1 << 14), /**< Enable paths that use the mmla integer instructions */
+ AclCpuCapabilitiesMmlaFp = (1 << 15), /**< Enable paths that use the mmla float instructions */
+
+ AclCpuCapabilitiesAll = ~0 /**< Enable all paths */
+} AclCpuCapabalities;
+
+/**< Allocator interface that can be passed to a context */
+typedef struct AclAllocator
+{
+ /** Allocate a block of size bytes of memory.
+ *
+ * @param[in] user_data User provided data that can be used by the allocator
+ * @param[in] size Size of the allocation
+ *
+ * @return A pointer to the allocated block if successfull else NULL
+ */
+ void *(*alloc)(void *user_data, size_t size);
+ /** Release a block of size bytes of memory.
+ *
+ * @param[in] user_data User provided data that can be used by the allocator
+ * @param[in] size Size of the allocation
+ */
+ void (*free)(void *user_data, void *ptr);
+ /** Allocate a block of size bytes of memory.
+ *
+ * @param[in] user_data User provided data that can be used by the allocator
+ * @param[in] size Size of the allocation
+ *
+ * @return A pointer to the allocated block if successfull else NULL
+ */
+ void *(*aligned_alloc)(void *user_data, size_t size, size_t alignment);
+ /** Allocate a block of size bytes of memory.
+ *
+ * @param[in] user_data User provided data that can be used by the allocator
+ * @param[in] size Size of the allocation
+ */
+ void (*aligned_free)(void *user_data, void *ptr);
+
+ /**< User provided information */
+ void *user_data;
+} AclAllocator;
+
+/**< Context options */
+typedef struct AclContextOptions
+{
+ AclExecutionMode mode; /**< Execution mode to use */
+ AclTargetCapabilities capabilities; /**< Target capabilities */
+ bool enable_fast_math; /**< Allow precision loss */
+ const char *kernel_config_file; /**< Kernel cofiguration file */
+ int32_t max_compute_units; /**< Max compute units that can be used by a queue created from the context.
+ If <=0 the system will use the hw concurency insted */
+ AclAllocator *allocator; /**< Allocator to be used by all the memory internally */
+} AclContextOptions;
+
+/** Default context */
+const AclContextOptions acl_default_ctx_options =
+{
+ AclPreferFastRerun, /* mode */
+ AclCpuCapabilitiesAuto, /* capabilities */
+ false, /* enable_fast_math */
+ "default.mlgo", /* kernel_config_file */
+ -1, /* max_compute_units */
+ nullptr /* allocator */
+};
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* ARM_COMPUTE_ACLTYPES_H_ */
diff --git a/arm_compute/AclVersion.h b/arm_compute/AclVersion.h
new file mode 100644
index 0000000000..3a2f30791d
--- /dev/null
+++ b/arm_compute/AclVersion.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2021 Arm Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_ACLVERSION_H_
+#define ARM_COMPUTE_ACLVERSION_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/** Semantic versioning information */
+typedef struct AclVersion
+{
+ int major; /**< Major version, is increased on API incompatible changes */
+ int minor; /**< Minor version, is increased on adding back-ward compatible functionality */
+ int patch; /**< Patch version, is increased when doing backward compatible fixes */
+ const char *build_info; /**< Build related information */
+} AclVersion;
+
+/**< Major version, is increased on API incompatible changes */
+#define ARM_COMPUTE_LIBRARY_VERSION_MAJOR 0
+/**< Minor version, is increased on adding back-ward compatible functionality */
+#define ARM_COMPUTE_LIBRARY_VERSION_MINOR 1
+/**< Patch version, is increased when doing backward compatible fixes */
+#define ARM_COMPUTE_LIBRARY_VERSION_PATCH 0
+
+/** Get library's version meta-data
+ *
+ * @return Version information
+ */
+const AclVersion *AclVersionInfo();
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* ARM_COMPUTE_ACLVERSION_H_ */