Description
I am attempting to compile the example in Fig 2.7 from the DPC++ book by Reinders et al. Here is the code:
#include <CL/sycl.hpp>
#include <iostream>
using namespace sycl;
int main() {
// Create queue on whatever default device that the implementation
// chooses. Implicit use of the default_selector.
queue Q;
std::cout << "Selected device: " <<
Q.get_device().get_info<info::device::name>() << "\n";
return 0;
}
I compile it with:
clang++ -fsycl -fsycl-targets=nvptx64-nvidia-cuda-sycldevice -fsycl-unnamed-lambda fig-2.7.cpp -o fig-2.7
which give the following output:
clang-13: /home/joel/sycl_workspace/llvm/llvm/lib/Target/NVPTX/SYCL/LocalAccessorToSharedMemory.cpp:51: virtual bool (anonymous namespace)::LocalAccessorToSharedMemory::runOnModule(llvm::Module &): Assertion `NvvmMetadata && "IR compiled to PTX must have nvvm.annotations"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /home/joel/sycl_workspace/llvm/build/bin/clang-13 -cc1 -triple nvptx64-nvidia-cuda-sycldevice -fsycl -fsycl-is-device -fdeclare-spirv-builtins -aux-triple x86_64-unknown-linux-gnu -Wno-sycl-strict -sycl-std=2020 -S -disable-free -main-file-name fig-2.7.cpp -mrelocation-model static -mframe-pointer=all -fno-rounding-math -fno-verbose-asm -no-integrated-as -aux-target-cpu x86-64 -internal-isystem /home/joel/sycl_workspace/llvm/build/bin/../include/sycl -mlink-builtin-bitcode /home/joel/sycl_workspace/llvm/build/lib/clang/13.0.0/../../clc/libspirv-nvptx64--nvidiacl.bc -mlink-builtin-bitcode /usr/local/cuda-11.1/nvvm/libdevice/libdevice.10.bc -target-feature +ptx71 -target-sdk-version=11.1 -target-cpu sm_50 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /home/joel/sycl_workspace/llvm/build/lib/clang/13.0.0 -fno-dwarf-directory-asm -fdebug-compilation-dir /home/joel/sycl_test -ferror-limit 19 -fgnuc-version=4.2.1 -fcolor-diagnostics -fsycl-unnamed-lambda -o /tmp/fig-2-825a7c.s -x ir /tmp/fig-2-359f3e.bc
- Code generation
- Running pass 'localaccessortosharedmemory' on module '/tmp/fig-2-359f3e.bc'.
#0 0x0000000001cdac03 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/joel/sycl_workspace/llvm/build/bin/clang-13+0x1cdac03)
Enable execution on GPU and ACC #1 0x0000000001cd8a0e llvm::sys::RunSignalHandlers() (/home/joel/sycl_workspace/llvm/build/bin/clang-13+0x1cd8a0e)
[SYCL] Using NoSignedWrap decoration without declaring SPV_KHR_no_integer_wrap_decoration #2 0x0000000001cdb0cf SignalHandler(int) Signals.cpp:0:0
[SYCL] LLVM ERROR: OCL version mismatch while building test application #3 0x00007fc0f6e1e690 __restore_rt (/lib64/libpthread.so.0+0x13690)
[SYCL] Support building on ARM #4 0x00007fc0f66c6c7b raise (/lib64/libc.so.6+0x41c7b)
[SYCL] Support for cross-compilation? #5 0x00007fc0f66a7548 abort (/lib64/libc.so.6+0x22548)
[SYCL] The build system doesn't use the OpenCL_LIBRARY passed in everywhere #6 0x00007fc0f66a742f _nl_load_domain.cold (/lib64/libc.so.6+0x2242f)
Reformatted "Get started guide" to simplify the reading. #7 0x00007fc0f66b7fc2 (/lib64/libc.so.6+0x32fc2)
[SYCL] building fails on Fedora/gcc #8 0x0000000000d176d8 (anonymous namespace)::LocalAccessorToSharedMemory::runOnModule(llvm::Module&) LocalAccessorToSharedMemory.cpp:0:0
sycl: fix error building scheduler.cpp #9 0x00000000015289f1 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/joel/sycl_workspace/llvm/build/bin/clang-13+0x15289f1)
[SYCL] linking sycl gives missing __cpu_model #10 0x0000000001f6a5a6 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_deletellvm::raw_pwrite_stream >) (/home/joel/sycl_workspace/llvm/build/bin/clang-13+0x1f6a5a6)
Fix segfault with incompatible OpenCL #11 0x0000000002bcad76 clang::CodeGenAction::ExecuteAction() (/home/joel/sycl_workspace/llvm/build/bin/clang-13+0x2bcad76)
[SYCL] segfault in clCreateProgramWithIL with OpenCL 2.0 #12 0x00000000025ab020 clang::FrontendAction::Execute() (/home/joel/sycl_workspace/llvm/build/bin/clang-13+0x25ab020)
[SYCL] Fix some typos #13 0x000000000251c29a clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/joel/sycl_workspace/llvm/build/bin/clang-13+0x251c29a)
[SYCL][NFC] Fix wrong end-of-line encoding #14 0x0000000002663414 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/joel/sycl_workspace/llvm/build/bin/clang-13+0x2663414)
[SYCL] Cannot compile some standard library functions in SYCL mode #15 0x0000000000a0fb6f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/joel/sycl_workspace/llvm/build/bin/clang-13+0xa0fb6f)
[SYCL][NFC] id.hpp & range.hpp operator tidyup #16 0x0000000000a0d572 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
[SYCL] build spir-v doesn't validate #17 0x0000000000a0d285 main (/home/joel/sycl_workspace/llvm/build/bin/clang-13+0xa0d285)
LLVM pulldown #18 0x00007fc0f66a8e6b __libc_start_main (/lib64/libc.so.6+0x23e6b)
Pull down from intel branch #19 0x0000000000a0a21a _start /tmp/glibc-2.30/csu/../sysdeps/x86_64/start.S:122:0
clang-13: error: unable to execute command: Aborted
clang-13: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 13.0.0 (https://github.com/intel/llvm a323be4)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/joel/sycl_workspace/llvm/build/bin
clang-13: note: diagnostic msg: Error generating preprocessed source(s).
Here is the dump from the inxi -Fxxxz command:
System: Kernel: 5.9.12 x86_64 bits: 64 compiler: gcc v: 2.33.1-slack15) Desktop: Xfce 4.12.5 tk: Gtk 2.24.32
info: xfce4-panel wm: xfwm4 dm: startx Distro: Slackware 14.2
Machine: Type: Laptop System: ASUSTeK product: ROG Zephyrus G15 GA502IV_GA502IV v: 1.0 serial:
Mobo: ASUSTeK model: GA502IV v: 1.0 serial: UEFI: American Megatrends v: GA502IV.205 date: 05/25/2020
CPU: Info: 8-Core model: AMD Ryzen 7 4800HS with Radeon Graphics bits: 64 type: MT MCP arch: Zen rev: 1
Graphics: Device-1: NVIDIA TU106M [GeForce RTX 2060 Max-Q] vendor: ASUSTeK driver: nvidia v: 455.45.01 bus ID: 01:00.0
chip ID: 10de:1f12
Device-2: Advanced Micro Devices [AMD/ATI] Renoir vendor: ASUSTeK driver: amdgpu v: kernel bus ID: 05:00.0
chip ID: 1002:1636
Display: server: X.Org 1.20.9 driver: amdgpu resolution: 1920x1080~240Hz s-dpi: 96
OpenGL: renderer: AMD RENOIR (DRM 3.39.0 5.9.12 LLVM 11.0.0) v: 4.6 Mesa 20.2.1 direct render: Yes
This example compiles and runs correctly using the ONEAPI dpcpp compiler from Intel.