Skip to content

Commit

Permalink
fixup: src: introduce quant_entry_t and refactor arg_scales_t to rely…
Browse files Browse the repository at this point in the history
… on it

This fixes #2572.
Patches aarch64 brgemm dispatching without scales involved.
  • Loading branch information
dzarukin committed Feb 19, 2025
1 parent 477d949 commit 10a8035
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/cpu/aarch64/brgemm/brgemm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,9 @@ status_t brgemm_desc_set_postops(brgemm_t *brg, const primitive_attr_t *attr,

const auto &src_scales = attr->scales_.get(DNNL_ARG_SRC);
const auto &wei_scales = attr->scales_.get(DNNL_ARG_WEIGHTS);
brg->with_scales = !src_scales.has_default_values()
|| !wei_scales.has_default_values()
const bool has_src_scales = !src_scales.has_default_values();
const bool has_wei_scales = !wei_scales.has_default_values();
brg->with_scales = has_src_scales || has_wei_scales
|| brg->with_weights_scale_adjust;
if (brg->with_scales) {
// Note. the current version supports only two different output scale
Expand All @@ -310,9 +311,11 @@ status_t brgemm_desc_set_postops(brgemm_t *brg, const primitive_attr_t *attr,
}

const auto &dst_scales = attr->scales_.get(DNNL_ARG_DST);
brg->with_dst_scales = !dst_scales.has_default_values();
const bool scales_ok = src_scales.get_mask() == 0
&& dst_scales.get_mask() == 0
const bool has_dst_scales = !dst_scales.has_default_values();
brg->with_dst_scales = has_dst_scales;
const bool scales_ok
= IMPLICATION(has_src_scales, src_scales.get_mask() == 0)
&& IMPLICATION(has_dst_scales, dst_scales.get_mask() == 0)
&& attr->scales_.has_default_values(
{DNNL_ARG_SRC, DNNL_ARG_WEIGHTS, DNNL_ARG_DST});
if (!scales_ok) return status::unimplemented;
Expand Down

0 comments on commit 10a8035

Please sign in to comment.