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

Ns/versionize clean #1326

Merged
merged 12 commits into from
Jul 17, 2024
Merged

Ns/versionize clean #1326

merged 12 commits into from
Jul 17, 2024

Conversation

nsarlin-zama
Copy link
Contributor

@nsarlin-zama nsarlin-zama commented Jun 28, 2024

closes: please link all relevant issues

PR content/description

Various small improvements for the versioning feature. The main ones are:

  • Versioning for all the serializable types reachable with --features integer,shortint,boolean. The zk are still missing
  • A custom lint tool that detects types that are serializable but not versioned
  • the serialize_owned method now takes an owned value. This reduces the number of clone needed for serialization

Check-list:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Relevant issues are marked as resolved/closed, related issues are linked in the description
  • Check for breaking changes (including serialization changes) and add them to commit message following the conventional commit specification

@cla-bot cla-bot bot added the cla-signed label Jun 28, 2024
@nsarlin-zama nsarlin-zama force-pushed the ns/versionize_clean branch 7 times, most recently from d4d7ea2 to 102815c Compare July 11, 2024 09:15
@nsarlin-zama nsarlin-zama marked this pull request as ready for review July 11, 2024 09:23
@nsarlin-zama nsarlin-zama force-pushed the ns/versionize_clean branch 2 times, most recently from 10cccb0 to c365b14 Compare July 11, 2024 09:40
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.

Haven't checked the lint tool for now

.github/workflows/check_commit.yml Show resolved Hide resolved
.gitignore Outdated Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
Comment on lines +151 to +155
.PHONY: install_tfhe_lints # Install custom tfhe-rs lints
install_tfhe_lints:
(cd utils/cargo-tfhe-lints-inner && cargo install --path .) && \
cd utils/cargo-tfhe-lints && cargo install --path .
Copy link
Member

Choose a reason for hiding this comment

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

does it try to reinstall everytime ? My main question here being that if the tool gets updated does the install step try to update the already installed tool ?

Alternatively is the installation mandatory or could it be run as a standalone executable maybe ?

Separate question: does it require a dedicated toolchain as was shown in the tutorial ?

Copy link
Contributor Author

@nsarlin-zama nsarlin-zama Jul 12, 2024

Choose a reason for hiding this comment

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

Yes this is reinstalled every times but if its code did not change it is instant.
For the moment I don't think it can be run as a standalone tool because of the way the command line arguments are parsed: let tool_args = std::env::args().skip(2).collect::<Vec<_>>();.
This assumes that the command is invoked with cargo tfhe-lints [args] and will not work with ./target/carg-tfhe-lints [args].

Yes it needs a specific toolchain which is the one used by rustc-tools. The toolchain is specified in the toolchain.txt. Only the cargo-tfhe-lints-inner tool needs this, I should remove the toolchain.txt in cargo-tfhe-lints.

Makefile Show resolved Hide resolved
tfhe/src/integer/backward_compatibility/ciphertext/mod.rs Outdated Show resolved Hide resolved
Comment on lines 160 to 165
integer_key: self.key.versionize_owned(),
integer_key: (*self.key).clone().versionize_owned(),
Copy link
Member

Choose a reason for hiding this comment

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

I'm confused here, why the clone ?

Copy link
Contributor Author

@nsarlin-zama nsarlin-zama Jul 12, 2024

Choose a reason for hiding this comment

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

self.key is wrapped in an Arc here. So I have to extract the inner type to call versionize_owned. MSRV for the tfhe crate is 1.75 so I cannot use this: https://doc.rust-lang.org/std/sync/struct.Arc.html#method.unwrap_or_clone

Copy link
Contributor Author

Choose a reason for hiding this comment

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

However I should at least impl<T: Versionize> Versionize for Arc<T> in tfhe-versionable I think

Copy link
Member

Choose a reason for hiding this comment

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

you are allowed to bump the version and you can do the impl if you want to as well

Copy link
Member

Choose a reason for hiding this comment

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

if you don't need the MSRV bump then don't bump

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the impl for Arc, this simplifies the code in tfhe since the manual impl is not needed anymore.
I also updated the MSRV.

tfhe/src/high_level_api/backward_compatibility/keys.rs Outdated Show resolved Hide resolved
tfhe/src/high_level_api/backward_compatibility/integers.rs Outdated Show resolved Hide resolved
@nsarlin-zama nsarlin-zama force-pushed the ns/versionize_clean branch 8 times, most recently from cf2b141 to 1aced21 Compare July 12, 2024 15:12
@nsarlin-zama nsarlin-zama force-pushed the ns/versionize_clean branch 3 times, most recently from 4787b94 to fbda08e Compare July 16, 2024 13:47
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.

Thanks a lot for your patience and thorough corrections !

@nsarlin-zama nsarlin-zama merged commit 35201b0 into main Jul 17, 2024
55 of 60 checks passed
@nsarlin-zama nsarlin-zama deleted the ns/versionize_clean branch July 17, 2024 11:44
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