News for hackers. Stuff that matters.
Re:Google removes SIMD.js support from Chromium by pcwalton on Sunday June 04, 2017 @03:15AM (#14480255)
> The right path forwards is for JITs to emit SIMD code when possible

"Just rely on autovectorization" is what people have wanted to do for over a decade. We have yet to see satisfactory results for C. Why would JS be any easier?

> and for JS engines to provide OpenCL-like GPGPU-targeted APIs, following the trail that WebGL blazed with JS shaders.

Please don't! Nobody wants more APIs that rely on passing a string for a driver blob to compile. Standardize an IR (Web Assembly makes the most sense here).

Re:Google removes SIMD.js support from Chromium by marmaduke on Sunday June 04, 2017 @03:31AM (#14480293)
> We have yet to see satisfactory results for C...

That's not a fair assessment. Major compilers (LLVM, GCC, Intel) are able to vectorize real world code to a useful extent. No, they won't reorganize data to be more SIMD friendly but they can take the hard work out of writing ISA specific assemmbly.

Re:Google removes SIMD.js support from Chromium by dagss on Sunday June 04, 2017 @03:52AM (#14480339)
I think the parent with "satisfactory" meant "possible to achieve the maximum performance the hardware will support" (after all why settle for less?) You are answering another question.

Also, the point where you have reorganized your whole computation to be AVX-friendly it is just extra obfuscation to try to wrtie regular C and then check that the compiler outputs what you meant. Just using SIMD instructions is WYSIWYG; writing pure C is like competing in an obfuscated C contest.

Keep in mind it is not only SIMD, one might use shuffles and permutations in registers etc to communicate between the SIMD "threads".

I think the SSE/AVX intrinsics are nice to work with; they do what they say, but GCC will also turn them into something else if not supported, and perhaps apply some extra optimizations.

Re:Google removes SIMD.js support from Chromium by marmaduke on Sunday June 04, 2017 @01:49PM (#14482581)
Also, in my experience, maximum performance for most algorithms is not a clear cut line that I fall short of for lack of motivation. I see that maximum as a rather fuzzy unknown, approaching it is has diminishing returns on the time spent optimizing.
Re:Google removes SIMD.js support from Chromium by marmaduke on Sunday June 04, 2017 @01:46PM (#14482569)
Yeah I didn't mean that I would be over backwards to make it work, just that I happen to see great speed ups for my real world code with almost no effort.

For more complex stuff I'd be looking at ISPC or OpenCL before assembly since I can't afford to write ISA specific code.

Re:Google removes SIMD.js support from Chromium by brian-armstrong on Sunday June 04, 2017 @04:15AM (#14480387)
This isn't actually true for any meaningful speedup. You will at least need to use intrinsics to start to get as much as you can from the cpu
Re:Google removes SIMD.js support from Chromium by marmaduke on Sunday June 04, 2017 @01:44PM (#14482563)
The C kernel I've written here

https://github.com/numba/llvmlite/issues/270

is contrived but the structure resembles code I maintain related to differential equation integration. Autovec provides a very nice speed up for very little effort.

Re:Google removes SIMD.js support from Chromium by tmyklebu on Sunday June 04, 2017 @02:05PM (#14482654)
> Major compilers (LLVM, GCC, Intel) are able to vectorize real world code to a useful extent.

Try compiling this with recent gcc:

    uint8_t dumb_checksum(uint8_t *ar) {
      uint8_t ans = 0;
      for (int i = 0; i < 320; i++) ans += ar[i];
      return ans;
    }
You don't get satisfactory results. I, at least, don't have a clear mental model of when gcc will do something reasonable and when it will generate a large amount of bad code.
Re:Google removes SIMD.js support from Chromium by marmaduke on Tuesday June 06, 2017 @01:07PM (#14498889)
Sure there are bugs. There are also compiler flags which elucidate the model of loops it has and how it makes its decisions.
Re:Google removes SIMD.js support from Chromium by coldtea on Tuesday June 13, 2017 @03:55PM (#14548057)
>"Just rely on autovectorization" is what people have wanted to do for over a decade. We have yet to see satisfactory results for C.

That's because C is crap in that aspect and doesn't give enough guarantees and intents.

With a better language you could have great autovectorization in ever higher level code than C.

Re:Google removes SIMD.js support from Chromium by z3t4 on Sunday June 04, 2017 @04:06AM (#14480373)
what about __wasm {} in JS !? you can sort of already do that.