AIKernel.Providers.Flux.Cuda 0.1.5

dotnet add package AIKernel.Providers.Flux.Cuda --version 0.1.5
                    
NuGet\Install-Package AIKernel.Providers.Flux.Cuda -Version 0.1.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AIKernel.Providers.Flux.Cuda" Version="0.1.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AIKernel.Providers.Flux.Cuda" Version="0.1.5" />
                    
Directory.Packages.props
<PackageReference Include="AIKernel.Providers.Flux.Cuda" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AIKernel.Providers.Flux.Cuda --version 0.1.5
                    
#r "nuget: AIKernel.Providers.Flux.Cuda, 0.1.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AIKernel.Providers.Flux.Cuda@0.1.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AIKernel.Providers.Flux.Cuda&version=0.1.5
                    
Install as a Cake Addin
#tool nuget:?package=AIKernel.Providers.Flux.Cuda&version=0.1.5
                    
Install as a Cake Tool

AIKernel FLUX.2 CUDA image editing provider

FluxCudaImageProvider edits RGB24 reference images with FLUX.2 [klein] 4B. The package targets .NET 10 and Windows x64. It uses the same IImagePromptEditProvider contract and registered checkpoints as the CPU package.

using AIKernel.Contracts.Images;
using AIKernel.Providers.Flux;

using var runtime = new FluxCudaImageProvider(modelDirectory, privateSsdDirectory,
    weightCacheMiB: 256, deviceOrdinal: 0, deviceCacheMiB: 64);
IImagePromptEditProvider editor = runtime;
var edited = await editor.EditAsync(rgb24, width, height,
    "Make the jacket blue and preserve the composition.", seed: 42, cancellationToken);

Use an AVX2-capable host with the Microsoft Visual C++ Redistributable, an NVIDIA driver compatible with CUDA 13.2, and the CUDA 13.2 runtime and cuBLAS DLLs on PATH. The package contains the FLUX bridge. Install the model files and the NVIDIA runtime separately. Device ordinals follow CUDA device visibility in the application process.

AIKernel bounds the RAM and GPU checkpoint caches separately. For compatible tensor layouts, the native loader borrows each resident GPU page and copies into the engine's CUDA tensor allocation. Tensors that require conversion use the host reader before upload. The GPU page budget covers the checkpoint cache. Tensor staging, activations, and decoder workspace also need physical memory. A failed CUDA edit returns an error to the application.

LastWeightStatistics reports resident cache bytes, logical SSD checkpoint reads, device page-ins, and the number of tensor reads delivered to host and device memory. The logical SSD reads count requests to the checkpoint source and may be served by the OS file cache.

Build

Use the pinned engine and submodule revisions from the CPU build guide. Set $engine to that checkout and $cudaToolkit to the CUDA 13.2 toolkit directory. Run these commands in a Visual Studio x64 developer terminal from the AIKernel.Providers.Flux.Cuda directory.

cmake -S ../AIKernel.Providers.Flux/native -B native-build-cuda -G Ninja `
  -DCMAKE_BUILD_TYPE=Release -DAIKERNEL_FLUX_CUDA=ON `
  '-DCMAKE_CUDA_ARCHITECTURES=75-real;86-real;89-real;89-virtual' `
  "-DAIKERNEL_FLUX_ENGINE=$engine" "-DCUDAToolkit_ROOT=$cudaToolkit" `
  "-DCMAKE_CUDA_COMPILER=$cudaToolkit/bin/nvcc.exe"
cmake --build native-build-cuda --parallel 4
dotnet pack -c Release -p:UseAIKernelContractSource=false `
  "-p:FluxCudaNativeLibrary=$((Resolve-Path native-build-cuda/aikernel_flux_cuda.dll).Path)"

This build emits native code for SM 7.5, 8.6 and 8.9, plus PTX for compute capability 8.9. Adjust the architecture list for other boards. The CMake build leaves the upstream checkout untouched. It checks both revisions and generates a tensor-loader translation unit with the ABI callbacks.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.5 64 11/23/2026

Initial separate CUDA package for FLUX.2 klein 4B image editing.