-
Notifications
You must be signed in to change notification settings - Fork 26
Port: Hoist default C backend into separate functions #735
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
Conversation
91847f9 to
d869805
Compare
5004349 to
4b5aa71
Compare
mkannwischer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @willieyz. This looks very good!
Two small comments.
79e3f3b to
ddd184a
Compare
ddd184a to
d430d4d
Compare
mkannwischer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @willieyz. This looks excellent!
I only found one extra new line that you could still remove.
d430d4d to
a1499d8
Compare
c4aba94 to
c9f24dd
Compare
mkannwischer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes @willieyz. LGTM.
@hanno-becker, WDYT?
Signed-off-by: willieyz <willie.zhao@chelpis.com>
Signed-off-by: willieyz <willie.zhao@chelpis.com>
…t_c) Signed-off-by: willieyz <willie.zhao@chelpis.com>
…ntgomery_c) Signed-off-by: willieyz <willie.zhao@chelpis.com>
Signed-off-by: willieyz <willie.zhao@chelpis.com>
…e_acc_montgomery_c) Signed-off-by: willieyz <willie.zhao@chelpis.com>
Signed-off-by: willieyz <willie.zhao@chelpis.com>
Signed-off-by: willieyz <willie.zhao@chelpis.com>
Signed-off-by: willieyz <willie.zhao@chelpis.com>
Signed-off-by: willieyz <willie.zhao@chelpis.com>
Signed-off-by: willieyz <willie.zhao@chelpis.com>
c9f24dd to
088d716
Compare
| ret = mld_polyvecl_pointwise_acc_montgomery_l4_native( | ||
| w->coeffs, (const int32_t(*)[MLDSA_N])u->vec, | ||
| (const int32_t(*)[MLDSA_N])v->vec); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cast business is not very nice. I wonder if we should modify the native API to streamline this. Not an issue for this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mlkem-native has
ret = mlk_polyvec_basemul_acc_montgomery_cached_k2_native(
r->coeffs, (const int16_t *)a, (const int16_t *)b,
(const int16_t *)b_cache);
Is that better?
hanno-becker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you @willieyz !
Resolves: Port: Hoist default C backend into separate functions #732
Purpose: This porting aims to separate the native backend functions into two distinct sets:
This work is based on the runtime-dispatch changes introduced in PR #607.
Steps:
USE_FUNCTION_CONTRACTSwith the C backend function.Tests:
tests examples.The following is the checking table for fallback C backend and native backend:
mld_poly_nttmld_ntt_nativemld_poly_ntt_cmld_poly_invntt_tomontmld_intt_nativemld_poly_invntt_tomont_cmld_polymat_permute_bitrev_to_custommld_poly_permute_bitrev_to_custom((void)mat);/* Nothing to do */mld_rej_uniformmld_rej_uniform_nativemld_rej_uniform_cmld_rej_etamld_rej_uniform_eta2_nativemld_rej_uniform_eta4_nativemld_rej_eta_cmld_poly_decompose_32_nativemld_poly_decompose_88_nativemld_poly_decompose_cmld_poly_caddq_nativemld_poly_caddq_cmld_poly_use_hintmld_poly_use_hint_32_nativemld_poly_use_hint_88_nativemld_poly_use_hint_cmld_poly_chknormmld_poly_chknorm_nativemld_poly_chknorm_cmld_polyz_unpackmld_polyz_unpack_17_nativemld_polyz_unpack_19_nativemld_polyz_unpack_cmld_poly_pointwise_montgomerymld_poly_pointwise_montgomery_nativemld_poly_pointwise_montgomery_cmld_polyvecl_pointwise_acc_montgomerymld_polyvecl_pointwise_acc_montgomery_l4_nativemld_polyvecl_pointwise_acc_montgomery_l5_nativemld_polyvecl_pointwise_acc_montgomery_l7_nativemld_polyvecl_pointwise_acc_montgomery_cmld_keccakf1600_permutemld_keccak_f1600_x1_nativemld_keccakf1600_permute_cmld_keccakf1600x4_permutemld_keccak_f1600_x2_v84a_asm* 2mld_keccak_f1600_x4_scalar_v8a_hybrid_asmmld_keccak_f1600_x4_scalar_v8a_v84a_hybrid_asmmld_keccakf1600_permute* 4