onegpuDocs
onegpu docs
Getting started, the compute surface, the kernel families and the names that are frozen for 1.x. These docs are for OneGpu 1.0.0, read at the v1.0.0 tag (5d3317c).
Start
Getting startedCreate a GPU device from C#, upload two matrices into typed buffers, multiply them with a compute kernel from RecursiveAI.OneGpu.Kernels, and read the result back. This guide was run on the 1.0.0 packages from NuGet, on Linux with Vulkan, on an NVIDIA GeForce RTX 4070.OverviewGPU compute and rendering for .NET from pure C#, on Vulkan, Metal and browser WebGPU. There are no native binaries of ours and no CUDA install: the backends talk to the platform's own GPU API through the driver already on the machine (the Vulkan loader, the Objective-C…Compute surfaceWhat RecursiveAI.OneGpu offers for compute, how each backend fills it in, and the rules that hold on every backend.Names and environment variablesEverything on this page is frozen for 1.x: a rename is a breaking change.
Kernels
KernelsRecursiveAI.OneGpu.Kernels holds the compute kernels that machine-learning inference needs, written in HLSL and compiled by the shader build for SPIR-V (Vulkan), Metal Shading Language and WGSL (browser). This page describes the element-wise, reduction, softmax, normalisation…Matrix multiplication (GEMM)RecursiveAI.OneGpu.Kernels.Gemm computes C = alpha * op(A) * op(B) + beta * C for Batch independent products. op(X) is X or its transpose. A and B are float32, float16 or bfloat16; products and sums are float32 and C is float32. Matrices are dense row-major with a leading…AttentionAttentionKernels computes O = softmax(Scale · Q Kᵀ + Mask) V for every batch entry and head in one kernel. The score matrix is never written to memory: a workgroup keeps a block of 64 query rows and walks over the keys one tile at a time, keeping for each row a running…Convolution, pooling and resizeConvKernels, PoolKernels and ResizeKernels in RecursiveAI.OneGpu.Kernels cover ONNX Conv, ConvTranspose, MaxPool, AveragePool, GlobalAveragePool, GlobalMaxPool and Resize for the vision models (ResNet-50, MobileNetV3, DBNet, a recurrent-recognizer's convolutional stem). They…Recurrent layersRecurrentKernels runs ONNX RNN, GRU and LSTM layers on the GPU: forward, reverse and bidirectional, layouts 0 and 1, sequence_lens, initial states, peepholes, clip, input_forget, linear_before_reset, and every activation ONNX names (Sigmoid, Tanh, Relu, Affine, LeakyRelu…
Project
Speed at 1.0The harness and the full method are in onemodel-csharp, tools/bar.sh and docs/bench.md. The models are onemodel's reference set: MiniLM-L6, BERT-base, ResNet-50, MobileNetV3, DBNet, CRNN and Whisper-small (encoder and decoder), in float32, float16 and dynamically quantized…ChangelogAll notable changes are listed here. The format follows Keep a Changelog and the project follows Semantic Versioning.