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*

Swizzle code cannot be compiled on Windows

AJIOB
Novice
3,698 Views

I'm using Intel oneAPI BaseKit 2022.1.2 (w_BaseKit_p_2022.1.2.154_offline.exe), VisualStudio 2022 17.0.6 LTS, CMake 3.22.2, Ninja 1.10.2, VSCode 1.64.2, Windows 10 Pro 21H1 x64 English.

 

OneAPI & VisualStudio was fully reinstalled today.

 

I'm using a basic example for vectors swizzling.

 

Build log from clear CMD with manually called setvars.bat file was attached.

 

I cannot build a provided example in debug mode (but release mode works nice).

 

The project for reproducing an error was attached too.

 

The error can be reproduced by CMake (see the attached project) & VisualStudio UI (tested in another project). Code building was made with a DPC++ compiler.

 

How can I debug my project with an enabled swizzle macro?

 

With regards,
Alex

Labels (1)
0 Kudos
5 Replies
VidyalathaB_Intel
Moderator
3,662 Views

Hi,

 

Thanks for reaching out to us.

 

We are unable to reproduce the exact errors you are getting but we are also getting some other issues while trying to run the sample code from vectors swizzling.

 

>>I cannot build a provided example in debug mode 

But here are some changes we made with which we are able to make it compile and generate the executable successfully in both release and debug modes.

 

Could you please try commenting out the last two lines under the if(WIN32) code block in CMakeLists.txt as below?

if(WIN32)
#set(CMAKE_C_COMPILER clang-cl)
#set(CMAKE_CXX_COMPILER dpcpp)
set(CMAKE_C_COMPILER icx)
set(CMAKE_CXX_COMPILER dpcpp)
#set(CMAKE_CXX_CREATE_STATIC_LIBRARY "lib <OBJECTS> /out:<TARGET>")
#set(CMAKE_CXX_LINK_EXECUTABLE "lld-link <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")

After applying these changes please follow the below steps

> mkdir build

> cd build

> cmake -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icx -DCMAKE_BUILD_TYPE=Debug -GNinja ..

> ninja install

 

You can test the generated executables which are present under ../swizzle_bug/Ch11_vectors/install/Debug/*.exe

Please find the below screenshot which contains the steps that we followed to run the code and do let us know if you face any issues.

VidyalathaB_Intel_0-1646308578199.png

Regards,

Vidya.

 

0 Kudos
AJIOB
Novice
3,620 Views

Hello Vidya

 

I made build steps as you said. My error repeats. Log & changed CMakeLists.txt were attached.

 

The main difference of our logs is used compilers: I'm using IntelLLVM (aka DPC++?) & you are using IntelClang (aka Intel Compiler Classic?).

 

I installed only DPC++ compiler, no any other (for saving space).

 

Please, force use DPC++ compiler, that was provided with oneAPI BaseKit 2022.1.2 with required VisualStudio version.

 

I reproduced that bug with Windows SDK 10.0.20348, 10.0.19041, 10.0.16299 (all installed versions).

 

With regards,
Alex

0 Kudos
VidyalathaB_Intel
Moderator
3,576 Views

Hi,


>>The main difference of our logs is used compilers: I'm using IntelLLVM (aka DPC++?) & you are using IntelClang (aka Intel Compiler Classic?).

Thanks for pointing it out.

>>with required VisualStudio version.

We tried the sample in Intel oneAPI command prompt for Intel 64 for VS 2022 and the issue is reproducible from our end as well.

We have forwarded this case to the concerned development team and will keep updating this thread.


Regards,

Vidya.


0 Kudos
VidyalathaB_Intel
Moderator
3,284 Views

Hi Alex,

 

Thanks for your patience.

 

>>I cannot build a provided example in debug mode (but release mode works nice).

Regarding the issue with code compilation failing in debug mode, here are a few things that we want to let you know

 

"Compilation may fail on Windows in debug mode if a kernel uses std::array. This happens because debug version of std::array in Microsoft STL C++ headers calls functions that are illegal for the device code. As a workaround the following can be done:

> Dump compiler pipeline execution strings by passing -### option to the compiler. The compiler will print the internal execution strings of compilation tools. The actual compilation will not happen.

> Modify the (usually) first execution string (it should have -fsycl-is-device option) by adding -D_CONTAINER_DEBUG_LEVEL=0 -D_ITERATOR_DEBUG_LEVEL=0 options to the end of the string. Execute all string one by one."

 

Reference links:

https://github.com/intel/llvm/blob/sycl/sycl/ReleaseNotes.md

https://www.intel.com/content/www/us/en/developer/articles/release-notes/intel-oneapi-dpc-c-compiler-release-notes.html

 

So we suggest you follow the workaround that is mentioned in the release notes

 

Eg:

icx /O2 -fsycl -D_CONTAINER_DEBUG_LEVEL=0 -D_ITERATOR_DEBUG_LEVEL=0 /MD fig_11_6_load_store.cpp

Intel(R) oneAPI DPC++/C++ Compiler for applications running on Intel(R) 64, Version 2022.1.0 Build 20220316

Copyright (C) 1985-2022 Intel Corporation. All rights reserved.

 

Ch11_vectors>fig_11_6_load_store.exe

Passed.

 

Please give it a try and do let us know if have any issues.

 

Regards,

Vidya.

 

0 Kudos
VidyalathaB_Intel
Moderator
3,247 Views

Hi Alex,


As we haven't heard back from you we assume that your issue is resolved and closing this thread. Please post a new question if you need any additional assistance from Intel as this thread will longer be monitored.


Regards,

Vidya.


0 Kudos
Reply