From e00fff38314a5ee87aebaa3e884cbc98cecdd32c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Shubham=20Gupta/System=20SW=20/SRI-Bangalore/Engineer/?= =?utf8?q?=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Wed, 24 Oct 2018 12:55:48 +0530 Subject: [PATCH] Add CL Kernel Calls for SpaceToDepth from runtime. (#3267) This patch adds CL Kernel Calls for SpaceToDepth from runtime Signed-off-by: shubham --- runtimes/pure_arm_compute/src/compilation.cc | 29 ++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/runtimes/pure_arm_compute/src/compilation.cc b/runtimes/pure_arm_compute/src/compilation.cc index 564fb74..1957d98 100644 --- a/runtimes/pure_arm_compute/src/compilation.cc +++ b/runtimes/pure_arm_compute/src/compilation.cc @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -3811,13 +3812,33 @@ void Planner::visit(const ::internal::tflite::op::SpaceToDepth::Node &node) auto stage = [param](const IAllocationContext &ctx, IExecutionBuilder &builder) { auto output_alloc = ctx.at(::internal::tflite::operand::Index{param.output_index}); auto input_alloc = ctx.at(::internal::tflite::operand::Index{param.input_index}); - auto rank = 4; - auto fn = nnfw::make_unique(); + if (from_env(std::getenv("USE_SIMPLE_SPACETODEPTH"))) + { + // USE CPU VERSION OF SPACETODEPTH + auto rank = 4; + auto fn = nnfw::make_unique(); + + fn->configure(input_alloc, output_alloc, param.block_size, getARMComputeAxises(rank)); + + builder.append("SpaceToDepth", std::move(fn)); + } + else + { + if (::internal::arm_compute::isGpuMode()) // GPU + { + auto fn = nnfw::make_unique<::arm_compute::CLSpaceToDepth>(); - fn->configure(input_alloc, output_alloc, param.block_size, getARMComputeAxises(rank)); - builder.append("SpaceToDepth", std::move(fn)); + fn->configure(CAST_CL(input_alloc), CAST_CL(output_alloc), param.block_size); + builder.append("SpaceToDepth", std::move(fn)); + } + else // NEON + { + // TODO Enable NEON Support + throw std::runtime_error("Not supported, yet"); + } + } }; _builder.addStage(stage); -- 2.7.4