transcranial / keras-js

Run Keras models in the browser, with GPU support using WebGL
https://transcranial.github.io/keras-js
MIT License
4.96k stars 501 forks source link

explore potential speedups using WebGL 2.0 #50

Open transcranial opened 7 years ago

transcranial commented 7 years ago

WebGL2 is here, and there are a number of features worth exploring:

Will see if they offer any significant speedups.

https://webgl2fundamentals.org/webgl/lessons/webgl2-whats-new.html https://blog.chromium.org/2017/03/faster-3d-rendering-with-webgl-20.html

goodmansasha commented 7 years ago

Thanks for this awesome work! Regarding optimization, one potential issue is browser compatibility as the various browsers get on board over the coming months or (gasp!) years. Currently WebGL2 is available in about 1/4 of browsers ( http://caniuse.com/#feat=webgl2 ). To increase browser compatibility, it would be useful to turn off webgl entirely in keras-js. I couldn't find that option, however. If there is what is it?

Right now wayoflinn's weblas does not work on iOS devices: eg. https://github.com/waylonflinn/weblas/issues/39

I don't see much activity in his main branch now so having the option to turn off webgl would be useful until that gets settled.

waylonflinn commented 7 years ago

My hope is that WebGL 2.0 will resolve the issues with weblas on mobile.

My understanding is that the problems occur only in pipeline mode and that this is caused by lack of support for rendering to floating point textures on most mobile devices. The Khronos Group WebGL 2.0 Announcement (more specifically, pages 8 and 14) seems to indicate that rendering to floating point textures is no longer an extension to the spec, but now required.

I'd appreciate correction if I've misunderstood or if tests indicate that this isn't the case.

goodmansasha commented 7 years ago

Well I guess there is a 'gpu: false' setting . Didn't see that before :)