Skip to content

chore(tfhe): make sure the GPU module is present during doc compilation #1014

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

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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