Deduplicate polyw1_pack in multilevel builds#1142
Open
mkannwischer wants to merge 2 commits into
Open
Conversation
Contributor
CBMC Results (ML-DSA-44)
Full Results (202 proofs)
|
Contributor
CBMC Results (ML-DSA-87)
Full Results (202 proofs)
|
Contributor
CBMC Results (ML-DSA-65)
Full Results (202 proofs)
|
Contributor
CBMC Results (ML-DSA-65, REDUCE-RAM)
Full Results (202 proofs)
|
Contributor
CBMC Results (ML-DSA-87, REDUCE-RAM)
Full Results (202 proofs)
|
Contributor
CBMC Results (ML-DSA-44, REDUCE-RAM)
Full Results (202 proofs)
|
b704203 to
8e53300
Compare
polyw1_pack depends only on GAMMA2, so ML-DSA-65 and -87 use identical
code. Move it into the shared poly.c as mld_polyw1_pack_{88,32}, compiled
once, with a thin dispatcher in poly_kl.h, so a multilevel build shares a
single copy instead of emitting one per parameter set. Split the CBMC
proof into per-variant proofs plus a dispatcher proof.
- Towards #536
Signed-off-by: Matthias J. Kannwischer <matthias@zerorisc.com>
On aarch64 (the CBMC CI runner) z3 is not stable for this proof: the individual proofs (for reduce_ram mode) runs for over 20 minutes and times out when run in parallel with other proofs. The proof completes in seconds on x86_64, and it also works in non-reduced-ram mode even though this code is indepdendent of it. Alternatives measured on aarch64 (ML-DSA-44, reduce-ram): z3 4.15.3 / 4.16.0 > 20 min bump OBJECT_BITS no effect (still > 20 min) SAT backend ~25 s bitwuzla ~2 min Both SAT and bitwuzla resolve the timeout; use bitwuzla. Signed-off-by: Matthias J. Kannwischer <matthias@zerorisc.com>
8e53300 to
a828efe
Compare
Contributor
Author
|
@hanno-becker, could you take a look if you agree with the general approach taken here? Then I'll apply the same to the other functions that are currently duplicated in poly_kl.c |
hanno-becker
approved these changes
Jun 4, 2026
Contributor
hanno-becker
left a comment
There was a problem hiding this comment.
LGTM, but we might use the opportunity to improve some pre-existing yet unclear documentation; see comment.
| #define mld_polyw1_pack_88 MLD_NAMESPACE(polyw1_pack_88) | ||
| /** | ||
| * Bit-pack polynomial w1 for GAMMA2 = (MLDSA_Q-1)/88 (coefficients in [0, 43]). | ||
| * Input coefficients are assumed to be standard representatives. |
Contributor
There was a problem hiding this comment.
It is unclear what this means
| #define mld_polyw1_pack_32 MLD_NAMESPACE(polyw1_pack_32) | ||
| /** | ||
| * Bit-pack polynomial w1 for GAMMA2 = (MLDSA_Q-1)/32 (coefficients in [0, 15]). | ||
| * Input coefficients are assumed to be standard representatives. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
polyw1_pack depends only on GAMMA2, so ML-DSA-65 and -87 use identical code. Move it into the shared poly.c as mld_polyw1_pack_{88,32}, compiled once, with a thin dispatcher in poly_kl.h, so a multilevel build shares a single copy instead of emitting one per parameter set. Split the CBMC proof into per-variant proofs plus a dispatcher proof.