@@ -152,6 +152,33 @@ private:
152152 UnquantizeAndWrite config;
153153};
154154
155+ /*
156+ * UnquantizeAndWriteRelu
157+ */
158+ template <> class CallbackImpl <CPUType::CPU_NAME , UnquantizeAndWriteRelu> {
159+ public:
160+ explicit INTGEMM_TARGET_CONSTRUCTOR CallbackImpl (const UnquantizeAndWriteRelu& config) : config(config) {
161+ unquant_mult = set1_ps<vf>(config.unquant_mult );
162+ }
163+
164+ INTGEMM_TARGET void Run (vi input, const OutputBufferInfo& info) {
165+ // Workaround gcc 5 internal compiler error that can't read register members in debug.
166+ vf mult_reg;
167+ #if !defined(__OPTIMIZE__) && (__GNUC__ == 5) && !defined(__clang__) && !defined(__INTEL_COMPILER)
168+ asm (" vmovdqa %1, %0" : " =x" (mult_reg) : " m" (unquant_mult));
169+ #else
170+ mult_reg = unquant_mult;
171+ #endif
172+ auto result = kernels::relu<float >(kernels::unquantize (input, mult_reg));
173+ kernels::write (result, config.output_addr , info.row_idx * info.cols + info.col_idx );
174+ }
175+
176+ private:
177+ vf unquant_mult;
178+ UnquantizeAndWriteRelu config;
179+ };
180+
181+
155182/*
156183 * AddBiasAndWrite
157184 */
@@ -194,6 +221,33 @@ private:
194221 UnquantizeAndAddBiasAndWrite config;
195222};
196223
224+ /*
225+ * UnquantizeAndAddBiasAndWrite
226+ */
227+ template <> class CallbackImpl <CPUType::CPU_NAME , UnquantizeAndAddBiasAndWriteRelu> {
228+ public:
229+ explicit INTGEMM_TARGET_CONSTRUCTOR CallbackImpl (const UnquantizeAndAddBiasAndWriteRelu& config) : config(config) {
230+ unquant_mult = set1_ps<vf>(config.unquant_mult );
231+ }
232+
233+ INTGEMM_TARGET void Run (vi input, const OutputBufferInfo& info) {
234+ // Workaround gcc 5 internal compiler error that can't read register members in debug.
235+ vf mult_reg;
236+ #if !defined(__OPTIMIZE__) && (__GNUC__ == 5) && !defined(__clang__) && !defined(__INTEL_COMPILER)
237+ asm (" vmovdqa %1, %0" : " =x" (mult_reg) : " m" (unquant_mult));
238+ #else
239+ mult_reg = unquant_mult;
240+ #endif
241+ auto result = kernels::unquantize (input, mult_reg);
242+ result = kernels::add_bias (result, config.bias_addr , info.col_idx );
243+ result = kernels::relu<float >(result);
244+ kernels::write (result, config.output_addr , info.row_idx * info.cols + info.col_idx );
245+ }
246+ private:
247+ vf unquant_mult;
248+ UnquantizeAndAddBiasAndWriteRelu config;
249+ };
250+
197251}
198252}
199253
0 commit comments