- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there!
I have laptop with integrated Intel(R) UHD Graphics 770 and dedicated NVIDIA RTX A3000 12GB.
It is running Windows 11 with Visual Studio Pro 2022 and CUDA v12.3.
One top I've installed oneAPI HPC toolkit 2025 and plugin from Codeplay (oneapi-for-nvidia-gpus-2025.0.0-cuda-12.0-windows.msi). Integration went well. New template projects appeared within MSVS2022 environment.
Then I have a test command-line project within MSVS2022 using sycl in order to multiplying two matrices (attached).
For Intel card whole test working no problem with default settings in Release configuration, I can executed and receive expected results.
Then I've clone the configuration into new one ReleaseNVIDIA, and selected NVIDIA device programmatically, so to create a Queue.
Build went ok, yet sycl code was not executed, giving me "SYCL ERROR: Native API failed. Native API returns: 7 (UR_RESULT_ERROR_INVALID_BINARY)"
I've realized it was not generated for the target platform, so I've put in dpcpp command line options
-fsycl -fno-bundle-offload-arch -fsycl-targets=nvptx64-nvidia-cuda
and it was accepted but still getting warning during the build
1>icx-cl: : warning : linked binaries do not contain expected 'spir64-unknown-unknown' target; found targets: 'nvptx64-nvidia-cuda' [-Wsycl-target]
and error
"SYCL ERROR: No kernel named _ZTS15mmult_naive_bufIfE was found" during run-time
What other settings I have to specify for DPC++ and Linker within VisualStudio 2022 to target NVIDIA card?
Many thanks!
Best regards
Yuli
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm getting the same error with Visual Studio 2022, CUDA 12.6 and oneAPI compiler 2025.0.
The linker always expects the spir64-unkown-unknown target, regardless of the compiler's -fsycl-targets parameters.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I got it running now for Visual Studio 2022 + CUDA with and without CMake.
What is actually the problem?
The documentation of the Codeplay plugin shows which flags are passed in which way to icx-cl. However, in their case, compiling and linking is executed in the same call.
For Visual Studio, however, compiling and linking are executed separately and both these steps require the fsycl-targets (and possibly Xsycl-target-backend arguments) parameters.
For the compile step, they can just be added as additional options:
- In Visual Studio: DPC++/All Options/Additional Options
- In CMake: Use target_compile_options
However, providing the flags to the linking step is not as trivial.
In theory, the Intel oneAPI provides a Visual Studio integration, which makes it possible to set certain properties for the linker, such as the fsycl-targets.
The plugin for NIVIDA GPUs, however, does not seem to use/extend this integration. This means that the corresponding flag values (such as nvptx64-nvidia-cuda) are not available for these properties.
If the flags are provided as additional linker options, Visual Studio/MSBuild appear to append them too late in the command, leading to them being ignored. This is the reason, why the linker assumes the default target, which is spir64-unknown-unknown.
What is the solution?
There are multiple possible solutions, all building on the unexposed property (i.e., not accessible from within the Visual Studio IDE) DPCPPLinkOptions, specified in Toolset.props of the custom toolset specification that is part of the VS integration of oneAPI. For me, this file is located at:
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Platforms\x64\PlatformToolsets\Intel(R) oneAPI DPC++ Compiler 2025\Toolset.props
The options specified within the DPCPPLinkOptions are inserted at the correct position in the linker call.
The question is now, how to set this property to a specific value.
1. Hardcode the flags into the toolset properties (Visual Studio or CMake)
You could just hardcode the flags into the Toolset.props file by changing
<DPCPPLinkOptions></DPCPPLinkOptions>
to
<DPCPPLinkOptions>-fsycl-targets=nvptx64-nvidia-cuda</DPCPPLinkOptions>
This is quite error-prone and not very flexible, so I would advise against this solution.
2. Import custom toolset properties (Visual Studio only)
Create a file sycl_target_flags.props with the following contents:
<Project>
<PropertyGroup>
<DPCPPLinkOptions>-fsycl-targets=nvptx64-nvidia-cuda</DPCPPLinkOptions>
</PropertyGroup>
</Project>
Open the vcxproj file with a text editor and search for an ImportGroup with the label "PropertySheets". Add the following line within the import group:
<Import Project="your/path/to/sycl_target_flags.props"/>
In the case that the import group does not exist, just create one.
3. Provide the property as argument to MSBuild (CMake only)
If you use CMake with MSBuild as generator and compile via command line, you can just provide an additional argument to the build command:
cmake --build . --config release -- /p:DPCPPLinkOptions="-fsycl-targets=nvptx64-nvidia-cuda"
The problem with this approach is that while it works when compiling via command line, compilation within the generated Visual Studio Solution will not work (unless the project file is adjusted as well).
4. Automatically configure the project using the CMakeLists.txt (CMake only obviously)
If you want CMake to only generate the Visual Studio project, but then compile from within Visual Studio, you can also let CMake configure the project. For this, add the following lines to the CMakeLists.txt:
set_property(TARGET ${CMAKE_PROJECT_NAME} APPEND PROPERTY VS_USER_PROPS "your/path/to/sycl_target_flags.props")
This also requires the sycl_target_flags.props to be created beforehand. Alternatively, you could also create the file on-the-fly using CMake's file(GENERATE ...), which would then allow dynamic configuration of the flags via CMake variables.
I hope my suggestions are helpful to some out there who are also struggling with this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The first time I posted this it was marked as spam, so I hope it gets through this time ^^
I got it running now for Visual Studio 2022 + CUDA with and without CMake.
What is actually the problem?
The documentation of the Codeplay plugin shows which flags are passed in which way to icx-cl. However, in their case, compiling and linking is executed in the same call.
For Visual Studio, however, compiling and linking are executed separately and both these steps require the fsycl-targets (and possibly Xsycl-target-backend arguments) parameters.
For the compile step, they can just be added as additional options:
- In Visual Studio: DPC++/All Options/Additional Options
- In CMake: Use target_compile_options
However, providing the flags to the linking step is not as trivial.
In theory, the Intel oneAPI provides a Visual Studio integration, which makes it possible to set certain properties for the linker, such as the fsycl-targets.
The plugin for NIVIDA GPUs, however, does not seem to use/extend this integration. This means that the corresponding flag values (such as nvptx64-nvidia-cuda) are not available for these properties.
If the flags are provided as additional linker options, Visual Studio/MSBuild appear to append them too late in the command, leading to them being ignored. This is the reason, why the linker assumes the default target, which is spir64-unknown-unknown.
What is the solution?
There are multiple possible solutions, all building on the unexposed property (i.e., not accessible from within the Visual Studio IDE) DPCPPLinkOptions, specified in Toolset.props of the custom toolset specification that is part of the VS integration of oneAPI. For me, this file is located at:
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Platforms\x64\PlatformToolsets\Intel(R) oneAPI DPC++ Compiler 2025\Toolset.props
The options specified within the DPCPPLinkOptions are inserted at the correct position in the linker call.
The question is now, how to set this property to a specific value.
1. Hardcode the flags into the toolset properties (Visual Studio or CMake)
You could just hardcode the flags into the Toolset.props file by changing
<DPCPPLinkOptions></DPCPPLinkOptions>
to
<DPCPPLinkOptions>-fsycl-targets=nvptx64-nvidia-cuda</DPCPPLinkOptions>
This is quite error-prone and not very flexible, so I would advise against this solution.
2. Import custom toolset properties (Visual Studio only)
Create a file sycl_target_flags.props with the following contents:
<Project>
<PropertyGroup>
<DPCPPLinkOptions>-fsycl-targets=nvptx64-nvidia-cuda</DPCPPLinkOptions>
</PropertyGroup>
</Project>
Then open the .vcxproj file with a text editor and search for an ImportGroup with the label "PropertySheets". Add the following line within the import group:
<Import Project="your/path/to/sycl_target_flags.props"/>
In the case that the import group does not exist, just create one.
3. Provide the property as argument to MSBuild (CMake only)
If you use CMake with MSBuild as generator and compile via command line, you can just provide an additional argument to the build command:
cmake --build . --config release -- /p:DPCPPLinkOptions="-fsycl-targets=nvptx64-nvidia-cuda"
The problem with this approach is that while it works when compiling via command line, compilation within the generated Visual Studio Solution will not work (unless the project file is adjusted as well).
4. Automatically configure the project using the CMakeLists.txt (CMake only obviously)
If you want CMake to only generate the Visual Studio project, but then compile from within Visual Studio, you can also let CMake configure the project. For this, add the following lines to the CMakeLists.txt:
set_target_properties(YOUR-TARGET PROPERTIES VS_USER_PROPS "your/path/to/sycl_target_flags.props")
This also requires the sycl_target_flags.props to be created beforehand. Alternatively, you could also create the file on-the-fly using CMake's file(GENERATE ...), which would then allow dynamic configuration of the flags via CMake variables.
If you plan to change the SYCL target flags frequently, it can make sense to define them in only one place, instead of defining the compiler flags as additional options and the linker flags via one of the described approaches.
For this, you could use the DPCPPOptions property for passing the flags to the compiler. It works exactly the same way as with the linker flags.
I hope my suggestions are helpful to some out there who are also struggling with this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A small addition to my suggestions:
IntelliSense might fail to properly parse the code, i.e., tooltips/syntax highlighting might be broken for source files that include SYCL code, maybe due to IntelliSense still using the MSVC toolset.
To fix that, you can set the ToolsetISenseIdentifier property to Clang.Windows.
You might also need to set the C++ standard to use via a clang-specific flag.
I use these two additional lines in the CMakeLists.txt:
set_target_properties(YOUR-TARGET PROPERTIES VS_GLOBAL_ToolsetISenseIdentifier "Clang.Windows")
target_compile_options(YOUR-TARGET PRIVATE -Clangstdc++20) # for the case of C++20
The clang-specific flag gets discarded during compilation.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page