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*
733 Discussions

Compiler optimization - O2 leads problems on the execution on CPU

PC-1
Beginner
456 Views

My working on projects are developed on Visual Studio 2022 laster version (17.10.4) and Intel DPC++ 2024.2. Recently I found that the debug build can run successfully on both CPU and GPU, however, the release build with -O2 optimization can ONLY run on GPU and is problematic on CPU.

 

When runing on CPU, it seems that the program got stuck on the first queue parallel_for and the memory usage increases drastically without bound. I'm new to DPC++ programming. I'm just wondering if there is any hint that could help me fix this issue?

 

I tried to comment out the part of codes developed recently, and found that there is a line of code, by commenting it out the release build can run on CPU (but to have a correct result that line of code is needed). In fact, as long as that code appears, not even really executed ( I even tried to comment out the function calling that code), the release build fails on CPU. I guess it is related to reorders during -O2 optimization. Again I'm new to DPC++ programming and not very familiar with -O2 optimization processes. 

 

BTW, the release build without -O2 is good. However, I really need to use -O2 optimization to improve the performance of the code. 

 

My project contains 10k+lines of code with multiple parallel_for s, so it's not realistic to post it here. 

 

Thanks so much!

PC

 

 

0 Kudos
1 Reply
Alex_Y_Intel
Moderator
377 Views

Currently, 17.9.2 is the latest version supported for VS 2022

0 Kudos
Reply