New Compiler Bug was introduced for MIC offload

New Compiler Bug was introduced for MIC offload

When using the latest Intel C++ compiler 14.0 SP1 Update 1, i noticed that a new bug was introduced for MIC offload code.

When compiling code that is just intended for MIC and that does not work on the host (e.g. code that uses MIC intrinsics), one can mark that code as

#ifdef __MIC__

.... C++ intrinsics code

#endif

However, when doing this in a .cpp file so that the host code contains nothing, also the MIC code is not generated.

A hack to avoid this issue is to add C++ code that does nothing of purpose, but at least something at all. So a workaround would be e.g.

#ifdef __MIC__

.... C++ intrinsics code

#else

static int i = 0;

#endif

I assume that this is a new bug that was introduced - or was there any special purpose for enforcing nonempty host code in a .cpp file?

 

4 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

Thank you for reporting this. I'm not aware of any intended change in the previous behavior. I will try to reproduce this and update again when I know more.

I tried using both offload and native (-mmic) with a simple example and I am unable to reproduce an empty MIC code image when using .cpp files. I tried with code contained within the same source file and separate source files.

Can you create a reproducer and post that here so I can try that?

I forgot to mention that the host system i used was Windows 7 - not Linux as most people working with MIC might use!

The Visual Studio Version i used was Microsoft Visual Studio 2010 - and i compiled for 64 Bit Debug using the additional commandline option "/Qoffload-attribute-target=mic"

Use two files - any main.cpp will do that hides the windows specific stuff from MIC compilation, e.g. use the following one

#ifndef __MIC__

#include "stdafx.h"

int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}

#endif

and the second pure.cpp that just uses mic code

#ifdef __MIC__

.... C++ intrinsics code

#else
static int i = 0;
#endif

In this form you will get a compiler error since ".... C++ intrinsics code" is no valid .cpp code. However when you remove these two lines

#else
static int i = 0;

then everything between the #ifdef and #endif is ignored since no MIC code will be generated and no compiler error message will appear.

发表评论

登录添加评论。还不是成员?立即加入