mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-08 19:44:57 -05:00
chore(core): fix clippy error in cuda backend and fix formatting
This commit is contained in:
@@ -302,8 +302,8 @@ void host_cmux_tree(void *v_stream, Torus *glwe_array_out, Torus *ggsw_in,
|
||||
int ggsw_size = r * polynomial_size * (glwe_dimension + 1) *
|
||||
(glwe_dimension + 1) * level_count;
|
||||
|
||||
double2 *d_ggsw_fft_in =
|
||||
(double2 *)cuda_malloc_async(ggsw_size * sizeof(double), *stream, gpu_index);
|
||||
double2 *d_ggsw_fft_in = (double2 *)cuda_malloc_async(
|
||||
ggsw_size * sizeof(double), *stream, gpu_index);
|
||||
|
||||
batch_fft_ggsw_vector<Torus, STorus, params>(v_stream, d_ggsw_fft_in, ggsw_in,
|
||||
r, glwe_dimension,
|
||||
@@ -328,10 +328,10 @@ void host_cmux_tree(void *v_stream, Torus *glwe_array_out, Torus *ggsw_in,
|
||||
// Allocate buffers
|
||||
int glwe_size = (glwe_dimension + 1) * polynomial_size;
|
||||
|
||||
Torus *d_buffer1 =
|
||||
(Torus *)cuda_malloc_async(num_lut * glwe_size * sizeof(Torus), *stream, gpu_index);
|
||||
Torus *d_buffer2 =
|
||||
(Torus *)cuda_malloc_async(num_lut * glwe_size * sizeof(Torus), *stream, gpu_index);
|
||||
Torus *d_buffer1 = (Torus *)cuda_malloc_async(
|
||||
num_lut * glwe_size * sizeof(Torus), *stream, gpu_index);
|
||||
Torus *d_buffer2 = (Torus *)cuda_malloc_async(
|
||||
num_lut * glwe_size * sizeof(Torus), *stream, gpu_index);
|
||||
|
||||
checkCudaErrors(cudaMemcpyAsync(d_buffer1, lut_vector,
|
||||
num_lut * glwe_size * sizeof(Torus),
|
||||
|
||||
@@ -33,14 +33,15 @@ void *cuda_malloc(uint64_t size, uint32_t gpu_index) {
|
||||
|
||||
/// Allocates a size-byte array at the device memory. Tries to do it
|
||||
/// asynchronously.
|
||||
void *cuda_malloc_async(uint64_t size, cudaStream_t stream, uint32_t gpu_index) {
|
||||
void *cuda_malloc_async(uint64_t size, cudaStream_t stream,
|
||||
uint32_t gpu_index) {
|
||||
void *ptr;
|
||||
|
||||
int support_async_alloc;
|
||||
checkCudaErrors(cudaDeviceGetAttribute(&support_async_alloc, cudaDevAttrMemoryPoolsSupported,
|
||||
gpu_index));
|
||||
checkCudaErrors(cudaDeviceGetAttribute(
|
||||
&support_async_alloc, cudaDevAttrMemoryPoolsSupported, gpu_index));
|
||||
|
||||
if(support_async_alloc)
|
||||
if (support_async_alloc)
|
||||
checkCudaErrors(cudaMallocAsync((void **)&ptr, size, stream));
|
||||
else
|
||||
checkCudaErrors(cudaMalloc((void **)&ptr, size));
|
||||
@@ -160,10 +161,10 @@ int cuda_drop(void *ptr, uint32_t gpu_index) {
|
||||
int cuda_drop_async(void *ptr, cudaStream_t stream, uint32_t gpu_index) {
|
||||
|
||||
int support_async_alloc;
|
||||
checkCudaErrors(cudaDeviceGetAttribute(&support_async_alloc, cudaDevAttrMemoryPoolsSupported,
|
||||
gpu_index));
|
||||
checkCudaErrors(cudaDeviceGetAttribute(
|
||||
&support_async_alloc, cudaDevAttrMemoryPoolsSupported, gpu_index));
|
||||
|
||||
if(support_async_alloc)
|
||||
if (support_async_alloc)
|
||||
checkCudaErrors(cudaFreeAsync(ptr, stream));
|
||||
else
|
||||
checkCudaErrors(cudaFree(ptr));
|
||||
|
||||
Reference in New Issue
Block a user