Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*
789 Discussions

Windows OS: application crash if compile with visual studio with library compiled from DPC++

cmlee
Novice
1,784 Views

In Linux,  we can create a library with SYCL kernels compile with DPCPP, then another application compile with gcc c++ and link with the library.

 

However, this approach doesn't work with Visual Studio.  Tested with Microsoft Visual Studio Professional 2022 (64-bit) - LTSC 17.6 along with Intel(R) oneAPI DPC++/C++ Compiler 2023.2.0 (2023.2.0.20230627).

 

The application is compiled with Visual Studio 2022 (143) platform toolset and static library contains SYCL kernels are compile with Intel DPC++ 2023 toolset. 

The compilation has no issue.   However, application will exit/crash after call sycl kernel.

Try to compile application with Intel C++ compiler 2023 without /fsycl and will have the same issue above.  

 

If the application compile with Intel C++ compiler with /fsycl, there is no issue to run.

 

Attached is the sample application to show the issue. 

 

 

 

 

 

 

0 Kudos
1 Solution
cmlee
Novice
1,601 Views

The issue is now resolved.   In order to use different compilers, the module or library contains SYCL kernel need to compile as DLL or dynamic library.  I will switch to build the module as DLL. 

View solution in original post

0 Kudos
4 Replies
SeshaP_Intel
Moderator
1,710 Views

Hi,


Thank you for posting in Intel Communities.


Yes, you are correct. We need to add the /fsycl flag in the additional options, or we need to use the Intel(R) oneAPI DPC++ Compiler 2023 as the Platform Toolset. Without the usage of /fsycl, it may lead to an exit or crash of the DPC++ application. 

You can compile any host code with other compilers, but for compiling device code, linking the library, and creating the final executable for a DPC++ program Intel oneAPI C++/DPC++ compiler ('icx /fsycl' or 'dpcpp') must be used.


Thanks and Regards,

Pendyala Sesha Srinivas


0 Kudos
cmlee
Novice
1,602 Views

The issue is now resolved.   In order to use different compilers, the module or library contains SYCL kernel need to compile as DLL or dynamic library.  I will switch to build the module as DLL. 

0 Kudos
cmlee
Novice
1,699 Views

Thanks for your reply.   The application is fairly big and depend on Visual studio compiler.    Converting the host code to compile with Intel compiler is not possible as the application need to both compile for Intel x86 and ARM64.  

As a result, we need to compile a specific module with Intel compiler only.   However, as you point out, this is not possible, which is quite disappointed.

This mechanism tested working in Linux and why this is not support from Windows OS?

 

Is it possible to use icx to link the static library (compile with DPC++) with obj compile from visual studio, to enable it to run correctly?

 

 

 

 

0 Kudos
SeshaP_Intel
Moderator
1,582 Views

Hi,


Glad to know that your issue is resolved. Thanks for sharing the solution with us. 

If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.


Thanks and Regards,

Pendyala Sesha Srinivas


0 Kudos
Reply