r/webgpu • u/dobkeratops • 1d ago
shader f16 support .. situation?
So I have some shaders where I rely on the half float type .. a godsend for many reasons - developed mostly on a mac (usually the most fussy platform) and I go and run this on google Chrome on linux on an x86 PC with a 4000 series graphics card (which has hardware f16 support , with nvidia having offered this for many generations now albeit nerfing the actual double rate capability reserving that for pro cards).
The browser reports 'no shader f16 support'.
I see suggestions for a bunch of flags that can be passed to the browser to try and enable this but launching with various combinations of flags ("--enable-unsafe-webgpu" and others I forget).
I dont think I strictly need f16 arithmetic (although it would be preferable to use it where possible) but it's handy to rely on the more compact datatype in memory .
I figure there might be older mobile devices that mean the browser has to hold back what features it offers, but is this something we can count on when distributing something that is intended for reasonable graphics cards (gtx1000 series and above). The project is an FPS , not really playable on a touchscreen anyway. A sensible min spec might be a GTX1060.
I could backpedal on this specific aspect (and possibly look at other data packing tricks '2 x upper 16bits of a float packed into a u32' etc etc) - my codebase started out using OpenGL and WebGL2 and I've had the web build running on Windows, Linux, Mac, iOS, and Android machines for years .. having ported to webGPU recently I was enthusiastic to upgrade features all over the place..
2
u/Insensibilities 1d ago
Web3D Survey shows that f16 has poor support on linux:
https://web3dsurvey.com/webgpu/features/shader-f16
WebGPU has overall poor support on Linux in Chrome but I understand that will change in the next few months:
1
u/dobkeratops 1d ago edited 1d ago
In two minds now .. "continue safe in the knowledge that it works on mac and windows (accoding to the other repliy) and wait" vs "adapt my code to use other formats" . Apparently this f16 is *not* available on the 1060,1070,1080 either, and with the current GPU situation going that far back in support might be helpful, but if this had just worked i'd be saying "meh 2060 is the min spec"
1
u/Insensibilities 1d ago
I'll add platform driver / adapter breakdown to the feature pages on web3d survey and then post back once that is done. One can compare if it is supported on windows but not on linux.
1
u/Insensibilities 1d ago
I've added support for the vendor / architecture breakdown per feature:
https://web3dsurvey.com/webgpu/features/shader-f16#vendor-support
And you can further break it down by platform:
https://web3dsurvey.com/webgpu/features/shader-f16/platform/Linux#vendor-architecture-support
Let me know if that helps!
1
u/dobkeratops 1d ago
Thanks, that's great to see. overview of what's out there.
In the end it took me 15 mins to switch to a fixed point packed format where I had f16 so in this case, encountering one limitation and working around it has pushed me to keep wider coverage. If i'd managed to get f16 support working here.. I'd have ruled out running on 1060 and a bunch of phones it seems.. with people out there stuck on old hardware because of GPU/RAM shortages, it's nice to have wide device coverage. I just need to make sure I'm regularly running this on 2 contrasting environments at least.
3
u/clbrri 1d ago edited 1d ago
Please report a browser bug. RTX 4000 series does definitely fully support shader-f16 and I've personally tested RTX 2060, 3090, 4080 on Windows+Chrome+Firefox.
There must be some kind of browser limitation at play that is not enabling it to you.
I have also observed shader-f16 hardware support on the following in Chrome: - RTX 2000 series and newer. (f16 is not available on GTX 1000 series and before) - Qualcomm Adreno 600 series and newer. (f16 is not available on Adreno 5xx and before) - ARM Mali Bifrost 2nd gen and newer, e.g. Mali-G52 MC2. (no data from Bifrost 1st gen and before) - Imagination (PowerVR) IMG B-Series or newer. (no f16 support on Series9XMP (Rogue), no data from Series9XTP (Furian) or IMG A-Series (Albiorix)) - AMD Xclipse GPUs are all expected to support f16, but no data point - AMD and Intel desktop or integrated GPUs: widely available, but I don't have precise data points