From 77b0a2bb9667586052c511cb687d5777419ce25a Mon Sep 17 00:00:00 2001 From: Michael Swan <7232246+michael-swan@users.noreply.github.com> Date: Fri, 19 Jun 2026 12:47:51 -0700 Subject: [PATCH 1/2] Prevent SEGFAULT when stub-library is being accessed --- cuda/src/Foreign/CUDA/Driver/Error.chs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cuda/src/Foreign/CUDA/Driver/Error.chs b/cuda/src/Foreign/CUDA/Driver/Error.chs index dd542c9..11def6f 100644 --- a/cuda/src/Foreign/CUDA/Driver/Error.chs +++ b/cuda/src/Foreign/CUDA/Driver/Error.chs @@ -55,6 +55,9 @@ import Text.Printf , CUDA_ERROR_NO_BINARY_FOR_GPU as NoBinaryForGPU , CUDA_ERROR_INVALID_PTX as InvalidPTX , CUDA_ERROR_INVALID_PC as InvalidPC +#if CUDA_VERSION >= 11010 + , CUDA_ERROR_STUB_LIBRARY as StubLibrary +#endif } with prefix="CUDA_ERROR" deriving (Eq, Show) #} @@ -64,6 +67,10 @@ import Text.Printf -- instance Describe Status where #if CUDA_VERSION >= 6000 +#if CUDA_VERSION >= 11010 + -- Prevent SEGFAULT when CUDA stub-library is being accessed. + describe StubLibrary = "stub library" +#endif describe status = case cuGetErrorString status of (Success, msg) -> msg From f6e0c8f0816eab8697646304ba67760f34330a46 Mon Sep 17 00:00:00 2001 From: Michael Swan <7232246+michael-swan@users.noreply.github.com> Date: Fri, 19 Jun 2026 12:58:53 -0700 Subject: [PATCH 2/2] Update Error.chs --- cuda/src/Foreign/CUDA/Driver/Error.chs | 3 --- 1 file changed, 3 deletions(-) diff --git a/cuda/src/Foreign/CUDA/Driver/Error.chs b/cuda/src/Foreign/CUDA/Driver/Error.chs index 11def6f..56cad99 100644 --- a/cuda/src/Foreign/CUDA/Driver/Error.chs +++ b/cuda/src/Foreign/CUDA/Driver/Error.chs @@ -55,9 +55,6 @@ import Text.Printf , CUDA_ERROR_NO_BINARY_FOR_GPU as NoBinaryForGPU , CUDA_ERROR_INVALID_PTX as InvalidPTX , CUDA_ERROR_INVALID_PC as InvalidPC -#if CUDA_VERSION >= 11010 - , CUDA_ERROR_STUB_LIBRARY as StubLibrary -#endif } with prefix="CUDA_ERROR" deriving (Eq, Show) #}