aboutsummaryrefslogtreecommitdiff
path: root/src/core/GLES_COMPUTE
diff options
context:
space:
mode:
authorMichele Di Giorgio <michele.digiorgio@arm.com>2018-04-25 11:58:07 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:51:50 +0000
commitb8fc60fc9fe9ad6c48d9618fc65753fbe5813216 (patch)
treea9f271d73f573686ba29c724bb3a3cee4b6b203b /src/core/GLES_COMPUTE
parent62385bce6baacfa194cff9e6be6d8eaa73bc3fab (diff)
downloadComputeLibrary-b8fc60fc9fe9ad6c48d9618fc65753fbe5813216.tar.gz
COMPMID-1086: Optimizing GCGEMM - Add helpers to get target GPU information
This patch moves some of the helper functions in CLHelpers.[h,cpp] to GPUTarget.[h,cpp] in order to make them avaialable to both CL and GLES backends. Change-Id: Ib89b05a2084b73eb643b32fac13b8367cc80b6a5 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/128988 Tested-by: Jenkins <bsgcomp@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'src/core/GLES_COMPUTE')
-rw-r--r--src/core/GLES_COMPUTE/GCHelpers.cpp34
-rw-r--r--src/core/GLES_COMPUTE/IGCKernel.cpp2
-rw-r--r--src/core/GLES_COMPUTE/OpenGLES.cpp18
-rw-r--r--src/core/GLES_COMPUTE/gl_entries.in1
-rw-r--r--src/core/GLES_COMPUTE/kernels/GCGEMMInterleave4x4Kernel.cpp1
-rw-r--r--src/core/GLES_COMPUTE/kernels/GCGEMMMatrixAdditionKernel.cpp3
-rw-r--r--src/core/GLES_COMPUTE/kernels/GCGEMMMatrixMultiplyKernel.cpp6
-rw-r--r--src/core/GLES_COMPUTE/kernels/GCTensorShiftKernel.cpp1
-rw-r--r--src/core/GLES_COMPUTE/kernels/GCWeightsReshapeKernel.cpp1
9 files changed, 57 insertions, 10 deletions
diff --git a/src/core/GLES_COMPUTE/GCHelpers.cpp b/src/core/GLES_COMPUTE/GCHelpers.cpp
new file mode 100644
index 0000000000..8970688ca7
--- /dev/null
+++ b/src/core/GLES_COMPUTE/GCHelpers.cpp
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+#include "arm_compute/core/GLES_COMPUTE/GCHelpers.h"
+
+namespace arm_compute
+{
+GPUTarget get_target_from_device()
+{
+ const std::string device_name = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
+
+ return get_target_from_name(device_name);
+}
+} // namespace arm_compute
diff --git a/src/core/GLES_COMPUTE/IGCKernel.cpp b/src/core/GLES_COMPUTE/IGCKernel.cpp
index 55b7f0da4a..ecd63b54a4 100644
--- a/src/core/GLES_COMPUTE/IGCKernel.cpp
+++ b/src/core/GLES_COMPUTE/IGCKernel.cpp
@@ -62,7 +62,7 @@ void arm_compute::enqueue(IGCKernel &kernel, const Window &window, const gles::N
}
IGCKernel::IGCKernel()
- : _kernel(), _lws_hint(gles::NDRange(1U, 1U, 1U))
+ : _kernel(), _lws_hint(gles::NDRange(1U, 1U, 1U)), _target(GPUTarget::MIDGARD)
{
}
diff --git a/src/core/GLES_COMPUTE/OpenGLES.cpp b/src/core/GLES_COMPUTE/OpenGLES.cpp
index d2539d0775..e93b360125 100644
--- a/src/core/GLES_COMPUTE/OpenGLES.cpp
+++ b/src/core/GLES_COMPUTE/OpenGLES.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -66,7 +66,8 @@ using glMapBufferRange_func = void *GL_APIENTRY (*)(GLenum target, GLin
using glMemoryBarrier_func = void GL_APIENTRY (*)(GLbitfield barriers);
using glUniform1ui_func = void GL_APIENTRY (*)(GLint location, GLuint v0);
using glUnmapBuffer_func = GLboolean GL_APIENTRY (*)(GLenum target);
-using glGetError_func = GLenum GL_APIENTRY (*)();
+using glGetError_func = GLenum GL_APIENTRY (*)();
+using glGetString_func = const GLubyte * GL_APIENTRY (*)(GLenum name);
using glGetActiveUniformBlockiv_func = void GL_APIENTRY (*)(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
using glUniformBlockBinding_func = void GL_APIENTRY (*)(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
using glGetUniformBlockIndex_func = GLuint GL_APIENTRY (*)(GLuint program, const GLchar *uniformBlockName);
@@ -668,6 +669,19 @@ GLenum GL_APIENTRY glGetError(void)
}
}
+const GLubyte *GL_APIENTRY glGetString(GLenum name)
+{
+ auto func = GLESSymbols::get().glGetString;
+ if(func != nullptr)
+ {
+ return func(name);
+ }
+ else
+ {
+ return nullptr;
+ }
+}
+
void GL_APIENTRY glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params)
{
auto func = GLESSymbols::get().glGetActiveUniformBlockiv;
diff --git a/src/core/GLES_COMPUTE/gl_entries.in b/src/core/GLES_COMPUTE/gl_entries.in
index 15ce8ee819..17e3aeead7 100644
--- a/src/core/GLES_COMPUTE/gl_entries.in
+++ b/src/core/GLES_COMPUTE/gl_entries.in
@@ -61,3 +61,4 @@ GL_ENTRY(glGenFramebuffers)
GL_ENTRY(glDeleteFramebuffers)
GL_ENTRY(glBindFramebuffer)
GL_ENTRY(glFramebufferTexture2D)
+GL_ENTRY(glGetString)
diff --git a/src/core/GLES_COMPUTE/kernels/GCGEMMInterleave4x4Kernel.cpp b/src/core/GLES_COMPUTE/kernels/GCGEMMInterleave4x4Kernel.cpp
index dc86bfb2cc..171fbad702 100644
--- a/src/core/GLES_COMPUTE/kernels/GCGEMMInterleave4x4Kernel.cpp
+++ b/src/core/GLES_COMPUTE/kernels/GCGEMMInterleave4x4Kernel.cpp
@@ -35,7 +35,6 @@
#include "arm_compute/core/Window.h"
using namespace arm_compute;
-using namespace arm_compute::gles_compute;
GCGEMMInterleave4x4Kernel::GCGEMMInterleave4x4Kernel()
: _input(nullptr), _output(nullptr)
diff --git a/src/core/GLES_COMPUTE/kernels/GCGEMMMatrixAdditionKernel.cpp b/src/core/GLES_COMPUTE/kernels/GCGEMMMatrixAdditionKernel.cpp
index 43846dcf32..1a68a62ea5 100644
--- a/src/core/GLES_COMPUTE/kernels/GCGEMMMatrixAdditionKernel.cpp
+++ b/src/core/GLES_COMPUTE/kernels/GCGEMMMatrixAdditionKernel.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -34,7 +34,6 @@
#include "arm_compute/core/Window.h"
using namespace arm_compute;
-using namespace arm_compute::gles_compute;
GCGEMMMatrixAdditionKernel::GCGEMMMatrixAdditionKernel()
: _input(nullptr), _output(nullptr)
diff --git a/src/core/GLES_COMPUTE/kernels/GCGEMMMatrixMultiplyKernel.cpp b/src/core/GLES_COMPUTE/kernels/GCGEMMMatrixMultiplyKernel.cpp
index b4bb5470ad..2bd769cac4 100644
--- a/src/core/GLES_COMPUTE/kernels/GCGEMMMatrixMultiplyKernel.cpp
+++ b/src/core/GLES_COMPUTE/kernels/GCGEMMMatrixMultiplyKernel.cpp
@@ -42,7 +42,6 @@
#include <string>
using namespace arm_compute;
-using namespace arm_compute::gles_compute;
using namespace arm_compute::misc::shape_calculator;
namespace
@@ -195,10 +194,13 @@ void GCGEMMMatrixMultiplyKernel::configure(const IGCTensor *input0, const IGCTen
_input1 = input1;
_output = output;
+ // Get target architecture
+ GPUTarget gpu_target = get_target();
+
ElementsProcessed num_elements_processed{};
// Configure kernel window
- auto win_config = validate_and_configure_window(input0->info(), input1->info(), output->info(), is_interleaved_transposed, reshape_info, GPUTarget::UNKNOWN, num_elements_processed);
+ auto win_config = validate_and_configure_window(input0->info(), input1->info(), output->info(), is_interleaved_transposed, reshape_info, gpu_target, num_elements_processed);
ARM_COMPUTE_ERROR_THROW_ON(win_config.first);
IGCKernel::configure(win_config.second);
diff --git a/src/core/GLES_COMPUTE/kernels/GCTensorShiftKernel.cpp b/src/core/GLES_COMPUTE/kernels/GCTensorShiftKernel.cpp
index 21946b7f8d..f0057df769 100644
--- a/src/core/GLES_COMPUTE/kernels/GCTensorShiftKernel.cpp
+++ b/src/core/GLES_COMPUTE/kernels/GCTensorShiftKernel.cpp
@@ -36,7 +36,6 @@
#include "support/ToolchainSupport.h"
using namespace arm_compute;
-using namespace arm_compute::gles_compute;
GCTensorShiftKernel::GCTensorShiftKernel()
: _input(nullptr), _lws(gles::NDRange(1U, 1U, 1U)), _left_padding(0)
diff --git a/src/core/GLES_COMPUTE/kernels/GCWeightsReshapeKernel.cpp b/src/core/GLES_COMPUTE/kernels/GCWeightsReshapeKernel.cpp
index 55bf9b754b..ccbfaf8410 100644
--- a/src/core/GLES_COMPUTE/kernels/GCWeightsReshapeKernel.cpp
+++ b/src/core/GLES_COMPUTE/kernels/GCWeightsReshapeKernel.cpp
@@ -36,7 +36,6 @@
#include "arm_compute/core/GLES_COMPUTE/GCHelpers.h"
using namespace arm_compute;
-using namespace arm_compute::gles_compute;
using namespace arm_compute::misc::shape_calculator;
GCWeightsReshapeKernel::GCWeightsReshapeKernel()