fix(backend): add error messages for unsuppoted polynomial sizes in switch defaults.

This commit is contained in:
Antoniu Pop
2024-06-19 08:02:38 +00:00
committed by Antoniu Pop
parent 1153dd2785
commit 095db7d25e
4 changed files with 31 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
#include <err.h>
#include "bootstrap_amortized.cuh"
/*
@@ -85,6 +86,8 @@ void scratch_cuda_bootstrap_amortized_32(void *v_stream, uint32_t gpu_index,
input_lwe_ciphertext_count, max_shared_memory, allocate_gpu_memory);
break;
default:
errx(EXIT_FAILURE, "polynomial size %u is not supported. Supported values "
"are: 256, 512, 1024, 2048, 4096, 8192, 16384.", polynomial_size);
break;
}
}
@@ -141,6 +144,8 @@ void scratch_cuda_bootstrap_amortized_64(void *v_stream, uint32_t gpu_index,
input_lwe_ciphertext_count, max_shared_memory, allocate_gpu_memory);
break;
default:
errx(EXIT_FAILURE, "polynomial size %u is not supported. Supported values "
"are: 256, 512, 1024, 2048, 4096, 8192, 16384.", polynomial_size);
break;
}
}
@@ -216,6 +221,8 @@ void cuda_bootstrap_amortized_lwe_ciphertext_vector_32(
lwe_idx, max_shared_memory);
break;
default:
errx(EXIT_FAILURE, "polynomial size %u is not supported. Supported values "
"are: 256, 512, 1024, 2048, 4096, 8192, 16384.", polynomial_size);
break;
}
}
@@ -353,6 +360,8 @@ void cuda_bootstrap_amortized_lwe_ciphertext_vector_64(
lwe_idx, max_shared_memory);
break;
default:
errx(EXIT_FAILURE, "polynomial size %u is not supported. Supported values "
"are: 256, 512, 1024, 2048, 4096, 8192, 16384.", polynomial_size);
break;
}
}

View File

@@ -1,3 +1,4 @@
#include <err.h>
#include "bootstrap_fast_low_latency.cuh"
#include "bootstrap_low_latency.cuh"
/*
@@ -100,6 +101,8 @@ uint64_t get_buffer_size_bootstrap_low_latency_64(
input_lwe_ciphertext_count, max_shared_memory);
break;
default:
errx(EXIT_FAILURE, "polynomial size %u is not supported. Supported values "
"are: 256, 512, 1024, 2048, 4096, 8192, 16384.", polynomial_size);
return 0;
break;
}
@@ -244,6 +247,8 @@ void scratch_cuda_bootstrap_low_latency_32(
allocate_gpu_memory);
break;
default:
errx(EXIT_FAILURE, "polynomial size %u is not supported. Supported values "
"are: 256, 512, 1024, 2048, 4096, 8192, 16384.", polynomial_size);
break;
}
}
@@ -377,6 +382,8 @@ void scratch_cuda_bootstrap_low_latency_64(
allocate_gpu_memory);
break;
default:
errx(EXIT_FAILURE, "polynomial size %u is not supported. Supported values "
"are: 256, 512, 1024, 2048, 4096, 8192, 16384.", polynomial_size);
break;
}
}
@@ -527,6 +534,8 @@ void cuda_bootstrap_low_latency_lwe_ciphertext_vector_32(
num_samples, num_lut_vectors, max_shared_memory);
break;
default:
errx(EXIT_FAILURE, "polynomial size %u is not supported. Supported values "
"are: 256, 512, 1024, 2048, 4096, 8192, 16384.", polynomial_size);
break;
}
}
@@ -744,7 +753,10 @@ void cuda_bootstrap_low_latency_lwe_ciphertext_vector_64(
(uint64_t *)lwe_array_in, (double2 *)bootstrapping_key, pbs_buffer,
glwe_dimension, lwe_dimension, polynomial_size, base_log, level_count,
num_samples, num_lut_vectors, max_shared_memory);
break;
default:
errx(EXIT_FAILURE, "polynomial size %u is not supported. Supported values "
"are: 256, 512, 1024, 2048, 4096, 8192, 16384.", polynomial_size);
break;
}
}

View File

@@ -1,3 +1,4 @@
#include <err.h>
#include "bootstrap_fast_multibit.cuh"
#include "bootstrap_multibit.cuh"
#include "bootstrap_multibit.h"
@@ -172,6 +173,8 @@ void cuda_multi_bit_pbs_lwe_ciphertext_vector_64(
}
break;
default:
errx(EXIT_FAILURE, "polynomial size %u is not supported. Supported values "
"are: 256, 512, 1024, 2048, 4096, 8192, 16384.", polynomial_size);
break;
}
}
@@ -311,6 +314,8 @@ void scratch_cuda_multi_bit_pbs_64(
}
break;
default:
errx(EXIT_FAILURE, "polynomial size %u is not supported. Supported values "
"are: 256, 512, 1024, 2048, 4096, 8192, 16384.", polynomial_size);
break;
}
}

View File

@@ -8,6 +8,7 @@
#include "polynomial/polynomial.cuh"
#include <atomic>
#include <cstdint>
#include <err.h>
__device__ inline int get_start_ith_ggsw(int i, uint32_t polynomial_size,
int glwe_dimension,
@@ -235,6 +236,8 @@ void cuda_convert_lwe_bootstrap_key(double2 *dest, ST *src, void *v_stream,
}
break;
default:
errx(EXIT_FAILURE, "polynomial size %u is not supported. Supported values "
"are: 256, 512, 1024, 2048, 4096, 8192, 16384.", polynomial_size);
break;
}
@@ -446,6 +449,8 @@ void cuda_fourier_polynomial_mul(void *_input1, void *_input2, void *_output,
}
break;
default:
errx(EXIT_FAILURE, "polynomial size %u is not supported. Supported values "
"are: 256, 512, 1024, 2048, 4096, 8192, 16384.", polynomial_size);
break;
}
cuda_drop_async(buffer, stream, gpu_index);