GpuLinear class final
Products of quantized matrices on the GPU for work outside the language forward pass, such as the vision encoder's linear layers: each apply copies the inputs in, runs one matrix product over all n rows in its own command buffer and copies the outputs back. The GPU computes the same products as the CPU kernels with float inputs, its sums in another order, so the outputs differ from theirs in the last bits.
The GPU layer encodes one command buffer at a time per process: do not call apply while another isolate runs a GpuForward.
Properties
Methods
-
apply(
String name, Float32List xs, Float32List ys, int n) → void -
ys
t * rows + r= (W xst)rfor t < n, W the matrix uploaded asnameand xsn, cols. -
dispose(
) → void - Releases every GPU buffer. Using this afterwards throws.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
upload(
String name, CachedMatrix matrix) → void -
Copies
matrix(Q4 or Q8) into a GPU buffer of its own, undername.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited