Book contents +

II · Foundation / CHAPTER 7

webgpu — device GEMV & shaders

Samuel Watson · Welvet feature bookOriginal source ↗

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 .

webgpu probe goos=linux goarch=amd64 WELVET_WGPU_BACKEND=""
  adapter high-perf: name="NVIDIA GeForce GTX 1650 SUPER" vendor="NVIDIA" arch="" driver="610.57.04" backend=vulkan type=discrete-gpu | maxBuf=1099511627776 maxSSBO=2147483644 maxSSBO/stage=524288 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024
  → selected high-perf
  adapter low-power: name="Intel(R) UHD Graphics 630 (CML GT2)" vendor="Intel open-source Mesa driver" arch="" driver="Mesa 26.1.8" backend=vulkan type=integrated-gpu | maxBuf=2147483647 maxSSBO=2147483644 maxSSBO/stage=103 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024
  adapter force-fallback: name="llvmpipe (LLVM 22.1.8, 256 bits)" vendor="llvmpipe" arch="" driver="Mesa 26.1.8 (LLVM 22.1.8)" backend=vulkan type=cpu | maxBuf=2147483647 maxSSBO=134217728 maxSSBO/stage=48 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024
  adapter default: name="NVIDIA GeForce GTX 1650 SUPER" vendor="NVIDIA" arch="" driver="610.57.04" backend=vulkan type=discrete-gpu | maxBuf=1099511627776 maxSSBO=2147483644 maxSSBO/stage=524288 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024
  try RequestDevice inflated: maxBuf=2147483648 maxSSBO=1073741824 maxSSBO/stage=524288 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024
RESULT: OK via=inflated adapter="NVIDIA GeForce GTX 1650 SUPER" backend=vulkan maxSSBO=2147483644 maxBuf=1099511627776
[1.5 2.5] <nil> NVIDIA GeForce GTX 1650 SUPER