gpu_tensor library
GPU Tensor library.
This library provides a simple API for performing tensor operations on the GPU.
Classes
- DefaultMinigpu
- A helper that creates (or reuses) a default GPU context.
- Fft1dPlan
- A reusable execution plan for repeated same-size 1D real-input FFTs (the audio-frame hot path).
-
Tensor<
T extends TypedData> - A generic tensor that works with a specific TypedData type.
- TensorShaderCache
- Process-wide cache of compiled compute shaders, keyed per-Minigpu instance by the FULL WGSL source.
Enums
- BufferDataType
- Enum representing supported buffer data types.
Extensions
- CachedShaderAcquire on Minigpu
-
GpuActivation
on Tensor<
T> -
GpuFft
on Tensor<
TypedData> - LinearDispatch on ComputeShader
-
Dispatches a 1D logical workload of
threadsinvocations, folding into (x, y) workgroup counts when the workgroup count exceeds WebGPU's 65535 per-dimension limit (tensors > ~16.7M elements at workgroup_size 256). -
TensorData
on Tensor<
T> -
TensorLinearOperator
on Tensor<
TypedData> -
TensorOperator
on Tensor<
T> -
TensorPoolingMax
on Tensor<
TypedData> -
TensorPoolingMin
on Tensor<
TypedData> -
TensorPrintHelpers
on Tensor<
T> -
TesorHelper
on Tensor<
T>
Constants
- linearIndexWGSL → const String
- linearMainSignature → const String
- Canonical main-signature + linear-index preamble for 1D kernels that are dispatched via LinearDispatch.dispatchLinear. Uses num_workgroups so the source stays independent of the dispatch size (cache friendly).
Functions
-
getByteConversionCode(
BufferDataType dataType) → String -
getCastExpression(
String value, BufferDataType dataType) → String -
getTypedDataElement(
TypedData data, int index) → num -
Returns the element (as num) at
indexfor a TypedData, if supported. -
getTypedDataSublist<
T extends TypedData> (T data, int start, int end) → T -
Returns a sublist of
datafromstart(inclusive) toend(exclusive), preserving the underlying type. -
getZeroValue(
BufferDataType dataType) → String -
prepareShader(
String template, BufferDataType dataType, Map< String, dynamic> values) → String