Chapter 7

webgpu — device GEMV & shaders

github.com/openfluke/welvet/webgpu


Why it exists

GPU paths must bind a real adapter. Host “fake GPU” was banned so suites cannot stamp WebGPU done when ALU ran on CPU.

What it is

DenseGEMV family (incl. quant/I8/resident), DenseGEMVT/DenseDW, RMSNorm, LayerNorm fwd, Softmax family, SwiGLUFuse. Available()/InitError() gate use.

Go example

examples/07-webgpu/main.go

Run:cd welvet/examples/07-webgpu && source ../env.sh && go run .
package main

import (
	"fmt"

	"github.com/openfluke/welvet/webgpu"
)

func main() {
	if !webgpu.Available() {
		fmt.Println("no adapter:", webgpu.InitError())
		return
	}
	y := make([]float32, 2)
	err := webgpu.DenseGEMV(
		[]float32{1, 0, 0, 1},
		[]float32{1.5, 2.5},
		y, 1, 2, 2,
	)
	fmt.Println(y, err, webgpu.AdapterName())
}

Output

exit 0 · last run via go run .

[1.5 2.5] <nil> NVIDIA GeForce GTX 1650 SUPER