From 37d080f2f11cfd734104b76512e1fb191486216e Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Fri, 21 Jun 2019 18:43:12 +0100 Subject: COMPMID-2378: Sanitize GEMM configuration for NEON Change-Id: I7859b82b2059e14685f8792424648ac5eacd67f1 Signed-off-by: Georgios Pinitas Reviewed-on: https://review.mlplatform.org/c/1418 Comments-Addressed: Arm Jenkins Reviewed-by: Michele Di Giorgio Reviewed-by: Michalis Spyrou Tested-by: Arm Jenkins --- arm_compute/core/Types.h | 64 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 16 deletions(-) (limited to 'arm_compute/core/Types.h') diff --git a/arm_compute/core/Types.h b/arm_compute/core/Types.h index ad679d6786..b4d94eced4 100644 --- a/arm_compute/core/Types.h +++ b/arm_compute/core/Types.h @@ -1765,9 +1765,17 @@ class GEMMInfo { public: /** Default constructor */ - GEMMInfo() - : _is_a_reshaped(false), _is_b_reshaped(false), _reshape_b_only_on_first_run(true), _depth_output_gemm3d(0), _reinterpret_input_as_3d(false), _retain_internal_weights(false), _gemmlowp_output_stage(), - _fp_mixed_precision(false), _broadcast_bias(false) + GEMMInfo() noexcept + : _is_a_reshaped(false), + _is_b_reshaped(false), + _reshape_b_only_on_first_run(true), + _depth_output_gemm3d(0), + _reinterpret_input_as_3d(false), + _retain_internal_weights(false), + _gemmlowp_output_stage(), + _fp_mixed_precision(false), + _broadcast_bias(false), + _pretranpose_B(true) { } /** Constructor @@ -1785,10 +1793,17 @@ public: * @param[in] broadcast_bias (Optional) Broadcast the shape of the bias tensor from a vector to a matrix. */ GEMMInfo(bool is_a_reshaped, bool is_b_reshaped, bool reshape_b_only_on_first_run, int depth_output_gemm3d = 0, bool reinterpret_input_as_3d = false, bool retain_internal_weights = false, - GEMMLowpOutputStageInfo gemmlowp_output_stage = GEMMLowpOutputStageInfo(), bool fp_mixed_precision = false, bool broadcast_bias = false) - : _is_a_reshaped(is_a_reshaped), _is_b_reshaped(is_b_reshaped), _reshape_b_only_on_first_run(reshape_b_only_on_first_run), _depth_output_gemm3d(depth_output_gemm3d), - _reinterpret_input_as_3d(reinterpret_input_as_3d), _retain_internal_weights(retain_internal_weights), _gemmlowp_output_stage(gemmlowp_output_stage), _fp_mixed_precision(fp_mixed_precision), - _broadcast_bias(broadcast_bias) + GEMMLowpOutputStageInfo gemmlowp_output_stage = GEMMLowpOutputStageInfo(), bool fp_mixed_precision = false, bool broadcast_bias = false) noexcept + : _is_a_reshaped(is_a_reshaped), + _is_b_reshaped(is_b_reshaped), + _reshape_b_only_on_first_run(reshape_b_only_on_first_run), + _depth_output_gemm3d(depth_output_gemm3d), + _reinterpret_input_as_3d(reinterpret_input_as_3d), + _retain_internal_weights(retain_internal_weights), + _gemmlowp_output_stage(gemmlowp_output_stage), + _fp_mixed_precision(fp_mixed_precision), + _broadcast_bias(broadcast_bias), + _pretranpose_B(reshape_b_only_on_first_run) { } /** Flag which specifies if the matrix A has been reshaped @@ -1865,17 +1880,34 @@ public: { return _broadcast_bias; }; + /** Flag which specifies whether b should be pre-transposed if supported. + * + * @return True if b should be pre-transposed else false. + */ + bool pretranpose_B() const + { + return _pretranpose_B; + }; + /** Set pre-transpose b flag + * + * @param[in] flag Flag to set + */ + void set_pretranpose_B(bool flag) + { + _pretranpose_B = flag; + } private: - const bool _is_a_reshaped; - const bool _is_b_reshaped; - const bool _reshape_b_only_on_first_run; - const int _depth_output_gemm3d; - const bool _reinterpret_input_as_3d; - const bool _retain_internal_weights; - const GEMMLowpOutputStageInfo _gemmlowp_output_stage; - const bool _fp_mixed_precision; - const bool _broadcast_bias; + bool _is_a_reshaped; + bool _is_b_reshaped; + bool _reshape_b_only_on_first_run; + int _depth_output_gemm3d; + bool _reinterpret_input_as_3d; + bool _retain_internal_weights; + GEMMLowpOutputStageInfo _gemmlowp_output_stage; + bool _fp_mixed_precision; + bool _broadcast_bias; + bool _pretranpose_B; }; /** Winograd information */ -- cgit v1.2.1