    -- | Code generation for ImpCode with OpenCL kernels.
    module Futhark.CodeGen.ImpGen.OpenCL
      ( compileProg,
        Warnings,
      )
    where

    import Data.Bifunctor (second)
    import Futhark.CodeGen.ImpCode.OpenCL qualified as OpenCL
    import Futhark.CodeGen.ImpGen.GPU
    import Futhark.CodeGen.ImpGen.GPU.ToOpenCL
    import Futhark.IR.GPUMem
    import Futhark.MonadFreshNames

    -- | Compile the program to ImpCode with OpenCL kernels.
    compileProg :: (MonadFreshNames m) => Prog GPUMem -> m (Warnings, OpenCL.Program)
    compileProg :: forall (m :: * -> *).
    MonadFreshNames m =>
    Prog GPUMem -> m (Warnings, Program)
    compileProg Prog GPUMem
    prog = (Program -> Program) -> (Warnings, Program) -> (Warnings, Program)
    forall b c a. (b -> c) -> (a, b) -> (a, c)
    forall (p :: * -> * -> *) b c a.
    Bifunctor p =>
    (b -> c) -> p a b -> p a c
    second Program -> Program
    kernelsToOpenCL ((Warnings, Program) -> (Warnings, Program))
    -> m (Warnings, Program) -> m (Warnings, Program)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Prog GPUMem -> m (Warnings, Program)
    forall (m :: * -> *).
    MonadFreshNames m =>
    Prog GPUMem -> m (Warnings, Program)
    compileProgOpenCL Prog GPUMem
    prog