Skip to content

Commit

Permalink
chore(tfhe): make sure the GPU module is present during doc compilation
Browse files Browse the repository at this point in the history
- fix lints
  • Loading branch information
IceTDrinker committed Mar 21, 2024
1 parent b4619bb commit d1be2a5
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 12 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -629,18 +629,22 @@ test_concrete_csprng:

.PHONY: doc # Build rust doc
doc: install_rs_check_toolchain
@# Even though we are not in docs.rs, this allows to "just" build the doc
DOCS_RS=1 \
RUSTDOCFLAGS="--html-in-header katex-header.html" \
cargo "$(CARGO_RS_CHECK_TOOLCHAIN)" doc \
--features=$(TARGET_ARCH_FEATURE),boolean,shortint,integer,internal-keycache --no-deps -p $(TFHE_SPEC)
--features=$(TARGET_ARCH_FEATURE),boolean,shortint,integer,gpu,internal-keycache --no-deps -p $(TFHE_SPEC)

.PHONY: docs # Build rust doc alias for doc
docs: doc

.PHONY: lint_doc # Build rust doc with linting enabled
lint_doc: install_rs_check_toolchain
@# Even though we are not in docs.rs, this allows to "just" build the doc
DOCS_RS=1 \
RUSTDOCFLAGS="--html-in-header katex-header.html -Dwarnings" \
cargo "$(CARGO_RS_CHECK_TOOLCHAIN)" doc \
--features=$(TARGET_ARCH_FEATURE),boolean,shortint,integer,internal-keycache -p $(TFHE_SPEC) --no-deps
--features=$(TARGET_ARCH_FEATURE),boolean,shortint,integer,gpu,internal-keycache -p $(TFHE_SPEC) --no-deps

.PHONY: lint_docs # Build rust doc with linting enabled alias for lint_doc
lint_docs: lint_doc
Expand Down
15 changes: 15 additions & 0 deletions backends/tfhe-cuda-backend/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@ use std::env;
use std::process::Command;

fn main() {
match env::var("DOCS_RS") {
Ok(val) => {
let val = val.parse::<u32>();
match val {
Ok(val) => {
if val == 1 {
return;
}
}
Err(_) => (),
}
}
Err(_) => (),
}

println!("Build tfhe-cuda-backend");
if env::consts::OS == "linux" {
let output = Command::new("./get_os_name.sh").output().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion tfhe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ aarch64-unix = ["aarch64", "seeder_unix"]

[package.metadata.docs.rs]
# TODO: manage builds for docs.rs based on their documentation https://docs.rs/about
features = ["x86_64-unix", "boolean", "shortint", "integer"]
features = ["x86_64-unix", "boolean", "shortint", "integer", "gpu"]
rustdoc-args = ["--html-in-header", "katex-header.html"]

###########
Expand Down
2 changes: 1 addition & 1 deletion tfhe/src/integer/gpu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ where

/// Generate a couple of client and server keys with given parameters
///
/// Contrary to [gen_keys], this returns a [RadixClientKey]
/// Contrary to [gen_keys_gpu], this returns a [RadixClientKey]
///
/// ```rust
/// use tfhe::core_crypto::gpu::{CudaDevice, CudaStream};
Expand Down
20 changes: 12 additions & 8 deletions tfhe/src/integer/gpu/server_key/radix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,9 @@ impl CudaServerKey {
}

/// Prepend trivial zero LSB blocks to an existing [`CudaUnsignedRadixCiphertext`] or
/// [`CudaSignedRadixCiphertext`] and returns the result as a new ciphertext on GPU.
/// This can be useful for casting operations.
/// [`CudaSignedRadixCiphertext`](`crate::integer::gpu::ciphertext::CudaSignedRadixCiphertext`)
/// and returns the result as a new ciphertext on GPU. This can be useful for casting
/// operations.
///
/// # Example
///
Expand Down Expand Up @@ -327,8 +328,9 @@ impl CudaServerKey {
}

/// Append trivial zero MSB blocks to an existing [`CudaUnsignedRadixCiphertext`] or
/// [`CudaSignedRadixCiphertext`] and returns the result as a new ciphertext on GPU.
/// This can be useful for casting operations.
/// [`CudaSignedRadixCiphertext`](`crate::integer::gpu::ciphertext::CudaSignedRadixCiphertext`)
/// and returns the result as a new ciphertext on GPU. This can be useful for casting
/// operations.
///
/// # Example
///
Expand Down Expand Up @@ -390,8 +392,9 @@ impl CudaServerKey {
}

/// Remove LSB blocks from an existing [`CudaUnsignedRadixCiphertext`] or
/// [`CudaSignedRadixCiphertext`] and returns the result as a new ciphertext on GPU.
/// This can be useful for casting operations.
/// [`CudaSignedRadixCiphertext`](`crate::integer::gpu::ciphertext::CudaSignedRadixCiphertext`)
/// and returns the result as a new ciphertext on GPU. This can be useful for casting
/// operations.
///
/// # Example
///
Expand Down Expand Up @@ -453,8 +456,9 @@ impl CudaServerKey {
}

/// Remove MSB blocks from an existing [`CudaUnsignedRadixCiphertext`] or
/// [`CudaSignedRadixCiphertext`] and returns the result as a new ciphertext on GPU.
/// This can be useful for casting operations.
/// [`CudaSignedRadixCiphertext`](`crate::integer::gpu::ciphertext::CudaSignedRadixCiphertext`)
/// and returns the result as a new ciphertext on GPU. This can be useful for casting
/// operations.
///
/// # Example
///
Expand Down

0 comments on commit d1be2a5

Please sign in to comment.