Compute Library
 21.08
AclEntrypoints.h File Reference

Go to the source code of this file.

Functions

AclStatus AclCreateContext (AclContext *ctx, AclTarget target, const AclContextOptions *options)
 __cplusplus More...
 
AclStatus AclDestroyContext (AclContext ctx)
 Destroy a given context object. More...
 
AclStatus AclCreateQueue (AclQueue *queue, AclContext ctx, const AclQueueOptions *options)
 Create an operator queue. More...
 
AclStatus AclQueueFinish (AclQueue queue)
 Wait until all elements on the queue have been completed. More...
 
AclStatus AclDestroyQueue (AclQueue queue)
 Destroy a given queue object. More...
 
AclStatus AclCreateTensor (AclTensor *tensor, AclContext ctx, const AclTensorDescriptor *desc, bool allocate)
 Create a Tensor object. More...
 
AclStatus AclMapTensor (AclTensor tensor, void **handle)
 Map a tensor's backing memory to the host. More...
 
AclStatus AclUnmapTensor (AclTensor tensor, void *handle)
 Unmap the tensor's backing memory. More...
 
AclStatus AclTensorImport (AclTensor tensor, void *handle, AclImportMemoryType type)
 Import external memory to a given tensor object. More...
 
AclStatus AclDestroyTensor (AclTensor tensor)
 Destroy a given tensor object. More...
 
AclStatus AclCreateTensorPack (AclTensorPack *pack, AclContext ctx)
 Creates a tensor pack. More...
 
AclStatus AclPackTensor (AclTensorPack pack, AclTensor tensor, int32_t slot_id)
 Add a tensor to a tensor pack. More...
 
AclStatus AclPackTensors (AclTensorPack pack, AclTensor *tensors, int32_t *slot_ids, size_t num_tensors)
 A list of tensors to a tensor pack. More...
 
AclStatus AclDestroyTensorPack (AclTensorPack pack)
 Destroy a given tensor pack object. More...
 
AclStatus AclRunOperator (AclOperator op, AclQueue queue, AclTensorPack tensors)
 Eager execution of a given operator on a list of inputs and outputs. More...
 
AclStatus AclDestroyOperator (AclOperator op)
 Destroy a given operator object. More...
 

Function Documentation

◆ AclCreateContext()

AclStatus AclCreateContext ( AclContext ctx,
AclTarget  target,
const AclContextOptions options 
)

__cplusplus

Create a context object

Context is responsible for retaining internal information and work as an aggregate service mechanism

Parameters
[in,out]ctxA valid non-zero context object if no failure occurs
[in]targetTarget to create the context for
[in]optionsContext options to be used for all the kernels that are created under the context
Returns
Status code

Returns:

Definition at line 78 of file AclContext.cpp.

References AclInvalidArgument, AclOutOfMemory, AclSuccess, AclUnsupportedTarget, and ARM_COMPUTE_LOG_ERROR_WITH_FUNCNAME_ACL.

Referenced by Context::Context(), and arm_compute::test::validation::TEST_CASE().

81 {
82  if(!is_target_valid(target))
83  {
84  ARM_COMPUTE_LOG_ERROR_WITH_FUNCNAME_ACL("Target is invalid!");
85  return AclUnsupportedTarget;
86  }
87 
88  if(options != nullptr && !are_context_options_valid(options))
89  {
90  ARM_COMPUTE_LOG_ERROR_WITH_FUNCNAME_ACL("Context options are invalid!");
91  return AclInvalidArgument;
92  }
93 
94  auto ctx = create_context(target, options);
95  if(ctx == nullptr)
96  {
97  ARM_COMPUTE_LOG_ERROR_WITH_FUNCNAME_ACL("Couldn't allocate internal resources for context creation!");
98  return AclOutOfMemory;
99  }
100  *external_ctx = ctx;
101 
102  return AclSuccess;
103 }
Call failed as invalid argument was passed.
Definition: AclTypes.h:57
Call failed as an invalid backend was requested.
Definition: AclTypes.h:55
Call succeeded, leading to valid state for all involved objects/data.
Definition: AclTypes.h:51
Call failed due to failure to allocate resources.
Definition: AclTypes.h:53
#define ARM_COMPUTE_LOG_ERROR_WITH_FUNCNAME_ACL(msg)
Log an error message to the logger with function name before the message.
Definition: Log.h:87

◆ 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:76
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

◆ AclCreateTensor()

AclStatus AclCreateTensor ( AclTensor tensor,
AclContext  ctx,
const AclTensorDescriptor desc,
bool  allocate 
)

Create a Tensor object.

Tensor is a generalized matrix construct that can represent up to ND dimensionality (where N = 6 for Compute Library) The object holds a backing memory along-side to operate on

Parameters
[in,out]tensorA valid non-zero tensor object if no failures occur
[in]ctxContext to be used
[in]descTensor representation meta-data
[in]allocateInstructs allocation of the tensor objects

Returns:

Definition at line 68 of file AclTensor.cpp.

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

Referenced by Tensor::Tensor().

72 {
73  using namespace arm_compute;
74 
75  IContext *ctx = get_internal(external_ctx);
76 
79 
80  if(desc == nullptr || !is_desc_valid(*desc))
81  {
82  ARM_COMPUTE_LOG_ERROR_ACL("[AclCreateTensor]: Descriptor is invalid!");
83  return AclInvalidArgument;
84  }
85 
86  auto tensor = ctx->create_tensor(*desc, allocate);
87  if(tensor == nullptr)
88  {
89  ARM_COMPUTE_LOG_ERROR_ACL("[AclCreateTensor]: Couldn't allocate internal resources for tensor creation!");
90  return AclOutOfMemory;
91  }
92  *external_tensor = tensor;
93 
94  return AclSuccess;
95 }
#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:76
Context interface.
Definition: IContext.h:50
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
virtual ITensorV2 * create_tensor(const AclTensorDescriptor &desc, bool allocate)=0
Create a tensor object.
IContext * get_internal(AclContext ctx)
Extract internal representation of a Context.
Definition: IContext.h:127

◆ AclCreateTensorPack()

AclStatus AclCreateTensorPack ( AclTensorPack pack,
AclContext  ctx 
)

Creates a tensor pack.

Tensor packs are used to create a collection of tensors that can be passed around for operator execution

Parameters
[in,out]packA valid non-zero tensor pack object if no failures occur
[in]ctxContext to be used
Returns
Status code

Returns:

Definition at line 50 of file AclTensorPack.cpp.

References AclOutOfMemory, AclSuccess, ARM_COMPUTE_LOG_ERROR_WITH_FUNCNAME_ACL, ARM_COMPUTE_RETURN_CENUM_ON_FAILURE, arm_compute::get_internal(), arm_compute::test::validation::pack, and arm_compute::detail::validate_internal_context().

Referenced by TensorPack::TensorPack().

51 {
52  using namespace arm_compute;
53 
54  IContext *ctx = get_internal(external_ctx);
55 
58 
59  auto pack = new TensorPack(ctx);
60  if(pack == nullptr)
61  {
62  ARM_COMPUTE_LOG_ERROR_WITH_FUNCNAME_ACL("Couldn't allocate internal resources!");
63  return AclOutOfMemory;
64  }
65  *external_pack = pack;
66 
67  return AclSuccess;
68 }
#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
Context interface.
Definition: IContext.h:50
Copyright (c) 2017-2021 Arm Limited.
Call succeeded, leading to valid state for all involved objects/data.
Definition: AclTypes.h:51
StatusCode
Definition: Types.h:32
Tensor packing service.
Definition: TensorPack.h:50
Call failed due to failure to allocate resources.
Definition: AclTypes.h:53
#define ARM_COMPUTE_LOG_ERROR_WITH_FUNCNAME_ACL(msg)
Log an error message to the logger with function name before the message.
Definition: Log.h:87
IContext * get_internal(AclContext ctx)
Extract internal representation of a Context.
Definition: IContext.h:127

◆ AclDestroyContext()

AclStatus AclDestroyContext ( AclContext  ctx)

Destroy a given context object.

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

Returns:

Definition at line 105 of file AclContext.cpp.

References ARM_COMPUTE_LOG_ERROR_WITH_FUNCNAME_ACL, ARM_COMPUTE_RETURN_CENUM_ON_FAILURE, arm_compute::get_internal(), IContext::refcount(), and arm_compute::detail::validate_internal_context().

106 {
107  using namespace arm_compute;
108 
109  IContext *ctx = get_internal(external_ctx);
110 
113 
114  if(ctx->refcount() != 0)
115  {
116  ARM_COMPUTE_LOG_ERROR_WITH_FUNCNAME_ACL("Context has references on it that haven't been released!");
117  // TODO: Fix the refcount with callback when reaches 0
118  }
119 
120  delete ctx;
121 
122  return utils::as_cenum<AclStatus>(status);
123 }
#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
Context interface.
Definition: IContext.h:50
Copyright (c) 2017-2021 Arm Limited.
int refcount() const
Reference counter accessor.
Definition: IContext.h:84
StatusCode
Definition: Types.h:32
#define ARM_COMPUTE_LOG_ERROR_WITH_FUNCNAME_ACL(msg)
Log an error message to the logger with function name before the message.
Definition: Log.h:87
IContext * get_internal(AclContext ctx)
Extract internal representation of a Context.
Definition: IContext.h:127

◆ AclDestroyOperator()

AclStatus AclDestroyOperator ( AclOperator  op)

Destroy a given operator object.

Parameters
[in,out]opA valid operator object to destroy
Returns
Status code

Returns:

Definition at line 53 of file AclOperator.cpp.

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

54 {
55  using namespace arm_compute;
56 
57  auto op = get_internal(external_op);
58 
61 
62  delete op;
63 
64  return AclSuccess;
65 }
#define ARM_COMPUTE_RETURN_CENUM_ON_FAILURE(status)
Definition: Macros.h:29
Copyright (c) 2017-2021 Arm Limited.
StatusCode validate_internal_operator(const IOperator *op)
Check if an internal operator is valid.
Definition: IOperator.h:125
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

◆ 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

◆ AclDestroyTensor()

AclStatus AclDestroyTensor ( AclTensor  tensor)

Destroy a given tensor object.

Parameters
[in,out]tensorA valid tensor object to be destroyed
Returns
Status code

Returns:

Definition at line 144 of file AclTensor.cpp.

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

145 {
146  using namespace arm_compute;
147 
148  auto tensor = get_internal(external_tensor);
149 
152 
153  delete tensor;
154 
155  return AclSuccess;
156 }
#define ARM_COMPUTE_RETURN_CENUM_ON_FAILURE(status)
Definition: Macros.h:29
StatusCode validate_internal_tensor(const ITensorV2 *tensor)
Check if an internal tensor is valid.
Definition: ITensorV2.h:129
Copyright (c) 2017-2021 Arm Limited.
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

◆ AclDestroyTensorPack()

AclStatus AclDestroyTensorPack ( AclTensorPack  pack)

Destroy a given tensor pack object.

Parameters
[in,out]packA valid tensor pack object to destroy
Returns
Status code

Returns:

Definition at line 94 of file AclTensorPack.cpp.

References AclSuccess, ARM_COMPUTE_RETURN_CENUM_ON_FAILURE, arm_compute::get_internal(), arm_compute::test::validation::pack, and arm_compute::detail::validate_internal_pack().

95 {
96  using namespace arm_compute;
97 
98  auto pack = get_internal(external_pack);
101 
102  delete pack;
103 
104  return AclSuccess;
105 }
#define ARM_COMPUTE_RETURN_CENUM_ON_FAILURE(status)
Definition: Macros.h:29
Copyright (c) 2017-2021 Arm Limited.
Call succeeded, leading to valid state for all involved objects/data.
Definition: AclTypes.h:51
StatusCode
Definition: Types.h:32
StatusCode validate_internal_pack(const TensorPack *pack)
Check if an internal TensorPack is valid.
Definition: TensorPack.h:119
IContext * get_internal(AclContext ctx)
Extract internal representation of a Context.
Definition: IContext.h:127

