MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / configure_mm

Method configure_mm

src/gpu/cl/operators/ClGemmConv2d.cpp:76–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74ClGemmConv2d::~ClGemmConv2d() = default;
75
76void ClGemmConv2d::configure_mm(const ClCompileContext &compile_context,
77 const ITensorInfo *src,
78 ITensorInfo *weights,
79 ITensorInfo *biases,
80 ITensorInfo *dst,
81 const GEMMLowpOutputStageInfo &gemmlowp_output_stage,
82 int gemm_3d_depth,
83 const ActivationLayerInfo &act_info)
84{
85 ARM_COMPUTE_ERROR_ON_NULLPTR(src, weights);
86 ARM_COMPUTE_ERROR_THROW_ON(
87 validate_mm(src, weights, biases, dst, gemmlowp_output_stage, gemm_3d_depth, _skip_im2col, act_info));
88
89 const GEMMInfo &gemm_info = GEMMInfo(false, // is_a_reshaped
90 false, // is_b_reshaped
91 true, // reshape_b_only_on_first_run
92 gemm_3d_depth, // depth_output_gemm3d
93 _skip_im2col, // reinterpret_input_as_3d
94 false, // retain_internal_weights
95 gemmlowp_output_stage, // gemmlowp_output_stage
96 false, // fast_math
97 false, // fp_mixed_precision
98 true, // broadcast_bias
99 act_info // activation_info
100 );
101
102 TensorInfo tmp_src{*src};
103 if (_is_quantized)
104 {
105 // Since we need negative offsets for computing convolution, we need to change QuantizationInfo()
106 // Extract and negate input and weights offset
107 const QuantizationInfo input_quantization_info = src->quantization_info();
108 const QuantizationInfo weights_quantization_info = weights->quantization_info();
109
110 tmp_src.set_quantization_info(
111 QuantizationInfo(input_quantization_info.uniform().scale, -input_quantization_info.uniform().offset));
112 weights->set_quantization_info(
113 QuantizationInfo(weights_quantization_info.uniform().scale, -weights_quantization_info.uniform().offset));
114
115 _mm_gemmlowp = std::make_unique<ClGemmLowpMatrixMultiplyCore>();
116 _mm_gemmlowp->configure(compile_context, &tmp_src, weights, biases, dst, gemm_info);
117
118 // Revert back QuantizatioInfo as weights could be used in other convolution layers
119 weights->set_quantization_info(weights_quantization_info);
120
121 auto mm_mem_req = _mm_gemmlowp->workspace();
122 for (unsigned int cont = 0; cont < mm_mem_req.size(); ++cont)
123 {
124 _aux_mem[cont] = mm_mem_req[cont];
125 }
126 }
127 else
128 {
129 // Configure matrix multiply function
130 _mm_gemm = std::make_unique<ClGemm>();
131 _mm_gemm->configure(compile_context, &tmp_src, weights, biases, dst, 1.0f, 1.0f, gemm_info);
132 auto mm_mem_req = _mm_gemm->workspace();
133 for (unsigned int cont = 0; cont < mm_mem_req.size(); ++cont)

Callers

nothing calls this directly

Calls 8

GEMMInfoClass · 0.85
validate_mmFunction · 0.70
QuantizationInfoClass · 0.50
quantization_infoMethod · 0.45
uniformMethod · 0.45
configureMethod · 0.45
workspaceMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected