Skip to content

Commit

Permalink
Updated workaround in CuFFT sample project. (#972)
Browse files Browse the repository at this point in the history
  • Loading branch information
MoFtZ authored Mar 16, 2023
1 parent 55b08a4 commit 345c376
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Samples/AlgorithmsCuFFT/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ---------------------------------------------------------------------------------------
// ILGPU Samples
// Copyright (c) 2021 ILGPU Project
// Copyright (c) 2021-2023 ILGPU Project
// www.ilgpu.net
//
// File: Program.cs
Expand Down Expand Up @@ -135,18 +135,24 @@ static void WorkaroundKnownIssue(CudaAccelerator accelerator, CuFFTAPI api)
// This workaround restores the accelerator context so that deallocation of
// the memory buffers can be performed on the correct context.
//
// Based on the versions of CuFFT released, apply workaround to CuFFT v10.4.x.
// Based on the versions of CuFFT released, we would need to apply the
// workaround to CuFFT v10.4.x.
//
// Release 11.1.1 CuFFT v10.3.0.105
// Release 11.2 CuFFT v10.4.0.72
// Release 11.3 CuFFT v10.4.2.58
// Release 11.4 CuFFT v10.5.0.43
//
// However, based on actual testing, the issue still persists in later
// versions. It appears to have been fixed in Release 12.0, which ships
// with CuFFT v11. So, we will apply the workaround from v10.4.x and later
// versions, up to v11 (exclusive).
//
CuFFTException.ThrowIfFailed(
api.GetProperty(LibraryPropertyType.MAJOR_VERSION, out var major));
CuFFTException.ThrowIfFailed(
api.GetProperty(LibraryPropertyType.MINOR_VERSION, out var minor));
if (major == 10 && minor == 4)
if (major == 10 && minor >= 4)
{
CudaException.ThrowIfFailed(
CudaAPI.CurrentAPI.SetCurrentContext(accelerator.NativePtr));
Expand Down

0 comments on commit 345c376

Please sign in to comment.