Welvet examples

88. Apple Metal: Mamba results and stress runner

Open original example ↗Recorded results · not a live execution

Part: XII · Apple acceleration (welvet.metal)
Package: apple_stress_test
Status: ok: labelled captured snapshot; no GPU required

When

Read a captured result excerpt or find the runnable full stress comparison.

Where

From example/welvet/88-apple-mamba-results:

go run .
cd ../apple_stress_test && ./run.sh

Why

Distinguish a supplied results snapshot from a live measurement.

What

Prints five rows from the user-provided 2026-10-27 Mamba forward excerpt. Prints commands for the 34-dtype × 29-mode Go/C++/Metal stress runner. This chapter is host-only and does not execute Metal.

These are usage examples with small shapes. For speed measurements, use ../apple_stress_test. The results are numerical CPU/GPU comparisons, not model prediction accuracy.

Captured sample

Captured Mamba forward excerpt, supplied 2026-10-27 (not a live benchmark)
dtype             Go ms       C++ ms     Metal ms    Metal/Go x    Metal/C++ x
float64         89.3145     236.2417      28.9586         3.084          8.158
float32         69.0185     225.8129      29.0104         2.379          7.784
float16        190.5450    1155.9022      28.9468         6.583         39.932
bfloat16       149.3513    1049.1798      29.0033         5.149         36.174
fp8e4m3        265.8816    1519.8743      29.1590         9.118         52.124
Go/Metal exact bits and within-tolerance agreement: 100%/100% across all 12 supplied forward rows.
Full excerpt and metric definitions: ../apple_stress_test/README.md
Run your own 34-dtype / 29-mode matrix: cd ../apple_stress_test && ./run.sh
Small verification: ./run.sh -profile smoke -samples 1 -iters 1 -steps 8

main.go

Download source ↓
// A labelled snapshot of user-provided forward results; no GPU run is implied.
package main

import "fmt"

func main() {
	fmt.Println("Captured Mamba forward excerpt, supplied 2026-10-27 (not a live benchmark)")
	fmt.Printf("%-10s %12s %12s %12s %13s %14s\n", "dtype", "Go ms", "C++ ms", "Metal ms", "Metal/Go x", "Metal/C++ x")
	rows := []struct {
		dtype                string
		goUS, cppUS, metalUS float64
	}{
		{"float64", 89314.5, 236241.7, 28958.6}, {"float32", 69018.5, 225812.9, 29010.4},
		{"float16", 190545.0, 1155902.2, 28946.8}, {"bfloat16", 149351.3, 1049179.8, 29003.3},
		{"fp8e4m3", 265881.6, 1519874.3, 29159.0},
	}
	for _, r := range rows {
		fmt.Printf("%-10s %12.4f %12.4f %12.4f %13.3f %14.3f\n", r.dtype, r.goUS/1000, r.cppUS/1000, r.metalUS/1000, r.goUS/r.metalUS, r.cppUS/r.metalUS)
	}
	fmt.Println("Go/Metal exact bits and within-tolerance agreement: 100%/100% across all 12 supplied forward rows.")
	fmt.Println("Full excerpt and metric definitions: ../apple_stress_test/README.md")
	fmt.Println("Run your own 34-dtype / 29-mode matrix: cd ../apple_stress_test && ./run.sh")
	fmt.Println("Small verification: ./run.sh -profile smoke -samples 1 -iters 1 -steps 8")
}