wasm

command
v0.25.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2025 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

WASM Example

A minimal example demonstrating GoMLX running in the browser via WebAssembly.

This example shows how to:

  • Use GoMLX's pure Go backend (simplego) which works under WASM (no cgo required)
  • Compile Go code to WebAssembly
  • Execute tensor computations directly in the browser
  • Interact with the DOM from Go/WASM

Building and Running

1. Copy the WASM runtime helper from your Go installation
cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" .
2. Build the WASM binary
GOOS=js GOARCH=wasm go build -o main.wasm main.go
3. Open in browser

Use any simple server and visit http://localhost:8080

You should see an interactive calculator that performs tensor operations (add/multiply) using GoMLX in the browser.

Files

  • main.go - WASM application code
  • index.html - Web interface
  • README.md - This file

Notes

  • The simplego backend is portable but slower than XLA backends. This example focuses on portability and browser compatibility.
  • The WASM binary size is ~12MB due to the Go runtime and GoMLX being statically compiled.

Documentation

Rendered for js/wasm

Overview

WASM demo for GoMLX using the pure Go backend (simplego). Compiles to WebAssembly and runs tensor computations in the browser.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL