Follow symbol does not recognize SYCL functions and keywords in Qt creator

60 views Asked by At

I am using Qt creator 4.4.0 to develop a SYCL application. I am not able to follow the SYCL functions into the headers to check for their definitions in Qt like I can do with other standard headers which as vectors, set. Can someone please tell me what I am missing in the Qt project setup.

Here is the cmake for this simple project.

# CMakeLists for SYCL C++ Project

cmake_minimum_required(VERSION 3.19)

set(CMAKE_CXX_COMPILER "icpx")
set(CMAKE_PREFIX_PATH "/opt/intel/oneapi/compiler/latest/linux/IntelSYCL/")
set(SYCL_LIBRARY_DIR "/opt/intel/oneapi/compiler/latest/linux/lib")
set(SYCL_INCLUDE_DIR "/opt/intel/oneapi/compiler/latest/linux/include/sycl/")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsycl -fsycl-targets=nvptx64-nvidia-cuda,spir64 -Xsycl-target-backend=nvptx64-nvidia-cuda --cuda-gpu-arch=sm_75")

project(matrix_multiply_sycl LANGUAGES CXX)

add_executable(matrix_multiply_sycl matrix_multiply_sycl.cpp)

I am able to compile and run using this cmake lists file.

I have tried adding the SYCL lib include dir in the cmake and that still does not work. But Qt can auto recognize other std headers somehow.

1

There are 1 answers

0
Rafal On

I'm not familiar with QtCreator, but I assume that the language server called underneath is clangd. Parsing DPC++ SYCL headers has only recently become possible with the DPC++ version of clangd as previous versions suffered from this issue: https://github.com/clangd/clangd/issues/1097

The fix for this issue has not made it into any Intel oneAPI toolkit releases yet and it will take a few months until it does. If you don't want to wait, you could try building open-source DPC++ and use its clang++ compiler driver (instead of icpx which is only available in the full Intel releases). Unfortunately the open-source binary releases don't include clangd so you'd need to build from source including clang-tools-extra.

Regardless of whether you use the open-source DPC++ or wait for an updated oneAPI toolkit release, you'd also need to make sure that QtCreator environment is set correctly such that it's using the DPC++ version of clangd and not any other version that might be available in your system. Using the upstream LLVM clangd unfortunately won't work in the near future, as the SYCL support is specific to DPC++.