Skip to main content

Command Palette

Search for a command to run...

dpcpp, icpx, icx, icx-cl

How I learned to love the (many) SYCL compilers

Published
2 min read

Ha! Just kidding. What the hell is going on? Why are there so many? So, if you use dpcpp it will tell you its deprecated and to use icpx. Fine, I'll switch to it.

BUT! icpx on Windows expects Visual Studio style flags. But, if you don't use the oneAPI toolkit on Windows, then Visual Studio will default to using it's internal cl.exe compiler. And you get errors like this when you run cmake --build . --config RelWithDebInfo

Microsoft (R) Build Engine version 17.1.0+ae57d105c for .NET Framework Copyright (C) Microsoft Corporation. All rights reserved.
1>Checking Build System 
Building Custom Rule C:/Users/mark/Projects/whatever/CMakeLists.txt whatever.cpp 
whatever.cpp
C:\Users\mark\Projects\whatever.cpp(12,10 ): fatal error C1083: Cannot open include file: 'sycl/sycl.hpp': No such file or directory [C:\Users\mark\Projectswhatever\wbuild\whatever.vcxproj] 
whatever2.cpp
...
...
...

Since I don't want to bother figuring out magic incantations of CMake to force Visual Studio to use dpcpp or icpx (since I already put set(CMAKE_CXX_COMPILER dpcpp) and that should have been enough) I figured I'd switch to ninja .

Except using ninja on Windows means cmake assumes the compiler is cl.exe and takes Visual Studio/Windows style flags. CMake wants to ensure that you have a productive and fruitful experience, so it will try to validate the compiler with a simple test, which icpx will fail.

Run Build Command(s):C:/Users/mark/AppData/Local/Android/Sdk/cmake/3.22.1/bin/ninja.exe cmTC_da707 && [1/2] Building CXX object CMakeFiles\cmTC_da707.dir\testCXXCompiler.cxx.obj
    FAILED: CMakeFiles/cmTC_da707.dir/testCXXCompiler.cxx.obj
    C:\PROGRA~2\Intel\oneAPI\compiler\2024.0\bin\icpx.exe  /nologo /TP   /DWIN32 /D_WINDOWS /EHsc  /Zi /Ob0 /Od /RTC1 -MDd -QMMD -QMT CMakeFiles\cmTC_da707.dir\testCXXCompiler.cxx.obj -QMF CMakeFiles\cmTC_da707.dir\testCXXCompiler.cxx.obj.d /FoCMakeFiles\cmTC_da707.dir\testCXXCompiler.cxx.obj /FdCMakeFiles\cmTC_da707.dir\ -c C:\Users\mark\Projects\gaussian-rasterization\results\diff_gaussian_rasterization\wbuild\CMakeFiles\CMakeTmp\testCXXCompiler.cxx
    icpx: error: unknown argument: '-nologo'
    icpx: error: unknown argument: '-EHsc'
    icpx: error: unknown argument: '-Zi'
    icpx: error: unknown argument: '-MDd'
    icpx: error: unknown argument: '-QMMD'
    icpx: error: unknown argument: '-QMT'
    icpx: error: unknown argument: '-QMF'
    icpx: error: no such file or directory: 'CMakeFiles\cmTC_da707.dir\testCXXCompiler.cxx.obj'
    icpx: error: no such file or directory: 'CMakeFiles\cmTC_da707.dir\testCXXCompiler.cxx.obj.d'
    icpx: error: no input files
    ninja: build stopped: subcommand failed.

So, I found this documentation that mentions that icx-cl is the takes Visual Studio/Windows style flags.

More from this blog

It needs to be written down

59 posts