Re: [eigen] Status of building Eigen with Emscripten (running Eigen code in a Web browser) |
[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]
BenoitResults with SSE2:Next, I was interested in SIMD status. Emscripten is gaining the ability to target SIMD.js, simply by passing -msse2 as usual. Unfortunately, this seems to be only supported in Firefox Nightly at the moment, with other browsers at the "intent to implement" stage according to Mozilla documentation. Emscripten generates a polyfill so that SIMD code still "works" everywhere, but that fallback is very, very slow.So we're at roughly 40% of native performance with plain scalar code.Emscripten'd code in Chrome: 2.2 GFlop/sNative with -m32 -mno-sse: 6.0 GFlop/sBy default, Emscripten emulates a 32-bit arch with no SIMD. For 1024x1024 MatrixXf multiplication, I get:I was interested in performance, and in the status of SIMD.That is, aside from specifying the memory size or growth policy, there is nothing particular to do. You can then simply point your browser to the resulting eigen-benchmark.html.Emscripten is now very easy to get started with. Compiling the attached testcase is as easy as:Hi List,TL;DR: Emscripten currently allows to run scalar Eigen code at ~40% of native speed in multiple browsers. SIMD support makes this much better in supporting browsers, but that doesn't include any current stable shipping browser; In current stable browsers, SIMD makes things much *worse*.I just took another look at running Eigen MatrixXf multiplications in the browser, here is what I found.
em++ ~/vrac/eigen-benchmark.cc -I $HOME/eigen -O3 --std=c++11 -Wextra -s TOTAL_MEMORY=30000000 -o eigen-benchmark.html
Emscripten'd code in Firefox: 2.6 GFlop/s
Native with -m32 -msse2: 20 GFlop/s
Native with -m64 -msse2: 25 GFlop/s
Emscripten'd code in Firefox Nightly: 11.8 GFlop/s
Emscripten'd code in stable Firefox: 0.0015 GFlop/s
Emscripten'd code in stable Chrome: did not complete benchmarkSo the good news is that when SIMD.js is supported (in Firefox Nightly), it runs at 60% of native speed (since we should compare to -m32). The bad news is that enabling SIMD makes things unbearably slow when the fallback is used.Emscripten bug to track for making the SIMD fallback better: issue 3783Cheers,
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |