Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated workaround in CuFFT sample project. #972

Merged
merged 1 commit into from
Mar 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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