Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x64: brdgmm conv: enable zps per group (closes MFDNN-12556) #2274

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tczeszun
Copy link
Contributor

@tczeszun tczeszun commented Dec 16, 2024

Adding src zero points per-group (mask=2) support to brdgmm conv.
Related jira: MFDNN-12556
CI
Nightly

@tczeszun tczeszun requested review from a team as code owners December 16, 2024 14:35
@tczeszun tczeszun added the platform:cpu-x64 Intel64/AMD64 processors. Codeowner: @oneapi-src/onednn-cpu-x64 label Dec 16, 2024
@tczeszun tczeszun force-pushed the tczeszun/brdgmm_conv_zps branch 2 times, most recently from c215542 to 0741e51 Compare December 16, 2024 16:45
@@ -244,6 +244,7 @@ struct zero_points_t : public c_compatible {

// arg-specific checks
bool common(int arg) const { return get_mask(arg) == 0; }
bool per_oc(int arg) const { return get_mask(arg) == 2; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest not to introduce this as primitives may interpret mask == 2 not necessarily as per_oc and rely on get_mask() directly.

Copy link
Contributor Author

@tczeszun tczeszun Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dzarukin get_mask() is private, do you suggest to change it to public?
I could also change per_oc to per_dim_1 alternatively.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, wouldn't think it's in private... Let's use per_dim_1 then, I'll replace it as a part of future refactor later. Thanks for checking.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -207,6 +207,7 @@ void brgemm_kernel_execute_postops(const brgemm_kernel_t *brg_kernel, int bs,
brgemm_p.b_zp_compensations = post_ops_data.b_zp_compensations;
brgemm_p.c_zp_values = post_ops_data.c_zp_values;
brgemm_p.ptr_dst_scales = post_ops_data.dst_scales;
brgemm_p.a_zp_values = post_ops_data.a_zp_values;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: put above c_zp_values to group identical values?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 468 to 471
zp_type = zero_points.has_default_values(mem_arg) || skip_zero_point
? brgemm_broadcast_t::none
: brgemm_broadcast_t::per_tensor;
: is_per_oc_bcast ? brgemm_broadcast_t::per_n
: brgemm_broadcast_t::per_tensor;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: for better readability and control of the value.

        zp_type = brgemm_broadcast_t::none;
        if (XXX) {
            zp_type = brgemm_broadcast_t::per_tensor;
        } else if (YYY) {
            zp_type = brgemm_broadcast_t::per_n;
        }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

src/cpu/x64/brgemm/brgemm_types.hpp Show resolved Hide resolved
@tczeszun tczeszun force-pushed the tczeszun/brdgmm_conv_zps branch from 0741e51 to 2bcc3f3 Compare December 17, 2024 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:tests platform:cpu-x64 Intel64/AMD64 processors. Codeowner: @oneapi-src/onednn-cpu-x64
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants