Skip to content

Commit

Permalink
[ONE] Adapt Arm Compute Library v21.02. (Samsung#6241)
Browse files Browse the repository at this point in the history
* ONE] Apply armcompute library v21.02.

This commit enables armcompute library v21.02.

ONE-DCO-1.0-Signed-off-by: Hyunjun Kim <[email protected]>

* [ONE] Apply ARM Compute library v21.02

Some header files path had been changed in armcompute library v21.02.
So, Applies new include path and changes for ARMComputeEx.

1. CLGEMMMatrixAccumulateBiasesKernel, NEGEMMMatrixAccumulateBiasesKernel and
   CLMemsetKernel removed.
   - Copied files(.h, .cpp, cl) into ARMComputeEx.
2. NEFlattenLayerKernel removed.
   - Changed to use NEFlattenLayer.
3. Remove {CL/NE}BinaryLogicalKernel.
   - Provide kernels in v20.11
4. Modify KernelGenerator to adapt.

ONE-DCO-1.0-Signed-off-by: <Hyunjun Kim> <[email protected]>

* [ONE] Adapt ARM COMPUTE lib v21.02.

- Apply changes of v21.02.
- Add some CL and Neon's Kernel which was deprecated from v21.02.
- Fix Test case' failures.

ONE-DCO-1.0-Signed-off-by: HyunJun <[email protected]>
  • Loading branch information
Hyunjun85 authored Apr 14, 2021
1 parent 6ecf22e commit dc18d30
Show file tree
Hide file tree
Showing 126 changed files with 13,812 additions and 196 deletions.
2 changes: 1 addition & 1 deletion Makefile.template
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ ifneq ($(EXT_ACL_FOLDER),)
mkdir -p $(OVERLAY_FOLDER)/lib
cp $(EXT_ACL_FOLDER)/* $(OVERLAY_FOLDER)/lib
# Make stamp file
printf "20.05" > $(OVERLAY_FOLDER)/ARMCOMPUTE.stamp
printf "21.02" > $(OVERLAY_FOLDER)/ARMCOMPUTE.stamp
endif

NNFW_WORKSPACE="$(WORKSPACE)" NNFW_INSTALL_PREFIX=$(INSTALL_PATH) ./nnfw configure \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#ifndef ARM_COMPUTE_CLARGMINMAXLAYERKERNELEX_H
#define ARM_COMPUTE_CLARGMINMAXLAYERKERNELEX_H

#include "arm_compute/core/CL/ICLKernel.h"
#include "src/core/CL/ICLKernel.h"
#include "arm_compute/core/Types.h"

namespace arm_compute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
#ifndef __ARM_COMPUTE_CLBINARYLOGICALOPKERNEL_H__
#define __ARM_COMPUTE_CLBINARYLOGICALOPKERNEL_H__

#include "arm_compute/core/CL/ICLKernel.h"
#include "arm_compute/core/TypesEx.h"
#include "src/core/CL/ICLKernel.h"

namespace arm_compute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#ifndef __ARM_COMPUTE_CLCASTBOOLKERNEL_H__
#define __ARM_COMPUTE_CLCASTBOOLKERNEL_H__

#include "arm_compute/core/CL/ICLSimple3DKernel.h"
#include "src/core/CL/ICLSimple3DKernel.h"

namespace arm_compute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#ifndef __ARM_COMPUTE_CLEMBEDDINGLOOKUPKERNEL_H__
#define __ARM_COMPUTE_CLEMBEDDINGLOOKUPKERNEL_H__

#include "arm_compute/core/CL/ICLKernel.h"
#include "src/core/CL/ICLKernel.h"

namespace arm_compute
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/*
* Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* Copyright (c) 2017-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

#ifndef ARM_COMPUTE_CLGEMMMatrixAccumulateBiasesKernel_H
#define ARM_COMPUTE_CLGEMMMatrixAccumulateBiasesKernel_H

#include "src/core/CL/ICLKernel.h"

namespace arm_compute
{
/** Interface to add a bias to each row of the input tensor
*
*/
class CLGEMMMatrixAccumulateBiasesKernel : public ICLKernel
{
public:
/** Default constructor */
CLGEMMMatrixAccumulateBiasesKernel();
/** Prevent instances of this class from being copied (As this class contains pointers) */
CLGEMMMatrixAccumulateBiasesKernel(const CLGEMMMatrixAccumulateBiasesKernel &) = delete;
/** Prevent instances of this class from being copied (As this class contains pointers) */
CLGEMMMatrixAccumulateBiasesKernel &
operator=(const CLGEMMMatrixAccumulateBiasesKernel &) = delete;
/** Allow instances of this class to be moved */
CLGEMMMatrixAccumulateBiasesKernel(CLGEMMMatrixAccumulateBiasesKernel &&) = default;
/** Allow instances of this class to be moved */
CLGEMMMatrixAccumulateBiasesKernel &operator=(CLGEMMMatrixAccumulateBiasesKernel &&) = default;
/** Set the accumulate buffer and the biases of the kernel.
*
* @param[in, out] accum The accumulate tensor to convert. Data types supported: F16/F32
* @param[in] biases The shared biases tensor to append. It must be 1D tensor. Data types
* supported: Same as @p input
*/
void configure(ICLTensor *accum, const ICLTensor *biases);
/** Set the accumulate buffer and the biases of the kernel.
*
* @param[in] compile_context The compile context to be used.
* @param[in, out] accum The accumulate tensor to convert. Data types supported: F16/F32
* @param[in] biases The shared biases tensor to append. It must be 1D tensor. Data
* types supported: Same as @p input
*/
void configure(const CLCompileContext &compile_context, ICLTensor *accum,
const ICLTensor *biases);
/** Static function to check if given info will lead to a valid configuration of @ref
* CLGEMMMatrixAccumulateBiasesKernel
*
* @param[in] accum The accumulate tensor to convert. Data types supported: F16/F32
* @param[in] biases The shared biases tensor to append. It must be 1D tensor. Data types
* supported: Same as @p input
* @param[in] gpu_target GPU target
*
* @return a status
*/
static Status validate(const ITensorInfo *accum, const ITensorInfo *biases, GPUTarget gpu_target);

// Inherited methods overridden:
void run(const Window &window, cl::CommandQueue &queue) override;

private:
ICLTensor *_accum;
const ICLTensor *_biases;
};
} // namespace arm_compute
#endif /*ARM_COMPUTE_CLGEMMMatrixAccumulateBiasesKernel_H */
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#ifndef __ARM_COMPUTE_CLGATHEREXKERNEL_H__
#define __ARM_COMPUTE_CLGATHEREXKERNEL_H__

#include "arm_compute/core/CL/ICLKernel.h"
#include "src/core/CL/ICLKernel.h"

namespace arm_compute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#ifndef __ARM_COMPUTE_CLHASHTABLELOOKUPKERNEL_H__
#define __ARM_COMPUTE_CLHASHTABLELOOKUPKERNEL_H__

#include "arm_compute/core/CL/ICLKernel.h"
#include "src/core/CL/ICLKernel.h"
#include "arm_compute/runtime/CL/CLTensor.h"

namespace arm_compute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#ifndef __ARM_COMPUTE_CLINSTANCENORMALIZATIONLAYERKERNELEX_H__
#define __ARM_COMPUTE_CLINSTANCENORMALIZATIONLAYERKERNELEX_H__

#include "arm_compute/core/CL/ICLKernel.h"
#include "src/core/CL/ICLKernel.h"

namespace arm_compute
{
Expand Down
107 changes: 107 additions & 0 deletions compute/ARMComputeEx/arm_compute/core/CL/kernels/CLMemsetKernel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/*
* Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* Copyright (c) 2018-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef ARM_COMPUTE_CLMEMSETKERNEL_H
#define ARM_COMPUTE_CLMEMSETKERNEL_H

#include "arm_compute/core/PixelValue.h"
#include "arm_compute/core/Types.h"
#include "src/core/CL/ICLKernel.h"

namespace arm_compute
{
class ICLTensor;

/** Interface for filling the planes of a tensor */
class CLMemsetKernel : public ICLKernel
{
public:
/** Default constructor */
CLMemsetKernel();
/** Prevent instances of this class from being copied (As this class contains pointers) */
CLMemsetKernel(const CLMemsetKernel &) = delete;
/** Prevent instances of this class from being copied (As this class contains pointers) */
CLMemsetKernel &operator=(const CLMemsetKernel &) = delete;
/** Allow instances of this class to be moved */
CLMemsetKernel(CLMemsetKernel &&) = default;
/** Allow instances of this class to be moved */
CLMemsetKernel &operator=(CLMemsetKernel &&) = default;
/** Default destructor */
~CLMemsetKernel() = default;

/** Initialise the kernel's tensor and filling value
*
* @param[in,out] tensor Input tensor to fill. Supported data types: All.
* @param[in] constant_value The value used to fill the planes of the tensor
* @param[in] window Window to be used in case setting only part of a tensor. Default
* is nullptr.
*/
void configure(ICLTensor *tensor, const PixelValue &constant_value, Window *window = nullptr);
/** Initialise the kernel's tensor and filling value
*
* @param[in] compile_context The compile context to be used.
* @param[in,out] tensor Input tensor to fill. Supported data types: All.
* @param[in] constant_value The value used to fill the planes of the tensor
* @param[in] window Window to be used in case setting only part of a tensor. Default
* is nullptr.
*/
void configure(const CLCompileContext &compile_context, ICLTensor *tensor,
const PixelValue &constant_value, Window *window = nullptr);
/** Static function to check if given info will lead to a valid configuration of @ref
* CLMemsetKernel
*
* @param[in] tensor Source tensor info. Data types supported: All.
* @param[in] constant_value The value used to fill the planes of the tensor
* @param[in] window Window to be used in case setting only part of a tensor. Default is
* nullptr.
*
* @return a status
*/
static Status validate(const ITensorInfo *tensor, const PixelValue &constant_value,
Window *window = nullptr);

// Inherited methods overridden:
void run(const Window &window, cl::CommandQueue &queue) override;

private:
ICLTensor *_tensor;
Window _full_window;
};
} // namespace arm_compute
#endif /*ARM_COMPUTE_CLMEMSETRKERNEL_H */
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#ifndef __ARM_COMPUTE_CLMULTIPLYSCALEFACTORKERNEL_H__
#define __ARM_COMPUTE_CLMULTIPLYSCALEFACTORKERNEL_H__

#include "arm_compute/core/CL/ICLKernel.h"
#include "src/core/CL/ICLKernel.h"

namespace arm_compute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#ifndef __ARM_COMPUTE_CLNEGKERNEL_H__
#define __ARM_COMPUTE_CLNEGKERNEL_H__

#include "arm_compute/core/CL/ICLKernel.h"
#include "src/core/CL/ICLKernel.h"

namespace arm_compute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*/
#ifndef __ARM_COMPUTE_CLONEHOTKERNEL_H__
#define __ARM_COMPUTE_CLONEHOTKERNEL_H__
#include "arm_compute/core/CL/ICLKernel.h"
#include "src/core/CL/ICLKernel.h"
#include "arm_compute/core/Types.h"
namespace arm_compute
{
Expand Down
Loading

0 comments on commit dc18d30

Please sign in to comment.