TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: HipScript – Run CUDA in the browser with WebAssembly and WebGPU

309 pointsby lights01234 months ago
CUDA is NVIDIA's language for GPU programming, allowing you to mix write CPU and GPU code in C++ in one file. By chaining a few projects that compile CUDA to OpenCL, then Vulkan, then WebGPU, you can experiment with this GPGPU language on any hardware.

17 comments

Ameo4 months ago
The GoL example it loaded with seemed to be running way slower than I expected it to. It turns out that there&#x27;s actually a `usleep(1000 * 100)` call in the code which was inserted to make it easier to see the output; the actual kernels execute quickly and take up very little GPU time.<p>When I looked at the profiler, I was confused to see that one worker thread was at 100% usage the whole time it was running. At first, I thought that maybe it was actually running the code via Wasm on the CPU rather than on the GPU like it said.<p>Instead, it turns out that the worker was just running `emscripten_futex_wait` - which as far as I can tell is implemented by busy waiting in a loop. Probably doesn&#x27;t matter for performance since I imagine that&#x27;s just for the sleep call anyway.<p>----<p>Altogether this is an incredibly cool tool. I&#x27;m sure there is some performance gap compared to native, but even so this is a extremely impressive and likely has a ton of potential use cases.
评论 #42628170 未加载
_nalply4 months ago
Firefox supports WebGPU, but needs a setting in about:config. I enabled the setting but HipScript still denies running on Firefox with the message: &quot;Please try a Chromium-based browser like Google Chrome or Microsoft Edge.&quot;<p>Please do feature detection, not browser detection.
评论 #42627396 未加载
评论 #42633259 未加载
syrusakbary4 months ago
This is an awesome use of WASIX [1] and the Wasmer SDK [2]. Quite exciting to see!<p>I recommend as well reading through the blogpost (repo on [3]): <a href="https:&#x2F;&#x2F;lights0123.com&#x2F;blog&#x2F;2025&#x2F;01&#x2F;07&#x2F;hip-script&#x2F;" rel="nofollow">https:&#x2F;&#x2F;lights0123.com&#x2F;blog&#x2F;2025&#x2F;01&#x2F;07&#x2F;hip-script&#x2F;</a> (many things to improve on the Wasmer side... we have some work to do!)<p>[1] <a href="https:&#x2F;&#x2F;wasix.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;wasix.org&#x2F;</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;wasmerio&#x2F;wasmer-js">https:&#x2F;&#x2F;github.com&#x2F;wasmerio&#x2F;wasmer-js</a><p>[3] <a href="https:&#x2F;&#x2F;github.com&#x2F;lights0123&#x2F;hipscript&#x2F;">https:&#x2F;&#x2F;github.com&#x2F;lights0123&#x2F;hipscript&#x2F;</a>
bagels4 months ago
What an incredible demo&#x2F;hack. This is actually the simplest way to actually execute CUDA code that I&#x27;ve seen.
评论 #42626879 未加载
grconner4 months ago
This is just amazing. So clean and straightforward. On a Mac just run it in Chrome see things work automagically. For real fun change the generations constant to 2000 and delete the usleep line to see this thing really cook.
Cieric4 months ago
I love the idea of this, but sadly I can&#x27;t get it to work in Firefox, Chrome or Edge on my work pc, probably because I can&#x27;t find &quot;--enable-features=Vulkan&quot; equivalent in the about:flags and the argument doesn&#x27;t appear to work on windows. I&#x27;m actually a bit more curious about a standalone application that skips the webgpu part and goes straight to Vulkan as I would love to be able to experiment with some Cuda only applications.
评论 #42628604 未加载
评论 #42629062 未加载
punnerud4 months ago
How performant is the CUDA code in browser compared to standalone program?<p>Could we have PyTorch &#x2F; ML training with CUDA through the browser performing ok?
评论 #42627457 未加载
评论 #42632538 未加载
评论 #42632327 未加载
samagra144 months ago
Sounds interesting! I love all these edge experiments. But as long as there is architecture dependent code for models, I feel these edge experiments can&#x27;t fully express their strong suit.<p>You try to run something and Voila you need Ampere or Hopper or Laplace for flash attnt.
JackYoustra4 months ago
I don&#x27;t know why this never occurred to me. What a great website, glad you made it!
nullbyte4 months ago
Finally I can use my website visitors to mine dogecoins
mlepath4 months ago
This is really awesome. Tested it on both Nvidia and Mac GPUs.<p>Interested to know how debugging in a real application would work since WASM is pretty hard to debug and GPU code is pretty hard to debug. I assume WASM GPU is ... very difficult to debug.
评论 #42632539 未加载
JonChesterfield4 months ago
This feels like more stages than should be necessary (something should be able to do LLVM IR direct to WebGPU) but it&#x27;s great to see it running, very nice!
uncheckederror4 months ago
Impressed that this runs on my RX 6900XT (an RDNA2 GPU) in Chrome without any trouble. Very cool demo, excited to see how people leverage this capability.
ryanmerket4 months ago
Very cool. Thank you for creating this!
Lockal4 months ago
Now I wonder how long will it take to add chipStar&#x2F;Clspv&#x2F;Tint to <a href="https:&#x2F;&#x2F;github.com&#x2F;jhuber6&#x2F;doomgeneric&#x2F;tree&#x2F;amdgpu">https:&#x2F;&#x2F;github.com&#x2F;jhuber6&#x2F;doomgeneric&#x2F;tree&#x2F;amdgpu</a> and run DOOM on WebGPU this time.
CharlesW4 months ago
From the &quot;Learn More&quot; link (<a href="https:&#x2F;&#x2F;lights0123.com&#x2F;blog&#x2F;2025&#x2F;01&#x2F;07&#x2F;hip-script&#x2F;" rel="nofollow">https:&#x2F;&#x2F;lights0123.com&#x2F;blog&#x2F;2025&#x2F;01&#x2F;07&#x2F;hip-script&#x2F;</a>):<p><i>&quot;By chaining chipStar¹ (a HIP and NVIDIA® CUDA® to OpenCL compiler), Clspv² (an OpenCL to Vulkan compiler), and Tint³ (among others, a Vulkan shader to WebGPU shader compiler), you can run CUDA code in the browser!&quot;</i><p>¹ <a href="https:&#x2F;&#x2F;github.com&#x2F;CHIP-SPV&#x2F;chipStar&#x2F;">https:&#x2F;&#x2F;github.com&#x2F;CHIP-SPV&#x2F;chipStar&#x2F;</a> ² <a href="https:&#x2F;&#x2F;github.com&#x2F;google&#x2F;clspv&#x2F;">https:&#x2F;&#x2F;github.com&#x2F;google&#x2F;clspv&#x2F;</a> ³ <a href="https:&#x2F;&#x2F;dawn.googlesource.com&#x2F;dawn&#x2F;+&#x2F;refs&#x2F;heads&#x2F;main&#x2F;src&#x2F;tint&#x2F;" rel="nofollow">https:&#x2F;&#x2F;dawn.googlesource.com&#x2F;dawn&#x2F;+&#x2F;refs&#x2F;heads&#x2F;main&#x2F;src&#x2F;tin...</a>
评论 #42635341 未加载
bloomingkales4 months ago
How is this different than web-llm?
评论 #42627465 未加载