triSYCL / sycl

SYCL for Vitis: Experimental fusion of triSYCL with Intel SYCL oneAPI DPC++ up-streaming effort into Clang/LLVM
Other
107 stars 19 forks source link

[SYCL][OpenCL] Select Intel or AMD/Xilinx FPGA #210

Closed Ralender closed 1 year ago

keryell commented 1 year ago

This should fix https://github.com/triSYCL/sycl/issues/208

keryell commented 1 year ago
rkeryell@xsjsycl41:/var/tmp/rkeryell/SYCL/code$ $SYCL_HOME/llvm/build/bin/clang++ -std=c++2b -fsycl -fsycl-targets=spir64_x86_64,nvptx64-nvidia-cuda,amdgcn-amd-amdhsa,spir64_fpga,fpga64_hls_hw_emu -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfx906 simple-sycl-app.cpp -o simple-sycl-app
clang-16: warning: CUDA version 11.8 is only partially supported [-Wunknown-cuda-version]
simple-sycl-app.cpp:19:25: error: definition with same mangled name '_ZTSZZ4mainENKUlRN4sycl3_V17handlerEE_clES2_E10FillBuffer' as another definition
        NumOfWorkItems, [=](sycl::id<1> WIid) {
                        ^
/var/tmp/rkeryell/SYCL/llvm/build/bin/../include/sycl/handler.hpp:1103:11: note: previous definition is here
          [=, Func = detail::assume_device_copyable_wrapper<
          ^
1 error generated.
keryell commented 1 year ago

Another variant with this environment https://github.com/triSYCL/sycl/blob/sycl/unified/next/sycl/doc/GettingStartedXilinxFPGA.md#compiling-and-running-a-sycl-application

$SYCL_HOME/llvm/build/bin/clang++ -std=c++2b -fsycl -fsycl-targets=spir64_x86_64,nvptx64-nvidia-cuda,amdgcn-amd-amdhsa,spir64_fpga,fpga64_hls_hw_emu -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfx906 -Xsycl-target-backend=nvptx64-nvidia-cuda --offload-arch=sm_61 FPGA_GPU_CPU.cpp -o FPGA_GPU_CPU
rkeryell@xsjsycl41:/var/tmp/rkeryell/SYCL/code$ ./FPGA_GPU_CPU 
Segmentation fault

In gdb it crashes in

0x00007ffff33c2d5a in xrt_core::device::query<xrt_core::query::rom_vbnv> (this=0x1ee0080) at /storage/gauthier/XRT2/src/runtime_src/core/common/device.h:212
warning: Source file is more recent than executable.
212       xrt::xclbin

Did you change XRT?

Ralender commented 1 year ago
rkeryell@xsjsycl41:/var/tmp/rkeryell/SYCL/code$ $SYCL_HOME/llvm/build/bin/clang++ -std=c++2b -fsycl -fsycl-targets=spir64_x86_64,nvptx64-nvidia-cuda,amdgcn-amd-amdhsa,spir64_fpga,fpga64_hls_hw_emu -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfx906 simple-sycl-app.cpp -o simple-sycl-app
clang-16: warning: CUDA version 11.8 is only partially supported [-Wunknown-cuda-version]
simple-sycl-app.cpp:19:25: error: definition with same mangled name '_ZTSZZ4mainENKUlRN4sycl3_V17handlerEE_clES2_E10FillBuffer' as another definition
        NumOfWorkItems, [=](sycl::id<1> WIid) {
                        ^
/var/tmp/rkeryell/SYCL/llvm/build/bin/../include/sycl/handler.hpp:1103:11: note: previous definition is here
          [=, Func = detail::assume_device_copyable_wrapper<
          ^
1 error generated.

This issue should be fixed by the most recent push

keryell commented 1 year ago

fpga64_hls_hw_emu in first position does not work:

$SYCL_HOME/llvm/build/bin/clang++ -std=c++2b -fsycl -fsycl-targets=fpga64_hls_hw_emu,spir64_x86_64,nvptx64-nvidia-cuda,amdgcn-amd-amdhsa,spir64_fpga -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfx906 simple-sycl-app.cpp -o simple-sycl-app
rkeryell@xsjsycl41:/var/tmp/rkeryell/SYCL/code$ ONEAPI_DEVICE_SELECTOR=xrt:0 SYCL_PI_TRACE=1 /var/tmp/rkeryell/SYCL/code/simple-sycl-app
simple-sycl-app: /var/tmp/rkeryell/SYCL/llvm/sycl/source/detail/program_manager/program_manager.cpp:1297: void sycl::_V1::detail::ProgramManager::addImages(pi_device_binaries): Assertion `KSIdMap[EntriesIt->name] == KSIdIt->second && "Kernel sets are not disjoint"' failed.
Aborted
rkeryell@xsjsycl41:/var/tmp/rkeryell/SYCL/code$ ONEAPI_DEVICE_SELECTOR=cuda:0 SYCL_PI_TRACE=1 /var/tmp/rkeryell/SYCL/code/simple-sycl-app
simple-sycl-app: /var/tmp/rkeryell/SYCL/llvm/sycl/source/detail/program_manager/program_manager.cpp:1297: void sycl::_V1::detail::ProgramManager::addImages(pi_device_binaries): Assertion `KSIdMap[EntriesIt->name] == KSIdIt->second && "Kernel sets are not disjoint"' failed.
Aborted

fpga64_hls_hw_emu in position before the end works:

rkeryell@xsjsycl41:/var/tmp/rkeryell/SYCL/code$ $SYCL_HOME/llvm/build/bin/clang++ -std=c++2b -fsycl -fsycl-
targets=spir64_x86_64,nvptx64-nvidia-cuda,amdgcn-amd-amdhsa,fpga64_hls_hw_emu,spir64_fpga -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfx906 simple-sycl-app.cpp -o simple-sycl-app
keryell commented 1 year ago
rkeryell@xsjsycl41:/var/tmp/rkeryell/SYCL/code$ $SYCL_HOME/llvm/build/bin/clang++ -std=c++2b -fsycl -fsycl-targets=spir64_x86_64,nvptx64-nvidia-cuda,amdgcn-amd-amdhsa,fpga64_hls_hw_emu,spir64_fpga -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfx906 -Xsycl-target-backend=nvptx64-nvidia-cuda --offload-arch=sm_61 FPGA_GPU_CPU.cpp -o FPGA_GPU_CPU
rkeryell@xsjsycl41:/var/tmp/rkeryell/SYCL/code$ SYCL_PI_TRACE=1 ./FPGA_GPU_CPU 
SYCL_PI_TRACE[basic]: Plugin found and successfully loaded: libpi_opencl.so [ PluginVersion: 11.15.1 ]
SYCL_PI_TRACE[basic]: Plugin found and successfully loaded: libpi_level_zero.so [ PluginVersion: 11.15.1 ]
SYCL_PI_TRACE[basic]: Plugin found and successfully loaded: libpi_cuda.so [ PluginVersion: 11.15.1 ]
SYCL_PI_TRACE[basic]: Plugin found and successfully loaded: libpi_hip.so [ PluginVersion: 11.15.1 ]
SYCL_PI_TRACE[basic]: Plugin found and successfully loaded: libpi_xrt.so [ PluginVersion: 11.15 ]
Segmentation fault