-
Notifications
You must be signed in to change notification settings - Fork 745
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
[SYCL] noexcept specifier device side ICE in LLVM-SPIRV #77
Comments
@agozillon thank you for reporting this. I thought we already fixed this bug in the driver by explicitly setting -fno-exceptions for device compiler. |
No problem! I'm glad that it's hopefully a simple fix. And yes, I remember reading some -fno-exceptions/exception disabling related commits at some point, can't seem to track the change down though so perhaps my memory is incorrect in this case. |
It won't be as simple as my suggested quick fix unfortunately, it will fix the problem stated in this issue but it seems to cause a different issue, that I didn't realize until I ran the unit tests (should have done that previously, it slipped my mind I was a little focused on our own use case, I apologize). Altering the compiler as I suggested will cause several tests in the SYCL test cases to break as they make use of perfectly legal host side try/catch, one example would be SYCLUnitTests :: basic_tests/queue.cpp. Forcing no exceptions for the device compiler seems to have the side affect of causing error diagnostics on the host try/catches as the device compiler still has to compile the whole source, including exception code which is classified as a compile error when fno-exceptions is flagged. At least that's what I believe from my current understanding. If this is the case I suppose, you could in theory turn off certain hard diagnostics related to the device compiler but I don't imagine that'd be considered particularly clean. |
Already fixed by #449 |
So, in the example above I'm passing a lambda to a function marked with a noexcept specifier that then invokes the lambda. So nothing fancy, but perhaps I'm doing something silly or the above is not legal SYCL in some way.
In either case case, this example will compile without the noexcept on the invoke function, but ICE with noexcept on the invoke function (it will also ICE if I put noexcept on the passed in lambda as well). I've attached the ICE to the bottom of the issue. I imagine even if this isn't legal in someway it shouldn't lead to an ICE, perhaps a diagnostic of some kind?
The compiler invocation I used in this case was:
$ISYCL_BIN_DIR/clang++ -std=c++11 -fsycl device_side_exception.cpp -o device_side_exception -lOpenCL
I dug into this one a bit, the LLVM-SPIRV translator seems to break on an LLVM landing pad call instruction and it's possible to get the example to compile with noexcept on the function by appending -fno-exceptions alongside the previous command.
I did a quick fix based on this and modified line 2839 of clang/lib/Frontend/CompilerInvocation.cpp to disable exceptions for the device similar to OpenMP+NVPTX and OpenCL C++. Maybe this isn't an ideal fix in this case however, and I'm missing the bigger picture though.
The text was updated successfully, but these errors were encountered: