You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With a typical CMake project, we use target_link_libraries(${PROJECT_NAME} PRIVATE oneDPL) to properly link the oneDPL. However, it adds -fsycl to the compiler flags for all source files in ${PROJECT_NAME}. This is problematic, since not all files might need to be compiled with SYCL support, and might contain unsupported features.
With the project above, we are getting warning about an attribute incompatible with SPIR-V targets, even though main.cpp has nothing to do with device code:
$ rm -rf build/ && cmake -DCMAKE_CXX_COMPILER=icpx -S. -Bbuild/ -DoneDPL_DIR=/opt/intel/oneapi/dpl/latest/lib/cmake/oneDPL/ && cmake --build build/[...][ 33%] Building CXX object CMakeFiles/MyOneDPLProject.dir/main.cpp.o/home/aland/sycl_tests/onedpl_cmake/main.cpp:3:1: warning: '__vectorcall' calling convention is not supported for this target [-Wignored-attributes] 3 | __vectorcall inline void do_simd() { | ^1 warning generated.
Possible workaround
Client code can manually remove the flag from oneDPL interface and add it manually to the desired targets:
Or do the opposite and manually remove the flag from some of the files. This approach, though, is quite ugly and fragile.
Another option is to move all oneDPL-related files to a separate OBJECT target, but this will require significant changes to the application's build system.
Proposed solution
While the current behavior is reasonable for most cases, sometimes application developers might want to have better control over compilation options and want to only compile certain files with SYCL enabled, given the extra limitations. It would be convenient to have a way to control whether -fsycl flag is added to oneDPL's INTERFACE, given how much this flag affects the overall compiler behavior (compared to, e.g., just another build directory).
The text was updated successfully, but these errors were encountered:
With a typical CMake project, we use
target_link_libraries(${PROJECT_NAME} PRIVATE oneDPL)
to properly link the oneDPL. However, it adds-fsycl
to the compiler flags for all source files in ${PROJECT_NAME}. This is problematic, since not all files might need to be compiled with SYCL support, and might contain unsupported features.Example project
With the project above, we are getting warning about an attribute incompatible with SPIR-V targets, even though
main.cpp
has nothing to do with device code:Possible workaround
Client code can manually remove the flag from oneDPL interface and add it manually to the desired targets:
Or do the opposite and manually remove the flag from some of the files. This approach, though, is quite ugly and fragile.
Another option is to move all oneDPL-related files to a separate OBJECT target, but this will require significant changes to the application's build system.
Proposed solution
While the current behavior is reasonable for most cases, sometimes application developers might want to have better control over compilation options and want to only compile certain files with SYCL enabled, given the extra limitations. It would be convenient to have a way to control whether
-fsycl
flag is added to oneDPL's INTERFACE, given how much this flag affects the overall compiler behavior (compared to, e.g., just another build directory).The text was updated successfully, but these errors were encountered: