Compute Library
 22.02
AclQueue.cpp File Reference

Go to the source code of this file.

Functions

AclStatus AclCreateQueue (AclQueue *external_queue, AclContext external_ctx, const AclQueueOptions *options)
 Create an operator queue. More...
 
AclStatus AclQueueFinish (AclQueue external_queue)
 Wait until all elements on the queue have been completed. More...
 
AclStatus AclDestroyQueue (AclQueue external_queue)
 Destroy a given queue object. More...
 

Function Documentation

◆ AclCreateQueue()

AclStatus AclCreateQueue ( AclQueue queue,
AclContext  ctx,
const AclQueueOptions options 
)

Create an operator queue.

Queue is responsible for any scheduling related activities

Parameters
[in,out]queueA valid non-zero queue object is not failures occur
[in]ctxContext to be used
[in]optionsQueue options to be used for the operators using the queue
Returns
Status code

Returns:

Definition at line 45 of file AclQueue.cpp.

References AclInvalidArgument, AclOutOfMemory, AclSuccess, ARM_COMPUTE_LOG_ERROR_ACL, ARM_COMPUTE_RETURN_CENUM_ON_FAILURE, arm_compute::get_internal(), and arm_compute::detail::validate_internal_context().

Referenced by Queue::Queue().

46 {
47  using namespace arm_compute;
48 
49  auto ctx = get_internal(external_ctx);
50 
53 
54  if(options != nullptr && !is_mode_valid(options))
55  {
56  ARM_COMPUTE_LOG_ERROR_ACL("Queue options are invalid");
57  return AclInvalidArgument;
58  }
59 
60  auto queue = ctx->create_queue(options);
61  if(queue == nullptr)
62  {
63  ARM_COMPUTE_LOG_ERROR_ACL("Couldn't allocate internal resources");
64  return AclOutOfMemory;
65  }
66 
67  *external_queue = queue;
68 
69  return AclSuccess;
70 }
#define ARM_COMPUTE_RETURN_CENUM_ON_FAILURE(status)
Definition: Macros.h:29
StatusCode validate_internal_context(const IContext *ctx)
Check if an internal context is valid.
Definition: IContext.h:140
#define ARM_COMPUTE_LOG_ERROR_ACL(msg)
Log an error message to the logger.
Definition: Log.h:77
Copyright (c) 2017-2021 Arm Limited.
Call failed as invalid argument was passed.
Definition: AclTypes.h:57
Call succeeded, leading to valid state for all involved objects/data.
Definition: AclTypes.h:51
StatusCode
Definition: Types.h:32
Call failed due to failure to allocate resources.
Definition: AclTypes.h:53
IContext * get_internal(AclContext ctx)
Extract internal representation of a Context.
Definition: IContext.h:127

◆ AclDestroyQueue()

AclStatus AclDestroyQueue ( AclQueue  queue)

Destroy a given queue object.

Parameters
[in]queueA valid context object to destroy
Returns
Status code

Returns:

Definition at line 87 of file AclQueue.cpp.

References AclSuccess, ARM_COMPUTE_RETURN_CENUM_ON_FAILURE, arm_compute::get_internal(), and arm_compute::detail::validate_internal_queue().

88 {
89  using namespace arm_compute;
90 
91  auto queue = get_internal(external_queue);
92 
95 
96  delete queue;
97 
98  return AclSuccess;
99 }
#define ARM_COMPUTE_RETURN_CENUM_ON_FAILURE(status)
Definition: Macros.h:29
Copyright (c) 2017-2021 Arm Limited.
StatusCode validate_internal_queue(const IQueue *queue)
Check if an internal queue is valid.
Definition: IQueue.h:89
Call succeeded, leading to valid state for all involved objects/data.
Definition: AclTypes.h:51
StatusCode
Definition: Types.h:32
IContext * get_internal(AclContext ctx)
Extract internal representation of a Context.
Definition: IContext.h:127

◆ AclQueueFinish()

AclStatus AclQueueFinish ( AclQueue  queue)

Wait until all elements on the queue have been completed.

Parameters
[in]queueQueue to wait on completion
Returns
Status code

Returns:

Definition at line 72 of file AclQueue.cpp.

References AclSuccess, ARM_COMPUTE_RETURN_CENUM_ON_FAILURE, arm_compute::get_internal(), and arm_compute::detail::validate_internal_queue().

Referenced by Queue::finish().

73 {
74  using namespace arm_compute;
75 
76  auto queue = get_internal(external_queue);
77 
80 
81  status = queue->finish();
83 
84  return AclSuccess;
85 }
#define ARM_COMPUTE_RETURN_CENUM_ON_FAILURE(status)
Definition: Macros.h:29
Copyright (c) 2017-2021 Arm Limited.
StatusCode validate_internal_queue(const IQueue *queue)
Check if an internal queue is valid.
Definition: IQueue.h:89
Call succeeded, leading to valid state for all involved objects/data.
Definition: AclTypes.h:51
StatusCode
Definition: Types.h:32
IContext * get_internal(AclContext ctx)
Extract internal representation of a Context.
Definition: IContext.h:127