Most active commenters
  • pjmlp(7)
  • (3)
  • soheil(3)

←back to thread

WebGPU-Based WiFi Simulator

(wifi-solver.com)
325 points jasmcole | 36 comments | | HN request time: 1.303s | source | bottom
1. noahbp ◴[] No.41897720[source]
It's so frustrating that WebGPU support was released 1.5 years ago on Chrome, and yet is still unavailable on all other browsers.

This is a real killer feature that will dramatically slow adoption of non-Chromium browsers, even with Google defanging ad blockers.

replies(9): >>41897739 #>>41897797 #>>41897800 #>>41897830 #>>41897856 #>>41897860 #>>41897886 #>>41897974 #>>41898014 #
2. jasmcole ◴[] No.41897739[source]
Agreed! Though support should be coming soon it seems. As a complete WebGPU novice I was really impressed with how quick it was to get going.
3. gnarbarian ◴[] No.41897797[source]
it's still not well supported on Linux unfortunately either
4. pjmlp ◴[] No.41897800[source]
Even Chrome only supports it officially on Windows, macOS and Android, no GNU/Linux (as stable).

And when it becomes widespread, just like WebGL 2.0, it will be a decade behind of what native APIs are capable of.

And in both cases, good luck debugging, other than replicating the content on native APIs, as means to use proper GPU debuggers, because even Chrome has yet to offer any developer tooling for GPU debugging.

replies(1): >>41897822 #
5. petermcneeley ◴[] No.41897822[source]
Runs great on my ChromeBook.
replies(3): >>41897848 #>>41897971 #>>41899270 #
6. moffkalast ◴[] No.41897830[source]
For Safari that's par for the course, but Firefox is in surprisingly far behind in terms of anything GPU related in the browser.

I've recently been shocked trying out the WebGL aquarium demo [0] on Chrome and Firefox after running into some really odd performance issues on a project. You'd expect them to behave about the same with GPU acceleration, but FF barely gets half the framerate at the same load. Like, what?! On Linux FF is also several times slower at canvas rendering.

[0] https://webglsamples.org/aquarium/aquarium.html

replies(1): >>41897893 #
7. pjmlp ◴[] No.41897848{3}[source]
Forgot about that, which isn't GNU/Linux anyway.
replies(1): >>41898034 #
8. ◴[] No.41897856[source]
9. ◴[] No.41897860[source]
10. soheil ◴[] No.41897886[source]
Why do you need webgpu? It's unfortunate that people use technology that is "state-of-the-art techniques to run simulations at interactive speeds" without fully understanding what it's for. General compute on GPU is what webgpu is for.. To simulate basic waves like in this demo you absolutely do not need that, in fact it's an indication the author implemented the solution in a non-optimal way. WebGL is fully supported by all browsers fully supported by well-maintained libs like 3js, yet here we are people writing a sin function with basic interference patterns, one of the most elementary 3D primitives, in webgpu and argue that's using the "state-of-the-art" techniques.
replies(1): >>41897933 #
11. epuixrk ◴[] No.41897893[source]
I‘m not an expert but I think it works on IOS with Safari. You have to enable WebGPU in the extra flag category in the settings app.

But I still need to figure out what exactly this is.

replies(1): >>41897978 #
12. jasmcole ◴[] No.41897933[source]
Good question! This is actually a numerical solver for a few coupled partial differential equations - the method in this context (electromagnetism) is called FDTD. It's implemented as a WebGPU compute shader.

You absolutely could do this using WebGL2 compute shaders too, but I thought it would be fun to try this newer API.

replies(2): >>41898010 #>>41898082 #
13. SoKamil ◴[] No.41897971{3}[source]
ChromeOS is not a Linux distribution, change my mind.
replies(1): >>41898147 #
14. jsheard ◴[] No.41897974[source]
Especially frustrating in the case of Safari, which only needs to support one native API backend (Metal) on a pretty narrow set of hardware and drivers. Firefox has a much bigger task with needing to support everything, like Chrome, but with far less resources than Google or Apple can afford to throw at it.
replies(1): >>41898559 #
15. givinguflac ◴[] No.41897978{3}[source]
Can confirm, I have it enabled on iOS 18.1 and this seems to work fine.
16. zorgmonkey ◴[] No.41898010{3}[source]
Annoyingly WebGL2 doesn't have compute shaders even though GLES3.x that it is based on does.
replies(2): >>41898026 #>>41898296 #
17. modeless ◴[] No.41898014[source]
WebGL 2 took almost 5 years to come to Safari after Chrome. It will not take as long for WebGPU; development is active now.

It is also a bit frustrating that Chrome has not enabled WebGPU on all platforms by default yet.

18. ◴[] No.41898026{4}[source]
19. murderfs ◴[] No.41898034{4}[source]
By what metric? It's a gentoo deriviative with glibc, coreutils, etc.
replies(1): >>41898273 #
20. soheil ◴[] No.41898082{3}[source]
I don't understand what other type of solution is there to render on a gpu other than a numeric one?

Here is a very basic shader for what you want:

  float freq1 = 2.0;
  float freq2 = 3.0;
  float amp = 0.5;

  pos.z += sin(pos.x * freq1 + uTime) * amp;
  pos.z += cos(pos.y * freq2 + uTime) * amp;

  gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);
replies(2): >>41898209 #>>41899281 #
21. yjftsjthsd-h ◴[] No.41898147{4}[source]
ChromeOS is a Linux kernel with some software bundled on top to make a usable system; it is by definition a Linux distro. Curiously, it's even a GNU/Linux distro, as it uses glibc and GNU coreutils, unlike ex Android which is a non-GNU distro.

I will grant that it's a slightly odd distro, but is it any weirder than NixOS or Fedora Silverblue?

replies(1): >>41898281 #
22. vardump ◴[] No.41898209{4}[source]
That's no solver, it just displays a sine wave pattern.
23. pjmlp ◴[] No.41898273{5}[source]
A JavaScript userspace juggling Chrome instances.
replies(1): >>41898381 #
24. pjmlp ◴[] No.41898281{5}[source]
Only runs browser instances. Even Crostini is sandoxed in a way similar to WSL2.
replies(1): >>41898368 #
25. pjmlp ◴[] No.41898296{4}[source]
Thank Google for that, as they dropped Intel contribution to WebGL Compute, with the reasoning WebGPU would be good enough.
26. yjftsjthsd-h ◴[] No.41898368{6}[source]
User-facing apps are browser instances and VMs, and under that is a pretty normal userland. It's still a distribution of software on a Linux kernel. And for that matter, is Silverblue any less a Linux distro with its read-only root and apps in flatpak/distrobox? Are Qubes OS or Proxmox with everything in VMs?
replies(1): >>41901218 #
27. murderfs ◴[] No.41898381{6}[source]
...no, it isn't?

Even if you're claiming (incorrectly) that the window manager, etc. contain javascript, the same would apply to GNOME!

replies(1): >>41901221 #
28. aabhay ◴[] No.41898559[source]
Its in technology preview, so likely to go GA at the next major OS cycle (1yish)
replies(1): >>41898600 #
29. jsheard ◴[] No.41898600{3}[source]
I'm not holding my breath, their WebGL2 support entered preview in early 2017 but didn't actually ship until late 2021...
replies(1): >>41900737 #
30. koolala ◴[] No.41899270{3}[source]
No luck on Steam Deck :(
31. dankwizard ◴[] No.41899281{4}[source]
Did ChatGPT write that for you because it has missed the mark by 500 metres.
replies(1): >>41900112 #
32. soheil ◴[] No.41900112{5}[source]
It's a sin + cos function.. you need an AI for that?
replies(1): >>41901098 #
33. fulafel ◴[] No.41900737{4}[source]
And last I heard still has show-stopping performance bugs affecting eg Unity web target.
34. _flux ◴[] No.41901098{6}[source]
The point was that the implementation of this tool is not a sin+cos function. It's more like

  let newEz = Ez0[me] +  calcEzDiff(vec2u(id.x, id.y), dx, dy, aspect);

  let newEzAbove = Ez0[above] +  calcEzDiff(vec2u(id.x, id.y + 1), dx, dy, aspect);
  let newEzRight = Ez0[right] +  calcEzDiff(vec2u(id.x + 1, id.y), dx, dy, aspect);

  Hx1[me] = Hx0[me] - (uniforms.dt/mu0)*(newEzAbove - newEz) / dy;
  Hy1[me] = Hy0[me] + (uniforms.dt/mu0)*(newEzRight - newEz) / dx;

  Ez1[me] = newEz;

  let localDelta = delta[me];
  let fac = 1 + uniforms.omega * uniforms.dt * (delta[me] / eps[me] / 2);
  Ez1[me] = Ez1[me] / fac;
  Hx1[me] = Hx1[me] / fac;
  Hy1[me] = Hy1[me] / fac;
and then a bunch of other GPU code. You can find this with little effort from the bundle, if you care, by base64-decoding the Pt("xxx") parts.

Though I do imagine it indeed could be implementable with WebGL shaders, but I also wouldn't start a new compute-based on it, unless I had a particular need to support older systems. And this I say as a Firefox user..

35. pjmlp ◴[] No.41901218{7}[source]
People buying a Chromebook down at the mall will never see GNU userland.

Folks using Silverblue and Flatpak distributions get to use GNU userland.

36. pjmlp ◴[] No.41901221{7}[source]
GNOME allows GNU userland to be used.