Skip to content

Commit

Permalink
ntt/parameters.cuh: take no-trowing-destructors literally.
Browse files Browse the repository at this point in the history
Mere presence of try-catch in destructor was proven to be problematic
in Windows DLL context.
  • Loading branch information
dot-asm committed Jul 29, 2024
1 parent 87cc6b2 commit 15d6648
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions ntt/parameters.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -249,22 +249,21 @@ public:
~NTTParameters()
{
int current_id;
cudaGetDevice(&current_id);

gpu.select();
gpu.Dfree(partial_twiddles);
if (cudaGetDevice(&current_id) != cudaSuccess) {
gpu.select();

(void)cudaFreeAsync(partial_twiddles, gpu);
#if !defined(FEATURE_BABY_BEAR) && !defined(FEATURE_GOLDILOCKS)
gpu.Dfree(radix9_twiddles_9);
gpu.Dfree(radix8_twiddles_8);
gpu.Dfree(radix7_twiddles_7);
gpu.Dfree(radix6_twiddles_12);
gpu.Dfree(radix6_twiddles_6);
(void)cudaFreeAsync(radix9_twiddles_9, gpu);
(void)cudaFreeAsync(radix8_twiddles_8, gpu);
(void)cudaFreeAsync(radix7_twiddles_7, gpu);
(void)cudaFreeAsync(radix6_twiddles_12, gpu);
(void)cudaFreeAsync(radix6_twiddles_6, gpu);
#endif
(void)cudaFreeAsync(twiddles[1], gpu);

gpu.Dfree(twiddles[1]);

cudaSetDevice(current_id);
cudaSetDevice(current_id);
}
}

inline void sync() const { gpu.sync(); }
Expand Down

0 comments on commit 15d6648

Please sign in to comment.