aboutsummaryrefslogtreecommitdiff
path: root/arm_compute
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2018-03-27 17:15:49 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:49:16 +0000
commitfbb805450c1509cee2d9270bc8e04ce9165ac4bc (patch)
treea97ace1862360e232268b5071b79d6cdaf887455 /arm_compute
parent3672df36e7b61f280d66b6cbb11c2b4254fbbc8c (diff)
downloadComputeLibrary-fbb805450c1509cee2d9270bc8e04ce9165ac4bc.tar.gz
COMPMID-1028: Add GLES backend
Change-Id: If3172cdb6528dbc20262836174aedaef52c78bdb Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/126111 Tested-by: Jenkins <bsgcomp@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'arm_compute')
-rw-r--r--arm_compute/graph2/Types.h1
-rw-r--r--arm_compute/graph2/Utils.h4
-rw-r--r--arm_compute/graph2/backends/GLES/GCDeviceBackend.h59
-rw-r--r--arm_compute/graph2/backends/GLES/GCFunctionFactory.h57
-rw-r--r--arm_compute/graph2/backends/GLES/GCNodeValidator.h52
-rw-r--r--arm_compute/graph2/backends/GLES/GCTensorHandle.h67
6 files changed, 239 insertions, 1 deletions
diff --git a/arm_compute/graph2/Types.h b/arm_compute/graph2/Types.h
index b619cf1673..2625657393 100644
--- a/arm_compute/graph2/Types.h
+++ b/arm_compute/graph2/Types.h
@@ -93,6 +93,7 @@ enum class Target
UNSPECIFIED, /**< Unspecified Target */
NEON, /**< NEON capable target device */
CL, /**< OpenCL capable target device */
+ GC, /**< GLES compute capable target device */
};
/** Supported Element-wise operations */
diff --git a/arm_compute/graph2/Utils.h b/arm_compute/graph2/Utils.h
index 750665a491..0295bcb9af 100644
--- a/arm_compute/graph2/Utils.h
+++ b/arm_compute/graph2/Utils.h
@@ -84,9 +84,11 @@ Target get_default_target();
void force_target_to_graph(Graph &g, Target target);
/** Creates a default @ref PassManager
*
+ * @param[in] target Target to create the pass manager for
+ *
* @return A PassManager with default mutating passes
*/
-PassManager create_default_pass_manager();
+PassManager create_default_pass_manager(Target target);
/** Default setups the graph context if not done manually
*
* @param[in] ctx Graph Context
diff --git a/arm_compute/graph2/backends/GLES/GCDeviceBackend.h b/arm_compute/graph2/backends/GLES/GCDeviceBackend.h
new file mode 100644
index 0000000000..22ba91496b
--- /dev/null
+++ b/arm_compute/graph2/backends/GLES/GCDeviceBackend.h
@@ -0,0 +1,59 @@
+/*
+ * 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
new file mode 100644
index 0000000000..4f7b2f451a
--- /dev/null
+++ b/arm_compute/graph2/backends/GLES/GCFunctionFactory.h
@@ -0,0 +1,57 @@
+/*
+ * 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
new file mode 100644
index 0000000000..16b225b282
--- /dev/null
+++ b/arm_compute/graph2/backends/GLES/GCNodeValidator.h
@@ -0,0 +1,52 @@
+/*
+ * 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
new file mode 100644
index 0000000000..8ead236614
--- /dev/null
+++ b/arm_compute/graph2/backends/GLES/GCTensorHandle.h
@@ -0,0 +1,67 @@
+/*
+ * 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;
+ 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__ */