Skip to content

Better diagnostic: suggest using -fsycl flag when sycl/sycl.hpp is included #12052

Open
@al42and

Description

@al42and

Is your feature request related to a problem? Please describe

Trying to compile a simple SYCL application produces the following warning when -fsycl flag is omitted:

$ clang++ vector_add.cpp 
vector_add.cpp:2:10: fatal error: 'sycl/sycl.hpp' file not found
    2 | #include <sycl/sycl.hpp>
      |          ^~~~~~~~~~~~~~~
1 error generated.

The natural reaction to a missing header is adding -I/-isystem flag, which is not the correct action here.

Describe the solution you would like

A more helpful warning along the lines of:

$ clang++ vector_add.cpp 
vector_add.cpp:2:10: fatal error: 'sycl/sycl.hpp' file not found; use -fsycl flag when compiling SYCL sources

Describe alternatives you have considered

  • Leave things as they are; that's user error, they should pay more attention.
  • Emit a warning whenever sycl/sycl.hpp is included and -fsycl is not used, even if the file itself is found (e.g., because -I/opt/intel/oneapi/2024.0/include/ was set).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions