gpu_version/ffi/gpu_engine library

Classes

GPUEngine
The Cuda Engine in responsible for communication with the native runtimes as well as managing the communication between dart and its native FFI-bindings. In order to use the GPU acceleration, at the very beginning of the program it is required to call initialize with the Target provided to load the relevant binary. This class is to be used globally as a sole instance of communication and data transfer. Its handle acts as the id of the native executor instance. If there is currently no instance running this value will be 0. Currently supported are WebGPU with android_arm64, android_x86_64 and cudafrom version 1.12.1 (2026-09). Use dispose to delete the currently running instance of GPUEngine and free all memory again.

Enums

Target
Targeted device architecture

Typedefs

DartAddPointers = void Function(Pointer<Float>, Pointer<Float>, int)
DartCreate = int Function(bool)
DartFree = void Function(int)
DartFreeStr = void Function(Pointer<Utf8>)
DartFreeT = void Function(int, Pointer<Utf8>)
DartGetNames = Pointer<Utf8> Function(int)
DartInitRandom = void Function(int, Pointer<Utf8>, double, int)
DartLoad = void Function(int, Pointer<Utf8>, Pointer<Float>, int, Pointer<Int32>)
DartRetrieve = void Function(int, Pointer<Utf8>, Pointer<Float>)
DartRun = void Function(int, Pointer<Uint8>, int)
NativeAddPointers = Void Function(Pointer<Float>, Pointer<Float>, Int32)
FFI- Advanced operation to allow direct pointer access. Adds the content of a source content into a destination pointer with a given length
NativeCreate = Int64 Function(Bool)
FFI- Binding for creating a tensor on the GPU
NativeFree = Void Function(Int64)
FFI- Binding for freeing/deleting the GPU backend
NativeFreeStr = Void Function(Pointer<Utf8>)
FFI- Binding for freeing the made list of tensor names
NativeFreeT = Void Function(Int64, Pointer<Utf8>)
FFI- Binding for freeing a tensor on the GPU
NativeGetNames = Pointer<Utf8> Function(Int64)
FFI- Binding for retrieving the ids of all tensors currently on the GPU. This creates a List of Strings that is stored in the backend and has to be deleted again
NativeInitRandom = Void Function(Int64, Pointer<Utf8>, Float, Int32)
FFI- Initialise a tensor with a random initialization
NativeLoad = Void Function(Int64, Pointer<Utf8>, Pointer<Float>, Int32, Pointer<Int32>)
FFI- Binding for pushing a tensor to the GPU
NativeRetrieve = Void Function(Int64, Pointer<Utf8>, Pointer<Float>)
FFI- Binding for pulling a tensor from the GPU
NativeRun = Void Function(Int64, Pointer<Uint8>, Int32)
FFI- Binding for running a given byteList of commands (usually via a CommandBuffer)