aboutsummaryrefslogtreecommitdiff
path: root/src/c/cl/AclOpenClExt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/c/cl/AclOpenClExt.cpp')
-rw-r--r--src/c/cl/AclOpenClExt.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/c/cl/AclOpenClExt.cpp b/src/c/cl/AclOpenClExt.cpp
index 5f2bb47c16..a144f97f55 100644
--- a/src/c/cl/AclOpenClExt.cpp
+++ b/src/c/cl/AclOpenClExt.cpp
@@ -23,9 +23,12 @@
*/
#include "arm_compute/AclOpenClExt.h"
+#include "src/common/ITensor.h"
#include "src/common/Types.h"
#include "src/gpu/cl/ClContext.h"
+#include "arm_compute/core/CL/ICLTensor.h"
+
#include "support/Cast.h"
extern "C" AclStatus AclGetClContext(AclContext external_ctx, cl_context *opencl_context)
@@ -80,4 +83,30 @@ extern "C" AclStatus AclSetClContext(AclContext external_ctx, cl_context opencl_
}
return AclStatus::AclSuccess;
+}
+
+extern "C" AclStatus AclGetClMem(AclTensor external_tensor, cl_mem *opencl_mem)
+{
+ using namespace arm_compute;
+ ITensorV2 *tensor = get_internal(external_tensor);
+
+ if(detail::validate_internal_tensor(tensor) != StatusCode::Success)
+ {
+ return AclStatus::AclInvalidArgument;
+ }
+
+ if(tensor->header.ctx->type() != Target::GpuOcl)
+ {
+ return AclStatus::AclInvalidTarget;
+ }
+
+ if(opencl_mem == nullptr)
+ {
+ return AclStatus::AclInvalidArgument;
+ }
+
+ auto cl_tensor = utils::cast::polymorphic_downcast<arm_compute::ICLTensor *>(tensor->tensor());
+ *opencl_mem = cl_tensor->cl_buffer().get();
+
+ return AclStatus::AclSuccess;
} \ No newline at end of file