From ed2a8ed7efb54ae0ec539b8735820b2c30756c44 Mon Sep 17 00:00:00 2001 From: Manuel Bottini Date: Wed, 7 Oct 2020 17:17:16 +0100 Subject: COMPMID-3715: Remove OpenCL padding - CLElementwiseOperationKernel Change-Id: I8a685d4ac5de747a0f775bd10be9c411cf394953 Signed-off-by: Manuel Bottini Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4140 Comments-Addressed: Arm Jenkins Reviewed-by: Michele Di Giorgio Reviewed-by: Giorgio Arena Reviewed-by: Sang-Hoon Park Tested-by: Arm Jenkins --- .../CL/functions/CLElementwiseOperations.cpp | 62 ---------------------- 1 file changed, 62 deletions(-) (limited to 'src/runtime/CL/functions/CLElementwiseOperations.cpp') diff --git a/src/runtime/CL/functions/CLElementwiseOperations.cpp b/src/runtime/CL/functions/CLElementwiseOperations.cpp index 6f664725c5..7b4d3c629d 100644 --- a/src/runtime/CL/functions/CLElementwiseOperations.cpp +++ b/src/runtime/CL/functions/CLElementwiseOperations.cpp @@ -32,43 +32,9 @@ namespace arm_compute { -namespace -{ -void configure_border_handler(const CLCompileContext &compile_context, CLFillBorderKernel &border_handler, BorderSize border_size, ITensorInfo *input1, ITensorInfo *input2, const ITensorInfo *output) -{ - if(output->dimension(0) > 1) - { - ITensorInfo *broadcasted_info = (input1->dimension(0) == 1) ? input1 : input2; - - if(broadcasted_info->dimension(0) == 1) - { - border_handler.configure(compile_context, broadcasted_info, border_size, BorderMode::REPLICATE); - } - } -} - -ITensorPack select_border_input(ITensorPack &tensors) -{ - ITensorPack pack; - if(tensors.get_tensor(TensorType::ACL_DST)->info()->dimension(0) > 1) - { - if(tensors.get_const_tensor(TensorType::ACL_SRC_1)->info()->dimension(0) == 1) - { - pack.add_tensor(TensorType::ACL_SRC, tensors.get_const_tensor(TensorType::ACL_SRC_1)); - } - else - { - pack.add_tensor(TensorType::ACL_SRC, tensors.get_const_tensor(TensorType::ACL_SRC_0)); - } - } - return pack; -} -} // namespace - namespace experimental { CLArithmeticAddition::CLArithmeticAddition() - : _border_handler() { } @@ -77,7 +43,6 @@ void CLArithmeticAddition::configure(const CLCompileContext &compile_context, IT auto k = arm_compute::support::cpp14::make_unique(); k->configure(compile_context, ArithmeticOperation::ADD, input1, input2, output, policy, act_info); _kernel = std::move(k); - configure_border_handler(compile_context, _border_handler, _kernel->border_size(), input1, input2, output); } Status CLArithmeticAddition::validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, ConvertPolicy policy, const ActivationLayerInfo &act_info) @@ -87,13 +52,10 @@ Status CLArithmeticAddition::validate(const ITensorInfo *input1, const ITensorIn void CLArithmeticAddition::run(ITensorPack &tensors) { - auto border_pack = select_border_input(tensors); - CLScheduler::get().enqueue_op(_border_handler, border_pack); ICLOperator::run(tensors); } CLArithmeticSubtraction::CLArithmeticSubtraction() - : _border_handler() { } void CLArithmeticSubtraction::configure(const CLCompileContext &compile_context, ITensorInfo *input1, ITensorInfo *input2, ITensorInfo *output, ConvertPolicy policy, @@ -102,7 +64,6 @@ void CLArithmeticSubtraction::configure(const CLCompileContext &compile_context, auto k = arm_compute::support::cpp14::make_unique(); k->configure(compile_context, ArithmeticOperation::SUB, input1, input2, output, policy, act_info); _kernel = std::move(k); - configure_border_handler(compile_context, _border_handler, _kernel->border_size(), input1, input2, output); } Status CLArithmeticSubtraction::validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, ConvertPolicy policy, const ActivationLayerInfo &act_info) @@ -113,13 +74,10 @@ Status CLArithmeticSubtraction::validate(const ITensorInfo *input1, const ITenso void CLArithmeticSubtraction::run(ITensorPack &tensors) { - auto border_pack = select_border_input(tensors); - CLScheduler::get().enqueue_op(_border_handler, border_pack); ICLOperator::run(tensors); } CLArithmeticDivision::CLArithmeticDivision() - : _border_handler() { } @@ -128,7 +86,6 @@ void CLArithmeticDivision::configure(const CLCompileContext &compile_context, IT auto k = arm_compute::support::cpp14::make_unique(); k->configure(compile_context, ArithmeticOperation::DIV, input1, input2, output, act_info); _kernel = std::move(k); - configure_border_handler(compile_context, _border_handler, _kernel->border_size(), input1, input2, output); } Status CLArithmeticDivision::validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info) @@ -138,13 +95,10 @@ Status CLArithmeticDivision::validate(const ITensorInfo *input1, const ITensorIn void CLArithmeticDivision::run(ITensorPack &tensors) { - auto border_pack = select_border_input(tensors); - CLScheduler::get().enqueue_op(_border_handler, border_pack); ICLOperator::run(tensors); } CLElementwiseMax::CLElementwiseMax() - : _border_handler() { } @@ -153,7 +107,6 @@ void CLElementwiseMax::configure(const CLCompileContext &compile_context, ITenso auto k = arm_compute::support::cpp14::make_unique(); k->configure(compile_context, ArithmeticOperation::MAX, input1, input2, output, act_info); _kernel = std::move(k); - configure_border_handler(compile_context, _border_handler, _kernel->border_size(), input1, input2, output); } Status CLElementwiseMax::validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info) @@ -163,13 +116,10 @@ Status CLElementwiseMax::validate(const ITensorInfo *input1, const ITensorInfo * void CLElementwiseMax::run(ITensorPack &tensors) { - auto border_pack = select_border_input(tensors); - CLScheduler::get().enqueue_op(_border_handler, border_pack); ICLOperator::run(tensors); } CLElementwiseMin::CLElementwiseMin() - : _border_handler() { } @@ -178,7 +128,6 @@ void CLElementwiseMin::configure(const CLCompileContext &compile_context, ITenso auto k = arm_compute::support::cpp14::make_unique(); k->configure(compile_context, ArithmeticOperation::MIN, input1, input2, output, act_info); _kernel = std::move(k); - configure_border_handler(compile_context, _border_handler, _kernel->border_size(), input1, input2, output); } Status CLElementwiseMin::validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info) @@ -188,13 +137,10 @@ Status CLElementwiseMin::validate(const ITensorInfo *input1, const ITensorInfo * void CLElementwiseMin::run(ITensorPack &tensors) { - auto border_pack = select_border_input(tensors); - CLScheduler::get().enqueue_op(_border_handler, border_pack); ICLOperator::run(tensors); } CLElementwiseSquaredDiff::CLElementwiseSquaredDiff() - : _border_handler() { } @@ -203,7 +149,6 @@ void CLElementwiseSquaredDiff::configure(const CLCompileContext &compile_context auto k = arm_compute::support::cpp14::make_unique(); k->configure(compile_context, ArithmeticOperation::SQUARED_DIFF, input1, input2, output, act_info); _kernel = std::move(k); - configure_border_handler(compile_context, _border_handler, _kernel->border_size(), input1, input2, output); } Status CLElementwiseSquaredDiff::validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info) @@ -213,13 +158,10 @@ Status CLElementwiseSquaredDiff::validate(const ITensorInfo *input1, const ITens void CLElementwiseSquaredDiff::run(ITensorPack &tensors) { - auto border_pack = select_border_input(tensors); - CLScheduler::get().enqueue_op(_border_handler, border_pack); ICLOperator::run(tensors); } CLElementwisePower::CLElementwisePower() - : _border_handler() { } @@ -228,7 +170,6 @@ void CLElementwisePower::configure(const CLCompileContext &compile_context, ITen auto k = arm_compute::support::cpp14::make_unique(); k->configure(compile_context, ArithmeticOperation::POWER, input1, input2, output, act_info); _kernel = std::move(k); - configure_border_handler(compile_context, _border_handler, _kernel->border_size(), input1, input2, output); } Status CLElementwisePower::validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info) @@ -238,8 +179,6 @@ Status CLElementwisePower::validate(const ITensorInfo *input1, const ITensorInfo void CLElementwisePower::run(ITensorPack &tensors) { - auto border_pack = select_border_input(tensors); - CLScheduler::get().enqueue_op(_border_handler, border_pack); ICLOperator::run(tensors); } } // namespace experimental @@ -477,7 +416,6 @@ struct CLElementwiseSquaredDiff::Impl const ICLTensor *src_1{ nullptr }; ICLTensor *dst{ nullptr }; std::unique_ptr op{ nullptr }; - std::unique_ptr _border_handler{ nullptr }; }; CLElementwiseSquaredDiff::CLElementwiseSquaredDiff() -- cgit v1.2.1