npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

webgpu-blas

v1.2.0

Published

Matrix operation on WebGPU

Downloads

25

Readme

WebGPU-BLAS (alpha version)

Fast matrix-matrix multiplication on web browser using WebGPU, future web standard.

The WebGPU standard is still in the process of being established and will not work in normal web browsers. There is also a possibility that the code will not work due to changes in the standard.

Benchmark

Performance comparison of WebGPU and WebGL in terms of matrix-matrix multiplication in different hardwares and browsers. WebGL is the standard API as of 2020 for accessing the GPU. (As of February 2022, WebGPU on Safari does not work. Updating of this figure is needed.)

WebGPU-BLAS benchmark

When using the WebGPU on Windows, 376 GFLOPS was achieved with a matrix size of 4096. This speed is 2.4 times faster than the speed of 156 GFLOPS when using WebGL.

Supported web browsers

  • Chrome Canary (100.0.4892.0) on Windows, MacOS (maybe Linux)
    • Enabling WebGPU feature flag (from chrome://flags/#enable-unsafe-webgpu ) is needed.

Chrome Canary WebGPU

As of February 2022, WebGPU is not available in Safari. Experimental WebGPU implementation on iOS 13 was removed in iOS 15. Older version for iOS 13

Usage

Fetch webgpublas.js from Releases.

// <script src="webgpublas.js"></script>
const [m, n, k] = [64, 64, 64];
const array_a = new Float32Array(m * k);//m*k row-major matrix
const array_b = new Float32Array(k * n);//k*n row-major matrix
// fill array_a, array_b
for (let i = 0; i < array_a.length; i++) {
  array_a[i] = Math.random();
}
for (let i = 0; i < array_b.length; i++) {
  array_b[i] = Math.random();
}
const alpha = 1.0;
const result = await webgpublas.sgemm(m, n, k, alpha, array_a, array_b);
console.log(result); // m*n row-major matrix (Float32Array)

Limitation

sgemm

  • Input matrix "C" of ordinary blas is not yet supported.
  • To use efficient implementation, the condition m % 32 === 0 && n % 64 === 0 && k % 4 === 0 && alpha === 1.0 have to met.
  • When the device / browser does not support WebGPU, fallback pure JavaScript implementation is used.

Development

Setup

yarn

Build

For npm package

yarn build

For webpack single js

yarn webpack

Shader compile

For shader for Chrome, SPIR-V binary format is needed.

SPRI-V can be compiled from text-based GLSL shader. To compile, use helper interface in compile directory.

GLSL shader is stored in shader directory. For example, shader/sgemm_block.glsl is compiled and stored in src/shader_sgemm_block.ts.

License

MIT

examples/sgemm/dist/weblas: weblas by @waylonflinn