|
|
|
|
|
by Birch-san
1784 days ago
|
|
yes, I compiled with -msimd128 to enable LLVM's auto-vectorization. I distribute both SIMD and non-SIMD, and the entrypoint picks whichever distribution your browser supports. for box2d-wasm, SIMD acceleration resulted in a 0.6–0.9% performance boost [0] when simulating a pyramid of boxes. liquidfun-wasm is a fork with additional algorithms for performantly simulating particles. I have not yet built a benchmark to measure the particle code, but do intend to. I am optimistic that liquidfun's particle code could auto-vectorize better than the general Box2D code. the Google engineers considered how to take advantage of SIMD, to the extent that they even ship a NEON SIMD algorithm[1]. I don't believe my compiler config will use that NEON algorithm (and will instead fallback to the general algorithm [2]). that's probably not a missed opportunity; many NEON features are not supported[3]. but since the engineers were thinking about SIMD, hopefully the non-NEON algorithm will try to make good use of the CPU and memory layout too, and auto-vectorize well. [0] https://github.com/Birch-san/box2d.ts/pull/1 [1] https://github.com/google/liquidfun/blob/master/liquidfun/Bo... [2] https://github.com/google/liquidfun/blob/master/liquidfun/Bo... [3] https://emscripten.org/docs/porting/simd.html#compiling-simd... |
|