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

chore(all): enforce polynomial size to be a power of 2 #1627

Merged
merged 1 commit into from
Oct 9, 2024

Conversation

mayeul-zama
Copy link
Contributor

No description provided.

@cla-bot cla-bot bot added the cla-signed label Oct 4, 2024
@mayeul-zama mayeul-zama force-pushed the mz/enforce_polynomial branch from bc3c778 to 6a4f74a Compare October 4, 2024 08:25
Copy link
Member

@IceTDrinker IceTDrinker left a comment

Choose a reason for hiding this comment

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

No we may have other cyclotomics coming, I think there are more urgent backlog issues

@IceTDrinker
Copy link
Member

Documenting the function to indicate it’s the floor log2 like the rust std lib is simpler here, I don’t think an assert would make sense, until we have other polynomial rings I don’t think this change is worthwhile

Comment on lines 140 to 143
/// If the polynomial size is not a power of 2, returns the ceil of its log2
pub fn log2(&self) -> PolynomialSizeLog {
PolynomialSizeLog((self.0 as f64).log2().ceil() as usize)
}
Copy link
Member

@IceTDrinker IceTDrinker Oct 9, 2024

Choose a reason for hiding this comment

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

🤔 let's update this function to return "just" the log2 and have a ceil_ilog2 that returns the ceiling log2

also ceil_ilog2 should be written similar to the UnsignedInteger trait:

    fn ceil_ilog2(self) -> u32 {
        // ilog2 returns the rounded down log2
        self.ilog2() + u32::from(!self.is_power_of_two())
    }

tfhe/src/core_crypto/commons/numeric/unsigned.rs:94 and following

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's not have ceil_ilog2 at all then

@mayeul-zama mayeul-zama force-pushed the mz/enforce_polynomial branch from c4785f7 to 99410ea Compare October 9, 2024 08:23
@mayeul-zama mayeul-zama force-pushed the mz/enforce_polynomial branch from 99410ea to 1990876 Compare October 9, 2024 08:24
@mayeul-zama mayeul-zama merged commit ca2a9e0 into main Oct 9, 2024
87 checks passed
@mayeul-zama mayeul-zama deleted the mz/enforce_polynomial branch October 9, 2024 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants