Skip to content

Compiler crash at pass 'SYCL Local Accessor to Shared Memory' on CUDA backend caused by https://github.com/intel/llvm/pull/5149 #5600

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

Closed
jingwan2 opened this issue Feb 17, 2022 · 1 comment · Fixed by #5859
Labels
bug Something isn't working compiler Compiler related issue cuda CUDA back-end

Comments

@jingwan2
Copy link

jingwan2 commented Feb 17, 2022

Describe the bug
Compiler crash at pass 'SYCL Local Accessor to Shared Memory' on CUDA backend, caused by #5149

To Reproduce

  1. CUDA backend compiler 58508ba or later

  2. Get attached main.txt and foo.txt, rename to main.cpp and foo.cpp

  3. clang++ -fsycl -fsycl-unnamed-lambda -fsycl-targets=nvptx64-nvidia-cuda-sycldevice main.cpp foo.cpp

Log

  1. Code generation
  2. Running pass 'SYCL Local Accessor to Shared Memory' on module '/tmp/main-edc15a/main-sm_50.bc'.
    Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var LLVM_SYMBOLIZER_PATH to point to it):
    bin/clang++(+0x24d4e64)[0x561ba6e2ce64]
    bin/clang++(+0x24d258e)[0x561ba6e2a58e]
    /lib/x86_64-linux-gnu/libpthread.so.0(+0x153c0)[0x7fcd901e93c0]
    bin/clang++(+0x24e6c65)[0x561ba6e3ec65]
    bin/clang++(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x382)[0x561ba64acb62]
    bin/clang++(+0x284e99e)[0x561ba71a699e]
    bin/clang++(_ZN5clang17EmitBackendOutputERNS_17DiagnosticsEngineERKNS_19HeaderSearchOptionsERKNS_14CodeGenOptionsERKNS_13TargetOptionsERKNS_11LangOptionsEN4llvm9StringRefEPNSE_6ModuleENS_13BackendActionESt10unique_ptrINSE_17raw_pwrite_streamESt14default_deleteISK_EE+0x49e)[0x561ba71ab8ce]
    :bin/clang++(_ZN5clang13CodeGenAction13ExecuteActionEv+0xfbe)[0x561ba802a04e]
    :bin/clang++(_ZN5clang14FrontendAction7ExecuteEv+0xd9)[0x561ba7941799]
    :bin/clang++(_ZN5clang16CompilerInstance13ExecuteActionERNS_14FrontendActionE+0x14e)[0x561ba78ccd9e]
    :bin/clang++(_ZN5clang25ExecuteCompilerInvocationEPNS_16CompilerInstanceE+0x213)[0x561ba7a25153]
    :bin/clang++(_Z8cc1_mainN4llvm8ArrayRefIPKcEES2_Pv+0x68c)[0x561ba56eed8c]
    :bin/clang++(+0xd93228)[0x561ba56eb228]
    :bin/clang++(main+0x3e9)[0x561ba566f849]
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7fcd8fa680b3]
    :bin/clang++(_start+0x2e)[0x561ba56ead9e]
    llvm-foreach: Segmentation fault (core dumped)
    clang++: error: clang frontend command failed with exit code 254 (use -v to see invocation)

It compile pass if without #5149.
WA is don't compile foo.cpp since it's included in main.cpp:
clang++ -fsycl -fsycl-unnamed-lambda -fsycl-targets=nvptx64-nvidia-cuda-sycldevice main.cpp

Environment (please complete the following information):

@jingwan2 jingwan2 added the bug Something isn't working label Feb 17, 2022
@alexbatashev alexbatashev added the cuda CUDA back-end label Feb 17, 2022
@AerialMantis AerialMantis added the compiler Compiler related issue label Feb 19, 2022
@jchlanda
Copy link
Contributor

@jingwan2 Please see #5859 for the fix.

It looks like clang inserted multiple pointers to the same metadata in the annotations node, I'm guessing it's because you've both #include'ed foo.cpp in the main.cpp and also specified it in the compiler invocation, so clang outputted:

!nvvm.annotations = !{!0, !0}

With !0 pointing to @_ZTSZZL3fooN2cl4sycl5queueEPjiENKUlRNS0_7handlerEE_clES4_EUlNS0_7nd_itemILi1EEEE_ kernel.

Should be fixed now.

bader pushed a commit that referenced this issue Mar 23, 2022
…5859)

It's possible that clang would store multiple pointers to the same `MDNode` in the `annotations` metadata, keep track of visited ones while populating the kernels.

Fixes #5600
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler Compiler related issue cuda CUDA back-end
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants