{"id":17283541,"url":"https://github.com/milhidaka/webgpu-blas","last_synced_at":"2025-02-26T20:09:13.404Z","repository":{"id":42962933,"uuid":"226028855","full_name":"milhidaka/webgpu-blas","owner":"milhidaka","description":"Fast matrix-matrix multiplication on web browser using WebGPU","archived":false,"fork":false,"pushed_at":"2024-08-29T07:02:20.000Z","size":2173,"stargazers_count":118,"open_issues_count":3,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-19T19:09:44.417Z","etag":null,"topics":["accelerator","javascript","linear-algebra","webgpu"],"latest_commit_sha":null,"homepage":"https://milhidaka.github.io/webgpu-blas/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/milhidaka.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-05T06:08:39.000Z","updated_at":"2025-02-14T04:37:28.000Z","dependencies_parsed_at":"2024-01-10T11:48:50.619Z","dependency_job_id":"46c4c459-0855-4265-a502-1777661fb11c","html_url":"https://github.com/milhidaka/webgpu-blas","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milhidaka%2Fwebgpu-blas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milhidaka%2Fwebgpu-blas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milhidaka%2Fwebgpu-blas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milhidaka%2Fwebgpu-blas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/milhidaka","download_url":"https://codeload.github.com/milhidaka/webgpu-blas/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240926391,"owners_count":19879737,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["accelerator","javascript","linear-algebra","webgpu"],"created_at":"2024-10-15T09:51:35.667Z","updated_at":"2025-02-26T20:09:13.382Z","avatar_url":"https://github.com/milhidaka.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WebGPU-BLAS (alpha version)\n\nFast matrix-matrix multiplication on web browser using [WebGPU](https://gpuweb.github.io/gpuweb/), future web standard.\n\nThe 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.\n\n# Benchmark\n\nPerformance 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.)\n\n![WebGPU-BLAS benchmark](docs/images/benchmark.png)\n\nWhen 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.\n\n# Supported web browsers\n\n- Chrome (120) on Windows, MacOS\n\nAs of January 2024, WebGPU is not available in Safari. Experimental WebGPU implementation on iOS 13 was removed in iOS 15. [Older version for iOS 13](https://github.com/milhidaka/webgpu-blas/tree/7781151dce8569f67ac0282cf0b3e1ace80e2ca9)\n\n# Usage\n\nFetch `webgpublas.js` from [Releases](https://github.com/milhidaka/webgpu-blas/releases).\n\n```javascript\n// \u003cscript src=\"webgpublas.js\"\u003e\u003c/script\u003e\nconst [m, n, k] = [64, 64, 64];\nconst array_a = new Float32Array(m * k);//m*k row-major matrix\nconst array_b = new Float32Array(k * n);//k*n row-major matrix\n// fill array_a, array_b\nfor (let i = 0; i \u003c array_a.length; i++) {\n  array_a[i] = Math.random();\n}\nfor (let i = 0; i \u003c array_b.length; i++) {\n  array_b[i] = Math.random();\n}\nconst alpha = 1.0;\nconst result = await webgpublas.sgemm(m, n, k, alpha, array_a, array_b);\nconsole.log(result); // m*n row-major matrix (Float32Array)\n```\n\n# Limitation\n## sgemm\n- Input matrix \"C\" of ordinary blas is not yet supported.\n- To use efficient implementation, the condition `m % 32 === 0 \u0026\u0026 n % 64 === 0 \u0026\u0026 k % 4 === 0 \u0026\u0026 alpha === 1.0` have to met.\n- When the device / browser does not support WebGPU, fallback pure JavaScript implementation is used.\n\n# Development\n\n## Setup\n```\nnpm install\n```\n\n## Build\n\nFor npm package\n```\nnpm run build\n```\n\nFor webpack single js\n```\nnpm run webpack\n```\n\n# License\n\nMIT\n\n`examples/sgemm/dist/weblas`: weblas by @waylonflinn\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmilhidaka%2Fwebgpu-blas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmilhidaka%2Fwebgpu-blas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmilhidaka%2Fwebgpu-blas/lists"}