diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2018-04-03 13:44:29 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:49:16 +0000 |
commit | d9eb27597eabe5b7c17520f4f9b3f8a282d72573 (patch) | |
tree | 9b2b7d74b0ef83623b18d6d4279a564e5b63d641 /arm_compute/graph2/backends | |
parent | a8ca2b0cfe052c9a28b691317a674f28f495c139 (diff) | |
download | ComputeLibrary-d9eb27597eabe5b7c17520f4f9b3f8a282d72573.tar.gz |
COMPMID-797: Switch to new graph.
- Cleaned up build system
Change-Id: If2faa27ee5b31fa8b972836960ab3ef671059c8d
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/126435
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Pablo Tello <pablo.tello@arm.com>
Diffstat (limited to 'arm_compute/graph2/backends')
18 files changed, 0 insertions, 1258 deletions
diff --git a/arm_compute/graph2/backends/BackendRegistrar.h b/arm_compute/graph2/backends/BackendRegistrar.h deleted file mode 100644 index f9905a7f8f..0000000000 --- a/arm_compute/graph2/backends/BackendRegistrar.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_BACKEND_REGISTRAR_H__ -#define ARM_COMPUTE_GRAPH2_BACKEND_REGISTRAR_H__ - -#include "arm_compute/graph2/Types.h" -#include "arm_compute/graph2/backends/BackendRegistry.h" - -#include <utility> - -namespace arm_compute -{ -namespace graph2 -{ -namespace backends -{ -namespace detail -{ -/** Helper class to statically register a backend */ -template <typename T> -class BackendRegistrar final -{ -public: - /** Add a new backend to the backend registry - * - * @param[in] target Execution target - */ - BackendRegistrar(Target target); -}; - -template <typename T> -inline BackendRegistrar<T>::BackendRegistrar(Target target) -{ - BackendRegistry::get().add_backend<T>(target); -} -} // namespace detail -} // namespace backends -} // namespace graph2 -} // namespace arm_compute -#endif /* ARM_COMPUTE_GRAPH2_BACKEND_REGISTRAR_H__ */
\ No newline at end of file diff --git a/arm_compute/graph2/backends/BackendRegistry.h b/arm_compute/graph2/backends/BackendRegistry.h deleted file mode 100644 index 9481115009..0000000000 --- a/arm_compute/graph2/backends/BackendRegistry.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_BACKEND_REGISTRY_H__ -#define __ARM_COMPUTE_GRAPH2_BACKEND_REGISTRY_H__ - -#include "arm_compute/graph2/IDeviceBackend.h" -#include "arm_compute/graph2/Types.h" -#include "support/ToolchainSupport.h" - -#include <map> -#include <memory> - -namespace arm_compute -{ -namespace graph2 -{ -namespace backends -{ -/** Registry holding all the supported backends */ -class BackendRegistry final -{ -public: - /** Gets backend registry instance - * - * @return Backend registry instance - */ - static BackendRegistry &get(); - /** Finds a backend in the registry - * - * @param[in] target Backend target - * - * @return Pointer to the backend interface if found, else nullptr - */ - IDeviceBackend *find_backend(Target target); - /** Checks if a backend for a given target exists - * - * @param[in] target Execution target - * - * @return True if exists else false - */ - bool contains(Target target) const; - /** Backends accessor - * - * @return Map containing the registered backends - */ - const std::map<Target, std::unique_ptr<IDeviceBackend>> &backends() const; - /** Registers a backend to the registry - * - * @param[in] target Execution target to register for - */ - template <typename T> - void add_backend(Target target); - -private: - /** Default Constructor */ - BackendRegistry(); - -private: - std::map<Target, std::unique_ptr<IDeviceBackend>> _registered_backends; -}; - -template <typename T> -inline void BackendRegistry::add_backend(Target target) -{ - _registered_backends[target] = support::cpp14::make_unique<T>(); -} -} // namespace backends -} // namespace graph2 -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_BACKEND_REGISTRY_H__ */ diff --git a/arm_compute/graph2/backends/CL/CLDeviceBackend.h b/arm_compute/graph2/backends/CL/CLDeviceBackend.h deleted file mode 100644 index 3a70f0b112..0000000000 --- a/arm_compute/graph2/backends/CL/CLDeviceBackend.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_CLDEVICEBACKEND_H__ -#define __ARM_COMPUTE_GRAPH2_CLDEVICEBACKEND_H__ - -#include "arm_compute/graph2/IDeviceBackend.h" - -#include "arm_compute/runtime/CL/CLBufferAllocator.h" -#include "arm_compute/runtime/CL/CLTuner.h" - -namespace arm_compute -{ -namespace graph2 -{ -namespace backends -{ -/** OpenCL device backend */ -class CLDeviceBackend final : public IDeviceBackend -{ -public: - /** Default Constructor */ - CLDeviceBackend(); - /** Destructor */ - ~CLDeviceBackend(); - /** Switchs on or off the kernel tuning - * - * @note When true the tuner set is used, if no tuner is set a new default one is created - * - * @param[in] enable_tuning Enables tuning if false else true - */ - void set_kernel_tuning(bool enable_tuning); - - // Inherited overridden methods - void initialize_backend() override; - void setup_backend_context(GraphContext &ctx) override; - std::unique_ptr<ITensorHandle> create_tensor(const Tensor &tensor) override; - std::unique_ptr<ITensorHandle> create_subtensor(ITensorHandle *parent, TensorShape shape, Coordinates coords, bool extend_parent) override; - std::unique_ptr<arm_compute::IFunction> configure_node(INode &node, GraphContext &ctx) override; - Status validate_node(INode &node) override; - std::shared_ptr<arm_compute::IMemoryManager> create_memory_manager(MemoryManagerAffinity affinity) override; - -private: - CLTuner _tuner; /**< CL kernel tuner */ - CLBufferAllocator _allocator; /**< CL buffer affinity allocator */ -}; -} // namespace backends -} // namespace graph2 -} // namespace arm_compute -#endif //__ARM_COMPUTE_GRAPH2_CLDEVICEBACKEND_H__ diff --git a/arm_compute/graph2/backends/CL/CLFunctionFactory.h b/arm_compute/graph2/backends/CL/CLFunctionFactory.h deleted file mode 100644 index 94fd2b8be1..0000000000 --- a/arm_compute/graph2/backends/CL/CLFunctionFactory.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_CLFUNCTIONFACTORY_H__ -#define __ARM_COMPUTE_GRAPH2_CLFUNCTIONFACTORY_H__ - -#include "arm_compute/runtime/IFunction.h" - -#include <memory> - -namespace arm_compute -{ -namespace graph2 -{ -// Forward declarations -class INode; -class GraphContext; - -namespace backends -{ -/** Factory for generating OpenCL backend functions **/ -class CLFunctionFactory final -{ -public: - /** Create a backend execution function depending on the node type - * - * @param[in] node Node to create the backend function for - * @param[in] ctx Context to use - * - * @return Backend function - */ - static std::unique_ptr<arm_compute::IFunction> create(INode *node, GraphContext &ctx); -}; -} // namespace backends -} // namespace graph2 -} // namespace arm_compute -#endif //__ARM_COMPUTE_GRAPH2_CLFUNCTIONFACTORY_H__ diff --git a/arm_compute/graph2/backends/CL/CLNodeValidator.h b/arm_compute/graph2/backends/CL/CLNodeValidator.h deleted file mode 100644 index 251f705eee..0000000000 --- a/arm_compute/graph2/backends/CL/CLNodeValidator.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_CLNODEVALIDATOR_H__ -#define __ARM_COMPUTE_GRAPH2_CLNODEVALIDATOR_H__ - -#include "arm_compute/core/Error.h" - -namespace arm_compute -{ -namespace graph2 -{ -// Forward declarations -class INode; - -namespace backends -{ -class CLNodeValidator final -{ -public: - /** Validate a node - * - * @param[in] node Node to validate - * - * @return An error status - */ - static Status validate(INode *node); -}; -} // namespace backends -} // namespace graph2 -} // namespace arm_compute -#endif //__ARM_COMPUTE_GRAPH2_CLNODEVALIDATOR_H__ diff --git a/arm_compute/graph2/backends/CL/CLSubTensorHandle.h b/arm_compute/graph2/backends/CL/CLSubTensorHandle.h deleted file mode 100644 index 6f3c00c041..0000000000 --- a/arm_compute/graph2/backends/CL/CLSubTensorHandle.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_CLSUBTENSORHANDLE_H__ -#define __ARM_COMPUTE_GRAPH2_CLSUBTENSORHANDLE_H__ - -#include "arm_compute/graph2/ITensorHandle.h" - -#include "arm_compute/runtime/CL/CLSubTensor.h" - -namespace arm_compute -{ -namespace graph2 -{ -namespace backends -{ -/** OpenCL Sub-Tensor handle interface object **/ -class CLSubTensorHandle final : public ITensorHandle -{ -public: - /** Default constructor - * - * @param[in] parent_handle Parent tensor handle - * @param[in] shape Sub-Tensor shape - * @param[in] coords Starting coordinates - * @param[in] extend_parent Extends parent shape if true - */ - CLSubTensorHandle(ITensorHandle *parent_handle, const TensorShape &shape, const Coordinates &coords, bool extend_parent = false); - /** Destructor: free the tensor's memory */ - ~CLSubTensorHandle() = default; - /** Allow instances of this class to be move constructed */ - CLSubTensorHandle(CLSubTensorHandle &&) = default; - /** Allow instances of this class to be moved */ - CLSubTensorHandle &operator=(CLSubTensorHandle &&) = default; - - // Inherited overridden methods - void allocate() override; - arm_compute::ITensor &tensor() override; - const arm_compute::ITensor &tensor() const override; - void map(bool blocking) override; - void unmap() override; - void release_if_unused() override; - bool is_subtensor() const override; - -private: - arm_compute::CLSubTensor _sub_tensor; /**< Backend Sub-Tensor */ -}; -} // namespace backends -} // namespace graph2 -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_CLSUBTENSORHANDLE_H__ */ diff --git a/arm_compute/graph2/backends/CL/CLTensorHandle.h b/arm_compute/graph2/backends/CL/CLTensorHandle.h deleted file mode 100644 index 0b20d1d8fc..0000000000 --- a/arm_compute/graph2/backends/CL/CLTensorHandle.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_CLTENSORHANDLE_H__ -#define __ARM_COMPUTE_GRAPH2_CLTENSORHANDLE_H__ - -#include "arm_compute/graph2/ITensorHandle.h" - -#include "arm_compute/runtime/CL/CLTensor.h" - -namespace arm_compute -{ -namespace graph2 -{ -namespace backends -{ -/** OpenCL Tensor handle interface object **/ -class CLTensorHandle final : public ITensorHandle -{ -public: - /** Default Constructor - * - * @param[in] info Tensor metadata - */ - CLTensorHandle(const ITensorInfo &info); - /** Destructor: free the tensor's memory */ - ~CLTensorHandle() = default; - /** Allow instances of this class to be move constructed */ - CLTensorHandle(CLTensorHandle &&) = default; - /** Allow instances of this class to be moved */ - CLTensorHandle &operator=(CLTensorHandle &&) = default; - - // Inherited overridden methods - void allocate() override; - arm_compute::ITensor &tensor() override; - const arm_compute::ITensor &tensor() const override; - void map(bool blocking) override; - void unmap() override; - void release_if_unused() override; - bool is_subtensor() const override; - -private: - arm_compute::CLTensor _tensor; /**< Backend Tensor */ -}; -} // namespace backends -} // namespace graph2 -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_CLTENSORHANDLE_H__ */ diff --git a/arm_compute/graph2/backends/GLES/GCDeviceBackend.h b/arm_compute/graph2/backends/GLES/GCDeviceBackend.h deleted file mode 100644 index 22ba91496b..0000000000 --- a/arm_compute/graph2/backends/GLES/GCDeviceBackend.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_GCDEVICEBACKEND_H__ -#define __ARM_COMPUTE_GRAPH2_GCDEVICEBACKEND_H__ - -#include "arm_compute/graph2/IDeviceBackend.h" - -#include "arm_compute/runtime/GLES_COMPUTE/GCBufferAllocator.h" - -namespace arm_compute -{ -namespace graph2 -{ -namespace backends -{ -/** GLES Compute device backend */ -class GCDeviceBackend final : public IDeviceBackend -{ -public: - /** Default Constructor */ - GCDeviceBackend(); - - // Inherited overridden methods - void initialize_backend() override; - void setup_backend_context(GraphContext &ctx) override; - std::unique_ptr<ITensorHandle> create_tensor(const Tensor &tensor) override; - std::unique_ptr<ITensorHandle> create_subtensor(ITensorHandle *parent, TensorShape shape, Coordinates coords, bool extend_parent) override; - std::unique_ptr<arm_compute::IFunction> configure_node(INode &node, GraphContext &ctx) override; - Status validate_node(INode &node) override; - std::shared_ptr<arm_compute::IMemoryManager> create_memory_manager(MemoryManagerAffinity affinity) override; - -private: - GCBufferAllocator _allocator; /**< GLES buffer affinity allocator */ -}; -} // namespace backends -} // namespace graph2 -} // namespace arm_compute -#endif //__ARM_COMPUTE_GRAPH2_GCDEVICEBACKEND_H__ diff --git a/arm_compute/graph2/backends/GLES/GCFunctionFactory.h b/arm_compute/graph2/backends/GLES/GCFunctionFactory.h deleted file mode 100644 index 4f7b2f451a..0000000000 --- a/arm_compute/graph2/backends/GLES/GCFunctionFactory.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_GCFUNCTIONFACTORY_H__ -#define __ARM_COMPUTE_GRAPH2_GCFUNCTIONFACTORY_H__ - -#include "arm_compute/runtime/IFunction.h" - -#include <memory> - -namespace arm_compute -{ -namespace graph2 -{ -// Forward declarations -class INode; -class GraphContext; - -namespace backends -{ -/** Factory for generating GLES compute backend functions **/ -class GCFunctionFactory final -{ -public: - /** Create a backend execution function depending on the node type - * - * @param[in] node Node to create the backend function for - * @param[in] ctx Context to use - * - * @return Backend function - */ - static std::unique_ptr<arm_compute::IFunction> create(INode *node, GraphContext &ctx); -}; -} // namespace backends -} // namespace graph2 -} // namespace arm_compute -#endif //__ARM_COMPUTE_GRAPH2_GCFUNCTIONFACTORY_H__ diff --git a/arm_compute/graph2/backends/GLES/GCNodeValidator.h b/arm_compute/graph2/backends/GLES/GCNodeValidator.h deleted file mode 100644 index 16b225b282..0000000000 --- a/arm_compute/graph2/backends/GLES/GCNodeValidator.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_GCNODEVALIDATOR_H__ -#define __ARM_COMPUTE_GRAPH2_GCNODEVALIDATOR_H__ - -#include "arm_compute/core/Error.h" - -namespace arm_compute -{ -namespace graph2 -{ -// Forward declarations -class INode; - -namespace backends -{ -class GCNodeValidator final -{ -public: - /** Validate a node - * - * @param[in] node Node to validate - * - * @return An error status - */ - static Status validate(INode *node); -}; -} // namespace backends -} // namespace graph2 -} // namespace arm_compute -#endif //__ARM_COMPUTE_GRAPH2_GCNODEVALIDATOR_H__ diff --git a/arm_compute/graph2/backends/GLES/GCTensorHandle.h b/arm_compute/graph2/backends/GLES/GCTensorHandle.h deleted file mode 100644 index 281adee428..0000000000 --- a/arm_compute/graph2/backends/GLES/GCTensorHandle.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_GCTENSORHANDLE_H__ -#define __ARM_COMPUTE_GRAPH2_GCTENSORHANDLE_H__ - -#include "arm_compute/graph2/ITensorHandle.h" - -#include "arm_compute/runtime/GLES_COMPUTE/GCTensor.h" - -namespace arm_compute -{ -namespace graph2 -{ -namespace backends -{ -/** GLES compute tensor handle interface object **/ -class GCTensorHandle final : public ITensorHandle -{ -public: - /** Default Constructor - * - * @param[in] info Tensor metadata - */ - GCTensorHandle(const ITensorInfo &info); - /** Destructor: free the tensor's memory */ - ~GCTensorHandle() = default; - /** Allow instances of this class to be move constructed */ - GCTensorHandle(GCTensorHandle &&) = default; - /** Allow instances of this class to be moved */ - GCTensorHandle &operator=(GCTensorHandle &&) = default; - - // Inherited overridden methods - void allocate() override; - arm_compute::ITensor &tensor() override; - const arm_compute::ITensor &tensor() const override; - void map(bool blocking) override; - void unmap() override; - void release_if_unused() override; - bool is_subtensor() const override; - -private: - arm_compute::GCTensor _tensor; /**< Backend Tensor */ -}; -} // namespace backends -} // namespace graph2 -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_GCTENSORHANDLE_H__ */ diff --git a/arm_compute/graph2/backends/NEON/NEDeviceBackend.h b/arm_compute/graph2/backends/NEON/NEDeviceBackend.h deleted file mode 100644 index e81e9d921e..0000000000 --- a/arm_compute/graph2/backends/NEON/NEDeviceBackend.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_NEDEVICEBACKEND_H__ -#define __ARM_COMPUTE_GRAPH2_NEDEVICEBACKEND_H__ - -#include "arm_compute/graph2/IDeviceBackend.h" - -#include "arm_compute/runtime/Allocator.h" - -namespace arm_compute -{ -namespace graph2 -{ -namespace backends -{ -/** NEON device backend */ -class NEDeviceBackend final : public IDeviceBackend -{ -public: - NEDeviceBackend(); - - // Inherited overridden methods - void initialize_backend() override; - void setup_backend_context(GraphContext &ctx) override; - std::unique_ptr<ITensorHandle> create_tensor(const Tensor &tensor) override; - std::unique_ptr<ITensorHandle> create_subtensor(ITensorHandle *parent, TensorShape shape, Coordinates coords, bool extend_parent) override; - std::unique_ptr<arm_compute::IFunction> configure_node(INode &node, GraphContext &ctx) override; - Status validate_node(INode &node) override; - std::shared_ptr<arm_compute::IMemoryManager> create_memory_manager(MemoryManagerAffinity affinity) override; - -private: - Allocator _allocator; /**< NEON backend allocator */ -}; -} // namespace backends -} // namespace graph2 -} // namespace arm_compute -#endif //__ARM_COMPUTE_GRAPH2_NEDEVICEBACKEND_H__ diff --git a/arm_compute/graph2/backends/NEON/NEFunctionFactory.h b/arm_compute/graph2/backends/NEON/NEFunctionFactory.h deleted file mode 100644 index 09ca49ae6c..0000000000 --- a/arm_compute/graph2/backends/NEON/NEFunctionFactory.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_NEFUNCTIONFACTORY_H__ -#define __ARM_COMPUTE_GRAPH2_NEFUNCTIONFACTORY_H__ - -#include "arm_compute/runtime/IFunction.h" - -#include <memory> - -namespace arm_compute -{ -namespace graph2 -{ -// Forward declarations -class INode; -class GraphContext; - -namespace backends -{ -/** Factory for generating NEON backend functions **/ -class NEFunctionFactory final -{ -public: - /** Create a backend execution function depending on the node type - * - * @param[in] node Node to create the backend function for - * @param[in] ctx Context to use - * - * @return Backend function - */ - static std::unique_ptr<arm_compute::IFunction> create(INode *node, GraphContext &ctx); -}; -} // namespace backends -} // namespace graph2 -} // namespace arm_compute -#endif //__ARM_COMPUTE_GRAPH2_NEFUNCTIONFACTORY_H__ diff --git a/arm_compute/graph2/backends/NEON/NENodeValidator.h b/arm_compute/graph2/backends/NEON/NENodeValidator.h deleted file mode 100644 index d39ab15a27..0000000000 --- a/arm_compute/graph2/backends/NEON/NENodeValidator.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_NENODEVALIDATOR_H__ -#define __ARM_COMPUTE_GRAPH2_NENODEVALIDATOR_H__ - -#include "arm_compute/core/Error.h" - -namespace arm_compute -{ -namespace graph2 -{ -// Forward declarations -class INode; - -namespace backends -{ -class NENodeValidator final -{ -public: - /** Validate a node - * - * @param[in] node Node to validate - * - * @return An error status - */ - static Status validate(INode *node); -}; -} // namespace backends -} // namespace graph2 -} // namespace arm_compute -#endif //__ARM_COMPUTE_GRAPH2_NENODEVALIDATOR_H__ diff --git a/arm_compute/graph2/backends/NEON/NESubTensorHandle.h b/arm_compute/graph2/backends/NEON/NESubTensorHandle.h deleted file mode 100644 index d62b66f343..0000000000 --- a/arm_compute/graph2/backends/NEON/NESubTensorHandle.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_NESUBTENSORHANDLE_H__ -#define __ARM_COMPUTE_GRAPH2_NESUBTENSORHANDLE_H__ - -#include "arm_compute/graph2/ITensorHandle.h" - -#include "arm_compute/runtime/SubTensor.h" - -namespace arm_compute -{ -namespace graph2 -{ -namespace backends -{ -/** NEON Sub-Tensor handle interface object **/ -class NESubTensorHandle final : public ITensorHandle -{ -public: - /** Default constructor - * - * @param[in] parent_handle Parent tensor handle - * @param[in] shape Sub-Tensor shape - * @param[in] coords Starting coordinates - * @param[in] extend_parent Extends parent shape if true - */ - NESubTensorHandle(ITensorHandle *parent_handle, const TensorShape &shape, const Coordinates &coords, bool extend_parent = false); - /** Destructor: free the tensor's memory */ - ~NESubTensorHandle() = default; - /** Allow instances of this class to be move constructed */ - NESubTensorHandle(NESubTensorHandle &&) = default; - /** Allow instances of this class to be moved */ - NESubTensorHandle &operator=(NESubTensorHandle &&) = default; - - // Inherited overridden methods - void allocate() override; - arm_compute::ITensor &tensor() override; - const arm_compute::ITensor &tensor() const override; - void map(bool blocking) override; - void unmap() override; - void release_if_unused() override; - bool is_subtensor() const override; - -private: - arm_compute::SubTensor _sub_tensor; /**< Backend Sub-Tensor */ -}; -} // namespace backends -} // namespace graph2 -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_NESUBTENSORHANDLE_H__ */ diff --git a/arm_compute/graph2/backends/NEON/NETensorHandle.h b/arm_compute/graph2/backends/NEON/NETensorHandle.h deleted file mode 100644 index 23fd7ccc69..0000000000 --- a/arm_compute/graph2/backends/NEON/NETensorHandle.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_NETENSORHANDLE_H__ -#define __ARM_COMPUTE_GRAPH2_NETENSORHANDLE_H__ - -#include "arm_compute/graph2/ITensorHandle.h" - -#include "arm_compute/runtime/Tensor.h" - -namespace arm_compute -{ -namespace graph2 -{ -namespace backends -{ -/** NEON Tensor handle interface object **/ -class NETensorHandle final : public ITensorHandle -{ -public: - /** Default Constructor - * - * @param[in] info Tensor metadata - */ - NETensorHandle(const ITensorInfo &info); - /** Destructor: free the tensor's memory */ - ~NETensorHandle() = default; - /** Allow instances of this class to be move constructed */ - NETensorHandle(NETensorHandle &&) = default; - /** Allow instances of this class to be moved */ - NETensorHandle &operator=(NETensorHandle &&) = default; - - // Inherited overridden methods - void allocate() override; - arm_compute::ITensor &tensor() override; - const arm_compute::ITensor &tensor() const override; - void map(bool blocking) override; - void unmap() override; - void release_if_unused() override; - bool is_subtensor() const override; - -private: - arm_compute::Tensor _tensor; /**< Backend Tensor */ -}; -} // namespace backends -} // namespace graph2 -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_NETENSORHANDLE_H__ */ diff --git a/arm_compute/graph2/backends/Utils.h b/arm_compute/graph2/backends/Utils.h deleted file mode 100644 index bba75757eb..0000000000 --- a/arm_compute/graph2/backends/Utils.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_BACKENDS_UTILS_H__ -#define __ARM_COMPUTE_GRAPH2_BACKENDS_UTILS_H__ - -#include "arm_compute/graph2/GraphContext.h" -#include "arm_compute/runtime/IMemoryManager.h" - -namespace arm_compute -{ -namespace graph2 -{ -namespace backends -{ -/** Creates and configures a named function - * - * @param[in] name Name of the function - * @param[in] args Function arguments - * - * @return A configured backend function - */ -template <typename FunctionType, typename FunctionNameType, typename... ParameterType> -std::pair<std::unique_ptr<arm_compute::IFunction>, FunctionNameType> create_named_function(FunctionNameType name, ParameterType... args) -{ - auto f = arm_compute::support::cpp14::make_unique<FunctionType>(); - f->configure(std::forward<ParameterType>(args)...); - return std::make_pair(std::move(f), name); -} - -/** Creates and configures a named function - * - * @param[in] name Name of the function - * @param[in] mm Memory manager to use - * @param[in] args Function arguments - * - * @return A configured backend function - */ -template <typename FunctionType, typename FunctionNameType, typename MemoryManagerType, typename... ParameterType> -std::pair<std::unique_ptr<arm_compute::IFunction>, FunctionNameType> create_named_memory_managed_function(FunctionNameType name, - MemoryManagerType mm, - ParameterType... args) -{ - auto f = arm_compute::support::cpp14::make_unique<FunctionType>(mm); - f->configure(std::forward<ParameterType>(args)...); - return std::make_pair(std::move(f), name); -} - -/** Checks if an operation is in place - * - * @param[in] input Pointer to input - * @param[in] output Pointer to output - * - * @return True if output is nullptr or input is equal to the output, else false - */ -inline bool is_in_place_operation(void *input, void *output) -{ - return (output == nullptr) || (input == output); -} - -/** Returns the memory manager for a given target - * - * @param[in] ctx Graph context containing memory management metadata - * @param[in] target Target to retrieve the memory manager from - * - * @return The memory manager for the given target else false - */ -inline std::shared_ptr<IMemoryManager> get_memory_manager(GraphContext &ctx, Target target) -{ - bool enabled = ctx.config().use_function_memory_manager && (ctx.memory_management_ctx(target) != nullptr); - return enabled ? ctx.memory_management_ctx(target)->mm : nullptr; -} -} // namespace backends -} // namespace graph2 -} // namespace arm_compute - -#endif /* __ARM_COMPUTE_GRAPH2_BACKENDS_UTILS_H__ */ diff --git a/arm_compute/graph2/backends/ValidateHelpers.h b/arm_compute/graph2/backends/ValidateHelpers.h deleted file mode 100644 index 0c93f0f138..0000000000 --- a/arm_compute/graph2/backends/ValidateHelpers.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_BACKENDS_DETAIL_VALIDATE_HELPERS_H__ -#define __ARM_COMPUTE_GRAPH2_BACKENDS_DETAIL_VALIDATE_HELPERS_H__ - -#include "arm_compute/graph2/Logger.h" -#include "arm_compute/graph2/Tensor.h" -#include "arm_compute/graph2/Types.h" -#include "arm_compute/graph2/nodes/Nodes.h" - -#include "arm_compute/core/Error.h" -#include "arm_compute/core/ITensorInfo.h" - -namespace arm_compute -{ -namespace graph2 -{ -namespace backends -{ -namespace detail -{ -/** Returns backing tensor info of a given tensor - * - * @param[in] tensor Tensor to extract the backing tensor from - * - * @return Backing tensor tensor info if present else nullptr - */ -inline arm_compute::ITensorInfo *get_backing_tensor_info(arm_compute::graph2::Tensor *tensor) -{ - return ((tensor == nullptr) || (tensor->handle() == nullptr)) ? nullptr : tensor->handle()->tensor().info(); -} - -/** Validates a Convolution layer node - * - * @tparam ConvolutionLayer Default Convolution layer function type - * @tparam DirectConvolutionLayer Direct Convolution layer function type - * @tparam GEMMConvolutionLayer GEMM Convolution layer function type - * @tparam WinogradConvolutionLayer Winograd Convolution layer function type - * - * @param[in] node Node to validate - * - * @return Status - */ -template <typename ConvolutionLayer, typename DirectConvolutionLayer, typename GEMMConvolutionLayer, typename WinogradConvolutionLayer> -Status validate_convolution_layer(ConvolutionLayerNode &node) -{ - ARM_COMPUTE_LOG_GRAPH_VERBOSE("Validating ConvolutionLayer node with ID : " << node.id() << " and Name: " << node.name() << std::endl); - ARM_COMPUTE_RETURN_ERROR_ON(node.num_inputs() != 3); - ARM_COMPUTE_RETURN_ERROR_ON(node.num_outputs() != 1); - - // Extract IO and info - arm_compute::ITensorInfo *input = get_backing_tensor_info(node.input(0)); - arm_compute::ITensorInfo *weights = get_backing_tensor_info(node.input(1)); - arm_compute::ITensorInfo *biases = get_backing_tensor_info(node.input(2)); - arm_compute::ITensorInfo *output = get_backing_tensor_info(node.output(0)); - const PadStrideInfo conv_info = node.convolution_info(); - const ConvolutionMethod conv_algorithm = node.convolution_method(); - - // Validate function - Status status{}; - switch(conv_algorithm) - { - case ConvolutionMethod::DIRECT: - status = DirectConvolutionLayer::validate(input, weights, biases, output, conv_info); - break; - case ConvolutionMethod::GEMM: - status = GEMMConvolutionLayer::validate(input, weights, biases, output, conv_info); - break; - case ConvolutionMethod::WINOGRAD: - status = WinogradConvolutionLayer::validate(input, weights, biases, output, conv_info); - break; - default: - break; - } - - // If validation fails try the Default approach - if(!bool(status) || (conv_algorithm == ConvolutionMethod::DEFAULT)) - { - status = ConvolutionLayer::validate(input, weights, biases, output, conv_info); - if(bool(status)) - { - ARM_COMPUTE_LOG_GRAPH_INFO("Switched ConvolutionLayer method of node with ID : " - << node.id() << " and Name: " << node.name() << std::endl); - node.set_convolution_method(ConvolutionMethod::DEFAULT); - } - } - - return status; -} - -/** Validates a Depthwise Convolution layer node - * - * @tparam DepthwiseConvolutionLayer Default Depthwise Convolution layer type - * @tparam DepthwiseConvolutionLayer3x3 Optimized 3x3 Depthwise Convolution layer type - * - * @param[in] node Node to validate - * - * @return Status - */ -template <typename DepthwiseConvolutionLayer, typename DepthwiseConvolutionLayer3x3> -Status validate_depthwise_convolution_layer(DepthwiseConvolutionLayerNode &node) -{ - ARM_COMPUTE_LOG_GRAPH_VERBOSE("Validating DepthwiseConvolutionLayer node with ID : " << node.id() << " and Name: " << node.name() << std::endl); - ARM_COMPUTE_RETURN_ERROR_ON(node.num_inputs() != 3); - ARM_COMPUTE_RETURN_ERROR_ON(node.num_outputs() != 1); - - // Extract IO and info - arm_compute::ITensorInfo *weights = detail::get_backing_tensor_info(node.input(1)); - const DepthwiseConvolutionMethod dwc_algorithm = node.depthwise_convolution_method(); - ARM_COMPUTE_ERROR_ON(weights == nullptr); - - // TODO (geopin01) : Switch when validation is implemented - // Validate function - if((dwc_algorithm == DepthwiseConvolutionMethod::OPTIMIZED_3x3) && (weights->tensor_shape().x() != 3)) - { - ARM_COMPUTE_LOG_GRAPH_INFO("Switched DepthwiseConvolutionLayer method of node with ID : " - << node.id() << " and Name: " << node.name() << std::endl); - node.set_depthwise_convolution_method(DepthwiseConvolutionMethod::DEFAULT); - } - - return Status{}; -} -} // namespace detail -} // namespace backends -} // namespace graph2 -} // namespace arm_compute - -#endif /* __ARM_COMPUTE_GRAPH2_BACKENDS_DETAIL_VALIDATE_HELPERS_H__ */ |