◆ AclMapTensor()

AclStatus AclMapTensor ( AclTensor  tensor,
void **  handle 
)

Map a tensor's backing memory to the host.

Parameters
[in]tensorTensor to be mapped
[in,out]handleA handle to the underlying backing memory
Returns
Status code

Returns:

Definition at line 97 of file AclTensor.cpp.

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

Referenced by Tensor::map().

98 {
99  using namespace arm_compute;
100 
101  auto tensor = get_internal(external_tensor);
104 
105  if(handle == nullptr)
106  {
107  ARM_COMPUTE_LOG_ERROR_ACL("[AclMapTensor]: Handle object is nullptr!");
108  return AclInvalidArgument;
109  }
110 
111  *handle = tensor->map();
112 
113  return AclSuccess;
114 }
#define ARM_COMPUTE_RETURN_CENUM_ON_FAILURE(status)
Definition: Macros.h:29
#define ARM_COMPUTE_LOG_ERROR_ACL(msg)
Log an error message to the logger.
Definition: Log.h:76
StatusCode validate_internal_tensor(const ITensorV2 *tensor)
Check if an internal tensor is valid.
Definition: ITensorV2.h:129
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
IContext * get_internal(AclContext ctx)
Extract internal representation of a Context.
Definition: IContext.h:127

◆ AclPackTensor()

AclStatus AclPackTensor ( AclTensorPack  pack,
AclTensor  tensor,
int32_t  slot_id 
)

Add a tensor to a tensor pack.

Parameters
[in,out]packPack to append a tensor to
[in]tensorTensor to pack
[in]slot_idSlot of the operator that the tensors corresponds to
Returns
Status code

Returns:

Definition at line 70 of file AclTensorPack.cpp.

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

Referenced by TensorPack::add().

71 {
72  using namespace arm_compute;
73 
74  auto pack = get_internal(external_pack);
76  ARM_COMPUTE_RETURN_CENUM_ON_FAILURE(PackTensorInternal(*pack, external_tensor, slot_id));
77  return AclStatus::AclSuccess;
78 }
#define ARM_COMPUTE_RETURN_CENUM_ON_FAILURE(status)
Definition: Macros.h:29
Copyright (c) 2017-2021 Arm Limited.
Call succeeded, leading to valid state for all involved objects/data.
Definition: AclTypes.h:51
StatusCode validate_internal_pack(const TensorPack *pack)
Check if an internal TensorPack is valid.
Definition: TensorPack.h:119
IContext * get_internal(AclContext ctx)
Extract internal representation of a Context.
Definition: IContext.h:127

◆ AclPackTensors()

AclStatus AclPackTensors ( AclTensorPack  pack,
AclTensor tensors,
int32_t *  slot_ids,
size_t  num_tensors 
)

A list of tensors to a tensor pack.

Parameters
[in,out]packPack to append the tensors to
[in]tensorsTensors to append to the pack
[in]slot_idsSlot IDs of each tensors to the operators
[in]num_tensorsNumber of tensors that are passed
Returns
Status code

Returns:

Definition at line 80 of file AclTensorPack.cpp.

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

Referenced by TensorPack::add().

81 {
82  using namespace arm_compute;
83 
84  auto pack = get_internal(external_pack);
86 
87  for(unsigned i = 0; i < num_tensors; ++i)
88  {
89  ARM_COMPUTE_RETURN_CENUM_ON_FAILURE(PackTensorInternal(*pack, external_tensors[i], slot_ids[i]));
90  }
91  return AclStatus::AclSuccess;
92 }
#define ARM_COMPUTE_RETURN_CENUM_ON_FAILURE(status)
Definition: Macros.h:29
Copyright (c) 2017-2021 Arm Limited.
Call succeeded, leading to valid state for all involved objects/data.
Definition: AclTypes.h:51
StatusCode validate_internal_pack(const TensorPack *pack)
Check if an internal TensorPack is valid.
Definition: TensorPack.h:119
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

