diff options
Diffstat (limited to 'src/common/IContext.h')
-rw-r--r-- | src/common/IContext.h | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/src/common/IContext.h b/src/common/IContext.h index 0d23abd2be..a221e5db61 100644 --- a/src/common/IContext.h +++ b/src/common/IContext.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Arm Limited. + * Copyright (c) 2021,2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -29,10 +29,11 @@ #include "src/common/utils/Object.h" #include <atomic> +#include <tuple> struct AclContext_ { - arm_compute::detail::Header header{ arm_compute::detail::ObjectType::Context, nullptr }; + arm_compute::detail::Header header{arm_compute::detail::ObjectType::Context, nullptr}; protected: AclContext_() = default; @@ -41,12 +42,16 @@ protected: namespace arm_compute { +// Forward declarations +class ITensorV2; +class IQueue; +class IOperator; + /**< Context interface */ class IContext : public AclContext_ { public: - IContext(Target target) - : AclContext_(), _target(target), _refcount(0) + IContext(Target target) : AclContext_(), _target(target), _refcount(0) { } /** Virtual Destructor */ @@ -88,6 +93,25 @@ public: { return header.type == detail::ObjectType::Context; } + /** Create a tensor object + * + * @param[in] desc Descriptor to use + * @param[in] allocate Flag to allocate tensor + * + * @return A pointer to the created tensor object + */ + virtual ITensorV2 *create_tensor(const AclTensorDescriptor &desc, bool allocate) = 0; + /** Create a queue object + * + * @param[in] options Queue options to be used + * + * @return A pointer to the created queue object + */ + virtual IQueue *create_queue(const AclQueueOptions *options) = 0; + virtual std::tuple<IOperator *, StatusCode> create_activation(const AclTensorDescriptor &src, + const AclTensorDescriptor &dst, + const AclActivationDescriptor &act, + bool is_validate) = 0; private: Target _target; /**< Target type of context */ @@ -115,7 +139,7 @@ namespace detail */ inline StatusCode validate_internal_context(const IContext *ctx) { - if(ctx == nullptr || !ctx->is_valid()) + if (ctx == nullptr || !ctx->is_valid()) { ARM_COMPUTE_LOG_ERROR_ACL("Invalid context object"); return StatusCode::InvalidArgument; |