blob: 98bd95d7df9255f50f0e0e64aeb1139dee44a24e [file] [log] [blame]
Gian Marco Iodiceab182122017-10-09 15:05:40 +01001/*
Georgios Pinitase46a7be2019-02-18 15:16:14 +00002 * Copyright (c) 2017-2019 ARM Limited.
Gian Marco Iodiceab182122017-10-09 15:05:40 +01003 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24#include "arm_compute/runtime/NEON/functions/NEGEMMLowpMatrixMultiplyCore.h"
25
26#include "arm_compute/core/Error.h"
27#include "arm_compute/core/Helpers.h"
28#include "arm_compute/core/ITensor.h"
29#include "arm_compute/core/NEON/kernels/NEGEMMInterleave4x4Kernel.h"
Gian Marco Iodiceab182122017-10-09 15:05:40 +010030#include "arm_compute/core/NEON/kernels/NEGEMMLowpMatrixMultiplyKernel.h"
31#include "arm_compute/core/NEON/kernels/NEGEMMTranspose1xWKernel.h"
Gian Marco Iodiceab182122017-10-09 15:05:40 +010032#include "arm_compute/core/TensorInfo.h"
33#include "arm_compute/core/Types.h"
34#include "arm_compute/core/Validate.h"
Isabella Gottardie6630e42018-01-18 15:50:39 +000035#include "arm_compute/core/utils/misc/ShapeCalculator.h"
Gian Marco Iodiceab182122017-10-09 15:05:40 +010036#include "arm_compute/runtime/NEON/NEScheduler.h"
37#include "arm_compute/runtime/TensorAllocator.h"
38#include "support/ToolchainSupport.h"
39
40using namespace arm_compute;
Isabella Gottardie6630e42018-01-18 15:50:39 +000041using namespace arm_compute::misc::shape_calculator;
Gian Marco Iodiceab182122017-10-09 15:05:40 +010042
43NEGEMMLowpMatrixMultiplyCore::NEGEMMLowpMatrixMultiplyCore(std::shared_ptr<IMemoryManager> memory_manager)
Anthony Barbiereaefd002018-07-20 17:49:35 +010044 : _memory_group(memory_manager), _asm_glue(memory_manager), _mm_kernel(nullptr), _mtx_a_reshape_kernel(nullptr), _mtx_b_reshape_kernel(nullptr), _mtx_a_reduction_kernel(), _mtx_b_reduction_kernel(),
45 _offset_contribution_kernel(), _vector_sum_col(), _vector_sum_row(), _tmp_a(), _tmp_b(), _original_b(nullptr), _a_offset(0), _b_offset(0), _run_vector_matrix_multiplication(false),
46 _dot_product_path(false), _reshape_b_only_on_first_run(false), _is_prepared(false)
Gian Marco Iodiceab182122017-10-09 15:05:40 +010047{
48}
49
Gian Marco Iodice4b908652018-10-18 10:21:02 +010050void NEGEMMLowpMatrixMultiplyCore::configure(const ITensor *a, const ITensor *b, const ITensor *c, ITensor *output, const GEMMInfo &gemm_info)
Gian Marco Iodiceab182122017-10-09 15:05:40 +010051{
Georgios Pinitasa3b1b462017-11-16 19:24:39 +000052 ARM_COMPUTE_ERROR_ON_NULLPTR(a, b, output);
Gian Marco Iodice4b908652018-10-18 10:21:02 +010053 ARM_COMPUTE_UNUSED(c);
54 ARM_COMPUTE_ERROR_THROW_ON(NEGEMMLowpMatrixMultiplyCore::validate(a->info(), b->info(), c != nullptr ? c->info() : nullptr, output->info(), gemm_info));
Gian Marco Iodiceab182122017-10-09 15:05:40 +010055
Georgios Pinitas72219332018-06-05 14:56:06 +010056 // Clear state
Anthony Barbier71d9b572018-07-06 17:05:59 +010057 _mtx_a_reshape_kernel = nullptr;
58 _mtx_b_reshape_kernel = nullptr;
Georgios Pinitas72219332018-06-05 14:56:06 +010059
60 // Set internal variables
Gian Marcoc7f9b892017-11-30 14:31:13 +000061 _a_offset = a->info()->quantization_info().offset;
62 _b_offset = b->info()->quantization_info().offset;
63 _run_vector_matrix_multiplication = a->info()->dimension(1) < 2;
Giorgio Arenabb54e4e2018-04-05 17:20:34 +010064 _reshape_b_only_on_first_run = gemm_info.reshape_b_only_on_first_run();
Georgios Pinitas72219332018-06-05 14:56:06 +010065 _is_prepared = false;
66 _original_b = b;
Gian Marcoe75a02b2017-11-08 12:24:09 +000067
Pablo Telloeb82fd22018-02-23 13:43:50 +000068#ifdef __aarch64__
69 switch(a->info()->data_type())
Gian Marco Iodiceab182122017-10-09 15:05:40 +010070 {
Pablo Tello66c656a2018-03-15 10:34:58 +000071 case DataType::QASYMM8:
Pablo Telloeb82fd22018-02-23 13:43:50 +000072 case DataType::U8:
Anthony Barbiereaefd002018-07-20 17:49:35 +010073 case DataType::S8:
Pablo Telloeb82fd22018-02-23 13:43:50 +000074 {
Anthony Barbiereaefd002018-07-20 17:49:35 +010075 _asm_glue.configure(a, b, output, 1.f, 0.f, _reshape_b_only_on_first_run);
76 _dot_product_path = _asm_glue.is_configured();
Pablo Telloeb82fd22018-02-23 13:43:50 +000077 break;
78 }
79 default:
80 {
81 ARM_COMPUTE_ERROR("Datatype not supported");
82 break;
83 }
Gian Marco Iodiceab182122017-10-09 15:05:40 +010084 }
Pablo Telloeb82fd22018-02-23 13:43:50 +000085#endif /* __aarch64__ */
86 if(!_dot_product_path)
Gian Marco Iodiceab182122017-10-09 15:05:40 +010087 {
Gian Marcoc7f9b892017-11-30 14:31:13 +000088 if(_run_vector_matrix_multiplication)
Gian Marco Iodiceab182122017-10-09 15:05:40 +010089 {
Gian Marcoc7f9b892017-11-30 14:31:13 +000090 // Configure matrix multiply kernel
91 {
92 auto k = arm_compute::support::cpp14::make_unique<NEGEMMLowpMatrixMultiplyKernel>();
93 k->configure(a, b, output);
94 _mm_kernel = std::move(k);
95 }
Gian Marco Iodiceab182122017-10-09 15:05:40 +010096 }
Gian Marcoc7f9b892017-11-30 14:31:13 +000097 else
Gian Marco Iodiceab182122017-10-09 15:05:40 +010098 {
Gian Marcoc7f9b892017-11-30 14:31:13 +000099 // The interleaved output matrix will have the following shape: [ a_height * 4, ceil(a_width / 4.0f) ]
Georgios Pinitase46a7be2019-02-18 15:16:14 +0000100 TensorInfo info_a = a->info()->clone()->set_tensor_shape(compute_interleaved_shape(*a->info()));
Gian Marcoc7f9b892017-11-30 14:31:13 +0000101 // The transpose1xW output matrix will have the following shape: [ b_height * 16, ceil(b_width / 16.0f) ]
Georgios Pinitase46a7be2019-02-18 15:16:14 +0000102 TensorInfo info_b = b->info()->clone()->set_tensor_shape(compute_transpose1xW_shape(*b->info()));
Gian Marcoc7f9b892017-11-30 14:31:13 +0000103 _tmp_a.allocator()->init(info_a);
104 _tmp_b.allocator()->init(info_b);
105 _memory_group.manage(&_tmp_a);
Giorgio Arenabb54e4e2018-04-05 17:20:34 +0100106 if(!_reshape_b_only_on_first_run)
107 {
108 _memory_group.manage(&_tmp_b);
109 }
Gian Marcoc7f9b892017-11-30 14:31:13 +0000110
111 // Configure interleave kernel
112 {
113 auto k = arm_compute::support::cpp14::make_unique<NEGEMMInterleave4x4Kernel>();
114 k->configure(a, &_tmp_a);
115 _mtx_a_reshape_kernel = std::move(k);
116 }
117
118 // Configure transpose kernel
119 {
120 auto k = arm_compute::support::cpp14::make_unique<NEGEMMTranspose1xWKernel>();
121 k->configure(b, &_tmp_b);
122 _mtx_b_reshape_kernel = std::move(k);
123 }
124
125 // Configure matrix multiply kernel
126 {
127 auto k = arm_compute::support::cpp14::make_unique<NEGEMMLowpMatrixMultiplyKernel>();
128 k->configure(&_tmp_a, &_tmp_b, output);
129 _mm_kernel = std::move(k);
130 }
Gian Marco Iodiceab182122017-10-09 15:05:40 +0100131 }
Gian Marcoe75a02b2017-11-08 12:24:09 +0000132 }
Gian Marco Iodiceab182122017-10-09 15:05:40 +0100133
Gian Marcoe75a02b2017-11-08 12:24:09 +0000134 // Initialize matrix B reduction kernel only if _a_offset is not equal to 0
135 if(_a_offset != 0)
136 {
Isabella Gottardie6630e42018-01-18 15:50:39 +0000137 TensorInfo info_vector_sum_col(compute_reductionA_shape(*b->info()), 1, DataType::S32);
138
Gian Marcoe75a02b2017-11-08 12:24:09 +0000139 _vector_sum_col.allocator()->init(info_vector_sum_col);
Giorgio Arenabb54e4e2018-04-05 17:20:34 +0100140 if(!_reshape_b_only_on_first_run)
141 {
142 _memory_group.manage(&_vector_sum_col);
143 }
Gian Marcoe75a02b2017-11-08 12:24:09 +0000144
145 // Configure Matrix B reduction kernel
146 _mtx_b_reduction_kernel.configure(b, &_vector_sum_col, a->info()->dimension(0), false);
147 }
148
149 // Initialize Matrix A reduction kernel only if _b_offset is not equal to 0
150 if(_b_offset != 0)
151 {
Isabella Gottardie6630e42018-01-18 15:50:39 +0000152 TensorInfo info_vector_sum_row(compute_reductionB_shape(*a->info()), 1, DataType::S32);
153
Gian Marcoe75a02b2017-11-08 12:24:09 +0000154 _vector_sum_row.allocator()->init(info_vector_sum_row);
155 _memory_group.manage(&_vector_sum_row);
156
157 // Configure matrix A reduction kernel
158 _mtx_a_reduction_kernel.configure(a, &_vector_sum_row, a->info()->dimension(0), false);
159 }
160
161 // Configure offset contribution kernel
162 _offset_contribution_kernel.configure(output, _a_offset == 0 ? nullptr : &_vector_sum_col, _b_offset == 0 ? nullptr : &_vector_sum_row, a->info()->dimension(0), _a_offset, _b_offset);
163
164 // Allocate tensors
Gian Marcoc7f9b892017-11-30 14:31:13 +0000165 if(!_dot_product_path && !_run_vector_matrix_multiplication)
Gian Marcoe75a02b2017-11-08 12:24:09 +0000166 {
Pablo Tello6ff12a02017-11-02 16:09:35 +0000167 _tmp_a.allocator()->allocate();
Georgios Pinitas72219332018-06-05 14:56:06 +0100168 if(!_reshape_b_only_on_first_run)
169 {
170 _tmp_b.allocator()->allocate();
171 }
Pablo Tello6ff12a02017-11-02 16:09:35 +0000172 }
Gian Marcoe75a02b2017-11-08 12:24:09 +0000173
Georgios Pinitas72219332018-06-05 14:56:06 +0100174 if(_a_offset != 0 && !_reshape_b_only_on_first_run)
Gian Marcoe75a02b2017-11-08 12:24:09 +0000175 {
176 _vector_sum_col.allocator()->allocate();
177 }
178
179 if(_b_offset != 0)
180 {
181 _vector_sum_row.allocator()->allocate();
182 }
Gian Marco Iodiceab182122017-10-09 15:05:40 +0100183}
184
Gian Marco Iodice4b908652018-10-18 10:21:02 +0100185Status NEGEMMLowpMatrixMultiplyCore::validate(const ITensorInfo *a, const ITensorInfo *b, const ITensorInfo *c, const ITensorInfo *output, const GEMMInfo &gemm_info)
Georgios Pinitasa3b1b462017-11-16 19:24:39 +0000186{
187 ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(a, 1, DataType::QASYMM8);
188 ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output, 1, DataType::S32);
189 ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(a, b);
Gian Marco Iodice4b908652018-10-18 10:21:02 +0100190 ARM_COMPUTE_RETURN_ERROR_ON_MSG(c != nullptr, "Bias addition not supported in NEGEMMLowpMatrixMultiplyCore");
Georgios Pinitasa3b1b462017-11-16 19:24:39 +0000191 ARM_COMPUTE_RETURN_ERROR_ON_MSG((a)->dimension(0) != (b)->dimension(1),
192 "The product AB is defined only if the number of columns in A is equal to the number of rows in B");
Chunosov5124be52017-11-22 20:42:13 +0700193 ARM_COMPUTE_RETURN_ERROR_ON_MSG(gemm_info.is_a_reshaped(), "Matrix A already reshaped is not supported");
194 ARM_COMPUTE_RETURN_ERROR_ON_MSG(gemm_info.is_b_reshaped(), "Matrix B already reshaped is not supported");
Georgios Pinitasa3b1b462017-11-16 19:24:39 +0000195
Georgios Pinitasbb081ca2018-11-08 10:22:01 +0000196 int32_t a_offset = a->quantization_info().offset;
197 int32_t b_offset = b->quantization_info().offset;
198 const bool reshape_b_only_on_first_run = gemm_info.reshape_b_only_on_first_run();
Georgios Pinitasa3b1b462017-11-16 19:24:39 +0000199
Georgios Pinitasbb081ca2018-11-08 10:22:01 +0000200 // Check if we need to run the optimized assembly kernel
201 const bool run_optimised = bool(NEGEMMAssemblyDispatch::validate(a, b, output, 1.f, 0.f, reshape_b_only_on_first_run));
202
203 if(run_optimised)
Georgios Pinitasa3b1b462017-11-16 19:24:39 +0000204 {
Georgios Pinitasbb081ca2018-11-08 10:22:01 +0000205 if(output->total_size() != 0)
206 {
207 ARM_COMPUTE_RETURN_ERROR_ON(b->dimension(0) != output->dimension(0));
208 if(gemm_info.depth_output_gemm3d() != 0)
209 {
210 if(gemm_info.reinterpret_input_as_3d())
211 {
212 ARM_COMPUTE_RETURN_ERROR_ON(a->dimension(1) != output->dimension(1));
213 ARM_COMPUTE_RETURN_ERROR_ON(a->dimension(2) != output->dimension(2));
214 }
215 else
216 {
217 ARM_COMPUTE_RETURN_ERROR_ON(a->dimension(1) != output->dimension(1) * output->dimension(2));
218 }
219 }
220 else
221 {
222 ARM_COMPUTE_RETURN_ERROR_ON(a->dimension(1) != output->dimension(1));
223 }
224 }
Georgios Pinitasa3b1b462017-11-16 19:24:39 +0000225 }
226 else
Georgios Pinitasa3b1b462017-11-16 19:24:39 +0000227 {
Georgios Pinitasbb081ca2018-11-08 10:22:01 +0000228 ARM_COMPUTE_RETURN_ERROR_ON_MSG(gemm_info.reinterpret_input_as_3d(), "NEGEMM cannot reinterpret the input tensor as 3D");
229 ARM_COMPUTE_RETURN_ERROR_ON_MSG(gemm_info.depth_output_gemm3d() != 0, "NEGEMM cannot reinterpret the output tensor as 3D");
230
231 const bool run_vector_matrix_multiplication = a->dimension(1) < 2;
232 if(!run_vector_matrix_multiplication)
233 {
234 // The interleaved output matrix will have the following shape: [ a_height * 4, ceil(a_width / 4.0f) ]
235 TensorShape shape_tmp_a = a->tensor_shape();
236 shape_tmp_a.set(0, a->dimension(0) * 4);
237 shape_tmp_a.set(1, std::ceil(a->dimension(1) / 4.f));
238
239 // The transpose1xW output matrix will have the following shape: [ b_height * 16, ceil(b_width / 16.0f) ]
240 TensorShape shape_tmp_b = b->tensor_shape();
241 shape_tmp_b.set(0, b->dimension(1) * 16);
242 shape_tmp_b.set(1, std::ceil(b->dimension(0) / 16.f));
243
Georgios Pinitase46a7be2019-02-18 15:16:14 +0000244 TensorInfo info_a = a->clone()->set_tensor_shape(shape_tmp_a);
245 TensorInfo info_b = b->clone()->set_tensor_shape(shape_tmp_b);
Georgios Pinitasbb081ca2018-11-08 10:22:01 +0000246
247 ARM_COMPUTE_RETURN_ON_ERROR(NEGEMMInterleave4x4Kernel::validate(a, &info_a));
248 ARM_COMPUTE_RETURN_ON_ERROR(NEGEMMTranspose1xWKernel::validate(b, &info_b));
249 ARM_COMPUTE_RETURN_ON_ERROR(NEGEMMLowpMatrixMultiplyKernel::validate(&info_a, &info_b, output));
250 }
251 else
252 {
253 ARM_COMPUTE_RETURN_ON_ERROR(NEGEMMLowpMatrixMultiplyKernel::validate(a, b, output));
254 }
Georgios Pinitasa3b1b462017-11-16 19:24:39 +0000255 }
256
257 TensorInfo info_vector_sum_col, info_vector_sum_row;
258
259 // Validate matrix B reduction kernel only if _a_offset is not equal to 0
260 if(a_offset != 0)
261 {
Isabella Gottardie6630e42018-01-18 15:50:39 +0000262 info_vector_sum_col = TensorInfo(compute_reductionA_shape(*b), 1, DataType::S32);
Georgios Pinitasa3b1b462017-11-16 19:24:39 +0000263
264 // Configure Matrix B reduction kernel
265 ARM_COMPUTE_RETURN_ON_ERROR(NEGEMMLowpMatrixBReductionKernel::validate(b, &info_vector_sum_col, a->dimension(0), false));
266 }
267
268 // Validate Matrix A reduction kernel only if _b_offset is not equal to 0
269 if(b_offset != 0)
270 {
Isabella Gottardie6630e42018-01-18 15:50:39 +0000271 info_vector_sum_row = TensorInfo(compute_reductionB_shape(*a), 1, DataType::S32);
Georgios Pinitasa3b1b462017-11-16 19:24:39 +0000272
273 // Configure matrix A reduction kernel
274 ARM_COMPUTE_RETURN_ON_ERROR(NEGEMMLowpMatrixAReductionKernel::validate(a, &info_vector_sum_row, a->dimension(0), false));
275 }
276
277 // Validate offset contribution kernel
278 ARM_COMPUTE_RETURN_ON_ERROR(NEGEMMLowpOffsetContributionKernel::validate(output,
279 a_offset == 0 ? nullptr : &info_vector_sum_col,
280 b_offset == 0 ? nullptr : &info_vector_sum_row,
281 a_offset, b_offset));
282
Georgios Pinitas631c41a2017-12-06 11:53:03 +0000283 return Status{};
Georgios Pinitasa3b1b462017-11-16 19:24:39 +0000284}
285
Gian Marco Iodiceab182122017-10-09 15:05:40 +0100286void NEGEMMLowpMatrixMultiplyCore::run()
287{
Georgios Pinitas72219332018-06-05 14:56:06 +0100288 prepare();
289
Gian Marco Iodiceab182122017-10-09 15:05:40 +0100290 _memory_group.acquire();
291
Georgios Pinitas72219332018-06-05 14:56:06 +0100292 // Reshape inputs
293 if(_mtx_a_reshape_kernel)
Pablo Tello6ff12a02017-11-02 16:09:35 +0000294 {
Georgios Pinitas72219332018-06-05 14:56:06 +0100295 NEScheduler::get().schedule(_mtx_a_reshape_kernel.get(), Window::DimY);
296 }
297 if(_mtx_b_reshape_kernel && !_reshape_b_only_on_first_run)
298 {
299 NEScheduler::get().schedule(_mtx_b_reshape_kernel.get(), Window::DimY);
Pablo Tello6ff12a02017-11-02 16:09:35 +0000300 }
Gian Marco Iodiceab182122017-10-09 15:05:40 +0100301
Georgios Pinitas72219332018-06-05 14:56:06 +0100302 // Run GEMM
Anthony Barbiereaefd002018-07-20 17:49:35 +0100303 if(_asm_glue.is_configured())
Pablo Telloeb82fd22018-02-23 13:43:50 +0000304 {
Anthony Barbiereaefd002018-07-20 17:49:35 +0100305 _asm_glue.run();
Pablo Telloeb82fd22018-02-23 13:43:50 +0000306 }
307 else
308 {
309 NEScheduler::get().schedule(_mm_kernel.get(), Window::DimY);
310 }
Gian Marco Iodiceab182122017-10-09 15:05:40 +0100311
Gian Marcoe75a02b2017-11-08 12:24:09 +0000312 // Run matrix A reduction kernel only if _b_offset is not equal to 0
313 if(_b_offset != 0)
314 {
315 NEScheduler::get().schedule(&_mtx_a_reduction_kernel, Window::DimX);
316 }
317
318 // Run matrix B reduction kernel only if _a_offset is not equal to 0
Georgios Pinitas72219332018-06-05 14:56:06 +0100319 if(_a_offset != 0 && !_reshape_b_only_on_first_run)
Gian Marcoe75a02b2017-11-08 12:24:09 +0000320 {
321 NEScheduler::get().schedule(&_mtx_b_reduction_kernel, Window::DimX);
322 }
323
324 // Run offset contribution kernel
325 NEScheduler::get().schedule(&_offset_contribution_kernel, Window::DimY);
326
Gian Marco Iodiceab182122017-10-09 15:05:40 +0100327 _memory_group.release();
Georgios Pinitas72219332018-06-05 14:56:06 +0100328}
Giorgio Arenabb54e4e2018-04-05 17:20:34 +0100329
Georgios Pinitas72219332018-06-05 14:56:06 +0100330void NEGEMMLowpMatrixMultiplyCore::prepare()
331{
332 if(!_is_prepared)
333 {
334 // Run assembly reshape
Anthony Barbiereaefd002018-07-20 17:49:35 +0100335 if(_asm_glue.is_configured() && _reshape_b_only_on_first_run)
Georgios Pinitas72219332018-06-05 14:56:06 +0100336 {
337 ARM_COMPUTE_ERROR_ON(!_original_b->is_used());
338
Anthony Barbiereaefd002018-07-20 17:49:35 +0100339 _asm_glue.prepare();
Georgios Pinitas72219332018-06-05 14:56:06 +0100340 _original_b->mark_as_unused();
341 }
342 // Run non-assembly reshape
343 else if(_mtx_b_reshape_kernel && _reshape_b_only_on_first_run)
344 {
345 ARM_COMPUTE_ERROR_ON(!_original_b->is_used());
346
347 // Run reshape kernel and mark original weights tensor as unused
348 _tmp_b.allocator()->allocate();
349 NEScheduler::get().schedule(_mtx_b_reshape_kernel.get(), Window::DimY);
350 _original_b->mark_as_unused();
351 }
352
353 // Run matrix B reduction kernel only if _a_offset is not equal to 0
354 if(_a_offset != 0 && _reshape_b_only_on_first_run)
355 {
356 _vector_sum_col.allocator()->allocate();
357 NEScheduler::get().schedule(&_mtx_b_reduction_kernel, Window::DimX);
358 }
359
360 _is_prepared = true;
361 }
Pablo Tello6ff12a02017-11-02 16:09:35 +0000362}