◆ AclRunOperator()

AclStatus AclRunOperator ( AclOperator  op,
AclQueue  queue,
AclTensorPack  tensors 
)

Eager execution of a given operator on a list of inputs and outputs.

Parameters
[in]opOperator to execute
[in]queueQueue to schedule the operator on
[in,out]tensorsA list of input and outputs tensors to execute the operator on
Returns
Status Code

Returns:

Definition at line 31 of file AclOperator.cpp.

References AclSuccess, ARM_COMPUTE_RETURN_CENUM_ON_FAILURE, arm_compute::get_internal(), arm_compute::test::validation::pack, arm_compute::Success, arm_compute::detail::validate_internal_operator(), arm_compute::detail::validate_internal_pack(), and arm_compute::detail::validate_internal_queue().

Referenced by Operator::run().

32 {
33  using namespace arm_compute;
34 
35  auto op = get_internal(external_op);
36  auto queue = get_internal(external_queue);
37  auto pack = get_internal(external_tensors);
38 
42  status = detail::validate_internal_queue(queue);
46 
47  status = op->run(*queue, pack->get_tensor_pack());
49 
50  return AclSuccess;
51 }
#define ARM_COMPUTE_RETURN_CENUM_ON_FAILURE(status)
Definition: Macros.h:29
Copyright (c) 2017-2021 Arm Limited.
StatusCode validate_internal_operator(const IOperator *op)
Check if an internal operator is valid.
Definition: IOperator.h:125
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
StatusCode validate_internal_pack(const TensorPack *pack)
Check if an internal TensorPack is valid.
Definition: TensorPack.h:119
IContext * get_internal(AclContext ctx)
Extract internal representation of a Context.
Definition: IContext.h:127

◆ AclTensorImport()

AclStatus AclTensorImport ( AclTensor  tensor,
void *  handle,
AclImportMemoryType  type 
)

Import external memory to a given tensor object.

Parameters
[in,out]tensorTensor to import memory to
[in]handleBacking memory to be imported
[in]typeType of the imported memory

Returns:

Definition at line 130 of file AclTensor.cpp.

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

Referenced by Tensor::import().

131 {
132  using namespace arm_compute;
133 
134  auto tensor = get_internal(external_tensor);
137 
138  status = tensor->import(handle, utils::as_enum<ImportMemoryType>(type));
140 
141  return AclSuccess;
142 }
#define ARM_COMPUTE_RETURN_CENUM_ON_FAILURE(status)
Definition: Macros.h:29
StatusCode validate_internal_tensor(const ITensorV2 *tensor)
Check if an internal tensor is valid.
Definition: ITensorV2.h:129
decltype(strategy::transforms) typedef type
Copyright (c) 2017-2021 Arm Limited.
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

◆ AclUnmapTensor()

AclStatus AclUnmapTensor ( AclTensor  tensor,
void *  handle 
)

Unmap the tensor's backing memory.

Parameters
[in]tensortensor to unmap memory from
[in]handleBacking memory to be unmapped
Returns
Status code

Returns:

Definition at line 116 of file AclTensor.cpp.

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

Referenced by Tensor::unmap().

117 {
118  ARM_COMPUTE_UNUSED(handle);
119 
120  using namespace arm_compute;
121 
122  auto tensor = get_internal(external_tensor);
125 
126  status = tensor->unmap();
127  return AclSuccess;
128 }
#define ARM_COMPUTE_RETURN_CENUM_ON_FAILURE(status)
Definition: Macros.h:29
StatusCode validate_internal_tensor(const ITensorV2 *tensor)
Check if an internal tensor is valid.
Definition: ITensorV2.h:129
Copyright (c) 2017-2021 Arm Limited.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152
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