Skip to content

chore(gpu): fix static analysis warnings - #3844

Open
pdroalves wants to merge 2 commits into
mainfrom
pa/fix/static_warnings
Open

chore(gpu): fix static analysis warnings#3844
pdroalves wants to merge 2 commits into
mainfrom
pa/fix/static_warnings

Conversation

@pdroalves

@pdroalves pdroalves commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix minor warnings raised by static analysis across the CUDA backends.

Value-initialized structs:

  • cudaPointerAttributes attr{} in device.cu (5 instances) to avoid reading uninitialized fields
  • cudaDeviceProp prop{} in bootstrapping_key.cu to avoid reading uninitialized fields
  • cudaDeviceProp deviceProp{} in helper_multi_gpu.cu to avoid reading uninitialized fields
  • cudaDeviceProp device_prop{} in device.cu (tfhe-cuda-common) to avoid reading uninitialized fields

Deprecated C headers replaced with C++ equivalents:

  • <stdint.h><cstdint> in helper_profile.cu
  • <stdio.h><cstdio> in programmable_bootstrap_classic.cu

Deprecated CUDA types replaced:

  • ulonglong4ulonglong4_16a in linearalgebra/multiplication.cu (2 instances) and polynomial/dot_product.cuh (1 instance)

Narrowing conversion fixes:

  • blockIdx.ystatic_cast<int>(blockIdx.y) in programmable_bootstrap.cu
  • threadIdx.x + blockIdx.x * blockDim.xstatic_cast<int>(...) in device.cu
  • 0xff000000 | (r << 16) | ...static_cast<int>(...) in helper_profile.cu

auto with cast expressions:

  • double2 *buffer = (double2 *)cuda_malloc_async(...)auto *buffer = ... in bootstrapping_key.cu
  • __uint128_t *d_standard = (__uint128_t *)cuda_malloc_async(...)auto *d_standard = ... in bootstrapping_key.cu

Erroneous const on cudaStream_t parameter:

  • cudaStream_t const streamcudaStream_t stream in radix_ciphertext.h and radix_ciphertext.cu (cudaStream_t is a pointer typedef, so top-level const is misleading)

Unused includes removed:

  • #include <omp.h> from helper_multi_gpu.cu
  • #include <iostream> from integer/scalar_comparison.cu
  • #include "ciphertext.h" from pbs/programmable_bootstrap_classic.cu

Unused parameter names commented out:

  • group and support_dsm in 3 grid_group template specializations in programmable_bootstrap.cu
  • polynomial_size in integer/scalar_mul.cu
  • num_radix in integer/multiplication.cu (declaration updated in integer_utilities.h)
  • num_inputs in kreyvium/kreyvium.cu and trivium/trivium.cu (2 functions each)

Missing Doxygen @param entries:

  • oprf.cu: added @param for streams, message_modulus, carry_modulus, allocate_gpu_memory, bsks, ksks
  • shuffle.cu: added @param for streams, bsks, ksks, lwe_flattened_encryptions_of_zero_compact_array_in, rerand_ksks
  • integer.cu: added @param for stream, gpu_index

Parameter name mismatches between declarations and definitions:

  • stream_v/_input1/_input2/_outputstream/input1/input2/output in 4 fourier polynomial functions in bootstrapping_key.cu (local casts use short names s, in1, in2, out, buf)
  • mem_ptrbuffer in PBS scratch/cleanup/execute functions across programmable_bootstrap_classic.cu, programmable_bootstrap_classic_128.cu, programmable_bootstrap_multibit.cu, programmable_bootstrap_multibit_128.cu (local casts use pbs_buf to avoid shadowing the pbs_buffer type)
  • pbs_bufferbuffer in multibit noise-test wrapper functions in programmable_bootstrap_multibit.h and .cu
  • uses_trivial_indicesuses_trivial_indexes in 2 keyswitch functions in keyswitch.cu
  • num_radix_blockslwe_ciphertext_count in 2 comparison functions in comparison.cu
  • num_radix_blocksinput_lwe_ciphertext_count, num_many_lutnum_luts, original_num_blocksnum_original_blocks in 3 integer functions in integer.cu
  • memmem_ptr in scalar_mul.cu
  • glwe_lhspoly_lhs in multiplication.cu
  • Updated bindings.rs (auto-generated) to reflect header changes

Validation

  • make pcc_gpu passes (doxygen check, formatting)
  • cargo check -p tfhe-cuda-backend passes

@pdroalves
pdroalves requested a review from a team as a code owner August 19, 2026 19:06
@cla-bot cla-bot Bot added the cla-signed label Aug 19, 2026
@github-actions

Copy link
Copy Markdown

Backward-compat snapshot: everything looks good! No backward-compatibility issues detected.

@github-actions

Copy link
Copy Markdown

Forward compatibility matrix unchanged: it still matches the committed baseline.

Matrix

Which released versions can load data produced by this branch. A ❌ is not a failure by itself: it only means forward compatibility is not (or no longer) provided for that type. What matters is whether it was reviewed.

TYPE 1.5.5 1.6.3 1.7.0
CompactPublicKey
CompactPkeCrs
ProvenCompactCiphertextList

@pdroalves
pdroalves force-pushed the pa/fix/static_warnings branch 2 times, most recently from f0e8ec5 to 78ab24a Compare August 19, 2026 20:04
@github-actions

Copy link
Copy Markdown

⚠️ This PR contains unsigned commits. To get your PR merged, please sign those commits (git rebase --exec 'git commit -S --amend --no-edit -n' @{upstream}) and force push them to this branch (git push --force-with-lease).

If you're new to commit signing, there are different ways to set it up:

Sign commits with gpg

Follow the steps below to set up commit signing with gpg:

  1. Generate a GPG key
  2. Add the GPG key to your GitHub account
  3. Configure git to use your GPG key for commit signing
Sign commits with ssh-agent

Follow the steps below to set up commit signing with ssh-agent:

  1. Generate an SSH key and add it to ssh-agent
  2. Add the SSH key to your GitHub account
  3. Configure git to use your SSH key for commit signing
Sign commits with 1Password

You can also sign commits using 1Password, which lets you sign commits with biometrics without the signing key leaving the local 1Password process.

Learn how to use 1Password to sign your commits.

Watch the demo

@pdroalves
pdroalves force-pushed the pa/fix/static_warnings branch from 16601ec to d36cc09 Compare August 20, 2026 02:09
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.

1 participant