New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
emcc does not lower too-large vector types #4789
Comments
Yeah, this is a current limitation, we don't split up too large SIMD operations to smaller ones. I wonder if LLVM might have some kind of automated higher level machinery to do that. Note that SIMD.js doesn't have a |
For reference, here's a starting trail to the conversations about |
In my specific case I don't care about SIMD speedups per-se, I care about compiling an existing codebase that uses vectors that are too large and expects the compiler to lower them. My impression is that LLVM normally does this through TargetLowering but that emscripten skips the SelectionDAG stuff altogether, so this machinery can't be reused. Doing this through an opt pass might not be too bad, to lower into, say an array of vectors, although some care would need to be taken to implement gather and scatter and to make sure that a later pass does not re-vectorize. Perhaps for the more complex vector intrinsics, it might be easier to not replace them inline and instead call out to a polyfill function. I might take a crack at writing such an opt pass if I ever get some free time. |
LLVM does normally handle this via target-independent SelectionDAG code,
and you are correct that skipping that is the reason that fastcomp doesn't
support this functionality. It could be done via an LLVM IR pass (the way
the rest of the type "lowering" is done in fastcomp); my guess is that it's
straightforward in principle but tricky in practice. When WebAssembly gets
SIMD support (which we expect to have essentially the same functionality as
the SIMD.js spec) the upstream wasm backend should support it via the
conventional mechanisms. In fact there's a bit of proto-SIMD support there
already which needs fleshing out (obviously it also needs an implementation
in a wasm engine which isn't exposed yet either).
…On Tue, Dec 13, 2016 at 6:19 AM Allan Wirth ***@***.***> wrote:
In my specific case I don't care about SIMD speedups per-se, I care about
compiling an existing codebase that uses vectors that are too large and
expects the compiler to lower them.
My impression is that LLVM normally does this through TargetLowering but
that emscripten skips the SelectionDAG stuff altogether, so this machinery
can't be reused. Doing this through an opt pass might not be too bad, to
lower into, say an array of vectors, although some care would need to be
taken to implement gather and scatter and to make sure that a later pass
does not re-vectorize. Perhaps for the more complex vector intrinsics, it
might be easier to not replace them inline and instead call out to a
polyfill function.
I might take a crack at writing such an opt pass if I ever get some free
time.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#4789 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABEiKJc7rPcxy2HS1CncQZXjHH96glwXks5rHql0gaJpZM4LKHH9>
.
|
I did this work years ago for PNaCl: https://codereview.chromium.org/1423873002. Sadly it never got merged, but it should still work for this. |
This issue has been automatically marked as stale because there has been no activity in the past 2 years. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant. |
Consider the following program:
emcc fails to compile this with an unexplained assertion error:
LLVM ERROR: VT->getBitWidth() <= 128
, but clang and GCC handle it fine. The solution is to lower the too-large SIMD types until they are of supported width.The text was updated successfully, but these errors were encountered: