News for hackers. Stuff that matters.
Re:WebGPU Shading Language by Jasper_ on Tuesday March 10, 2020 @11:17AM (#22536138)
GPU's rarely have double precision arithmetic.
Re:WebGPU Shading Language by rrss on Tuesday March 10, 2020 @11:40AM (#22536361)
Which GPUs do not have double precision arithmetic? As far as I'm aware, all of AMD's and Nvidia's from the last decade have double precision support. It may not be fast, but it's there.
Re:WebGPU Shading Language by Jasper_ on Tuesday March 10, 2020 @11:58AM (#22536558)
Right, the desktop GPUs have support for float64, but it's not exposed in HLSL/GLSL to the best of my knowledge. "precision highp float" in GLSL will get you 32-bit on all vendors AFAIK, you have to use OpenCL/CUDA for 64-bit floats, but it's way slower and actually sometimes emulated.

None of the mobile GPU vendors (Apple, ARM Mali, Qualcomm, PVR, BroadCom) support it. You can see that here, where the only vendors supporting shaderFloat64 in Vulkan are desktop GPUs. http://vulkan.gpuinfo.org/listdevicescoverage.php?feature=sh...

Re:WebGPU Shading Language by yoden on Tuesday March 10, 2020 @01:19PM (#22537358)
64 bit support has been around on the desktop for a decade at this point (Through OpenGL4 / GL_ARB_gpu_shader_fp64 / cl_khr_fp64).

Unfortunately it is not exposed in Firefox or Chrome, even if the underlying hardware supports it. I think this is creating a chicken and egg problem - if WebGL were to actually support the capabilities of the underlying hardware, maybe there would be more interest in deploying 64-bit extensions on other platforms like mobile. Even emulated support would be a win, compared to having every developer emulate fp64/i64 themselves in GLSL.

So I am also disappointed in this proposal's failure to mention 64-bit support, even as an extension. At least they're reserving the keywords, I guess.

Re:WebGPU Shading Language by pcwalton on Tuesday March 10, 2020 @01:10PM (#22537279)
GLSL has 64-bit values with "double" and "dvecN" since 4.0 [1] or with ARB_gpu_shader_fp64 [2]. I don't know if anyone actually uses them, though :)

[1]: https://www.khronos.org/opengl/wiki/Data_Type_(GLSL)#Scalars

[2]: https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_g...

Re:WebGPU Shading Language by klodolph on Tuesday March 10, 2020 @05:11PM (#22539750)
Desktop GPUs commonly have support for float64, and it's accessible in GLSL (how else would you use it?) and presumably HLSL.

The data types are prefixed with "d", so you have vec4 for float[4], and dvec4 for double[4].

Re:WebGPU Shading Language by atq2119 on Tuesday March 10, 2020 @06:00PM (#22540251)
fp64 is exposed in GLSL at least, but on desktop GPUs it's typically 16x (AMD) or 32x (Nvidia) slower than fp32.

Add that fact that mobile GPUs and some Intel GPUs don't support it in hardware at all, it makes a lot of sense to leave fp64 out of WebGPU.

Re:WebGPU Shading Language by fulafel on Tuesday March 10, 2020 @12:42PM (#22537007)
Most GPUs are in mobile devices.

Edit: and most of the rest are Intel.

Re:WebGPU Shading Language by jcelerier on Wednesday March 11, 2020 @05:08AM (#22544267)
Most animals on earth are ants. Do you propose we optimize for them ?
Re:WebGPU Shading Language by fulafel on Thursday March 12, 2020 @10:59AM (#22557538)
Not sure what you were aiming for with the analogy, but I'm glad this made me look up the size difference between ants and humans. Humans are O(100 kg) and ants are O(1 mg), 5 orders of magnitude.

It would be interesting to see a graphics API designed to cover a range of 100 000x in performance.

Looks like Nvidia TNT had 2 GB/s of memory bandwidth in 1998 and the high end current ones have ~300-600 GB/s. That's just two orders of magnitude difference. Current fast mobile GPUs seem to get 40 GB/s so that plops to about the middle of the historical PC dGPU range, and is just 1 order of magnitude less than dGPUs.

Re:WebGPU Shading Language by jcelerier on Thursday March 12, 2020 @06:53PM (#22562832)
I'm saying that just because mobile device is the majority of devices does not mean that we have to care about them. Rule of the majority is never a good rule.
Re:WebGPU Shading Language by fulafel on Friday March 13, 2020 @02:17AM (#22565170)
Depends on who "we" are, from POV of browser vendors and makers of web graphics apps, there's certainly a compromise needed in adding features for niche users that contribute to the combinatorial explosion of tested configurations. Consider that even WebGL 2 currently is struggling to have a viable level of browser support.

WebGL mostly serves people with Intel/mobile GPUs, so will probably WebGPU if it is to survive, even though it aims to do better on the high end GPUs as well.

Re:WebGPU Shading Language by grenoire on Tuesday March 10, 2020 @11:39AM (#22536356)
I'm not sure if you're left over from 2007, but practically all Nvidia GPUs since 2008 have had double precision arithmetic. Integers are still compiled to 32-bit, sometimes, but doubles have been standard for quite a while.