intel / intel/llvm

SYCL include path problem

Open
#5,932 10 comments 0 reactions 1 assignee Claimed by @mdtoguchi View on GitHub
confirmed enhancement
Dominant language
LLVM
Stars
1.5k
Forks
854
Avg merge
3d 17h
Merged PRs (30d)
137

Description

**Describe the bug**

reproducer test_include.cpp
```
#include
int main()
{ }
```
My intention is to call SYCL runtime library.
For this minimal SYCL code, I expect the needed include path is /opt/intel/oneapi/compiler/2022.0.2/linux/include/sycl.
```
$ icpx --std=c++17 -I/opt/intel/oneapi/compiler/2022.0.2/linux/include/sycl test_include.cpp
In file included from test_include.cpp:1:
In file included from /opt/intel/oneapi/compiler/2022.0.2/linux/include/sycl/CL/sycl.hpp:11:
In file included from /opt/intel/oneapi/compiler/2022.0.2/linux/include/sycl/CL/sycl/accessor.hpp:13:
/opt/intel/oneapi/compiler/2022.0.2/linux/include/sycl/CL/sycl/buffer.hpp:17:10: fatal error: 'sycl/ext/oneapi/accessor_property_list.hpp' file not found
#include
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
```
For sure adding another include path does work
```
icpx -I/opt/intel/oneapi/compiler/2022.0.2/linux/include/sycl -I /opt/intel/oneapi/compiler/2022.0.2/linux/include test_include.cpp
```
but why adding this burden to users?

I know -fsycl can hide the include problem but sycl should be allowed to use as a normal host library without relying on -fsycl.
It currently does work without -fsycl, however the include paths are messy.

The issue shows up similarly with GCC.
```
g++ --std=c++17 -I/opt/intel/oneapi/compiler/2022.0.2/linux/include/sycl -I /opt/intel/oneapi/compiler/2022.0.2/linux/include test_include.cpp -lsycl
```
after adding two include, g++ compiles the reproducer.

So it is not a compiler issue but a SYCL library issue

How about removing all the first sycl from all the include line for sycl extension and allow user to specify one include path only?
https://github.com/intel/llvm/blob/0b456ce4f31cfcec8e2fcb33ab43fb85ade706a5/sycl/include/CL/sycl/buffer.hpp#L17

**To Reproduce**
Please describe the steps to reproduce the behavior:

See above

**Environment (please complete the following information):**

- OS: LInux
- Target device and vendor: running on host
- DPC++ version: Intel(R) oneAPI DPC++/C++ Compiler 2022.0.0 (2022.0.0.20211123)
- Dependencies version: compilation issue

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.