From 6f8b17dedb7b53b550e6210fd1c78c3a3e086271 Mon Sep 17 00:00:00 2001 From: Joseph Dobson Date: Tue, 11 Feb 2020 19:32:11 +0000 Subject: [ONCPUML-7] arm_compute support for ND parallelism Currently 1D ranges of work are specified by the scheduler via two integers, start and end. This limit opportunities for advance parallelism and scheduling This patch expands the interfaces to allow for ND parallism. `GemmCommon::get_window_size` now returns an `NDRange` specifying the work in N-dimensions rather than with the single integer it used prior (1D) Execute now takes an `NDCoordinate` which specifies an `NDRange` with a start position for that work along with an `NDCoordinate` to specify the thread location In addition to expanding the interface to enable this functionality, we have added the capability to SGEMM when the number of threads is high this has the effective of allowing a much greater degree of parallelism where te problem dimension would previously have limited the number of threads. Change-Id: I3e1a8b7276216627bec4ff6f24ac2147552ea9fb Signed-off-by: Joseph Dobson Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/2962 Tested-by: Arm Jenkins Reviewed-by: Gian Marco Iodice Comments-Addressed: Arm Jenkins --- src/core/NEON/kernels/arm_gemm/gemm_interleaved.hpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/core/NEON/kernels/arm_gemm/gemm_interleaved.hpp') diff --git a/src/core/NEON/kernels/arm_gemm/gemm_interleaved.hpp b/src/core/NEON/kernels/arm_gemm/gemm_interleaved.hpp index efd984561d..4897bedf47 100644 --- a/src/core/NEON/kernels/arm_gemm/gemm_interleaved.hpp +++ b/src/core/NEON/kernels/arm_gemm/gemm_interleaved.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 ARM Limited. + * Copyright (c) 2017-2020 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -385,9 +385,9 @@ public: // out work in units of out_height. Factor batches into the window, but // not multi for now (as this would cause problems with the buffer // manager). - unsigned int get_window_size() const override { - // _Mround is a multiple of out_height by definition. - return (_Mround / strategy::out_height()) * _nbatches; + ndrange_t get_window_size() const override { + auto m_win_size = (_Mround / strategy::out_height()) * _nbatches; + return { m_win_size, 1u, 1u, 1u, 1u, 1u }; } // set_nthreads: pass on to buffer manager to avoid it waiting for non-existant threads. @@ -399,7 +399,7 @@ public: } // Execute - void execute(unsigned int start, unsigned int end, int threadid) override { + void execute_1d(unsigned int start, unsigned int end, int threadid) { if (_pretransposed) { execute_internal(start, end, threadid); } else { @@ -407,6 +407,16 @@ public: } } + //Execute + void execute(const ndcoord_t& work_range, const ndcoord_t& thread_locator, int threadid) override { + UNUSED(thread_locator); + + const auto start = work_range.get_position(0); + const auto stop = work_range.get_position_end(0); + + execute_1d(start, stop, threadid); + } + // Interface implementation - working space size_t get_working_size() const override { // In all cases, we need one A buffer plus a C buffer per thread. -- cgit v1.2.1