GpuCoopVec¶
Import: import system.gpu;
This reference lists the public declarations for this part of the library. See Reading API signatures for parameter and result notation. Shader-only declarations can be used only inside @compute, @vertex, @fragment, inferred helpers and ray tracing shader functions; using them elsewhere is a compile error.
GpuCoopVec¶
A short vector that a subgroup of threads multiplies with GpuMlpWeights cooperatively, on tensor hardware where the target has it. Used for small neural networks in shaders. Its length is fixed when the shader is built: from @coop_shape on parameters and fields, from the constant passed to zeros, or from the layer that produced it. T is usually float16. GpuTarget.Metal and WebGpu cannot run cooperative vectors; using them with only those targets is a build error.
zeros¶
A vector of length zeros; length must be a constant.
relu¶
Each element replaced by the larger of it and zero, the usual activation between layers.
length¶
The number of elements.
this¶
Reads element index.
this¶
Writes element index.