STM compiler problems

STM compiler problems

jiaq的头像

I've got three questions using this compiler.


1. I got errors when compiling the virtual function sample.


$ icc -Qtm_enabled -openmp intel_stmtest_virtual.cpp -o virtual
intel_stmtest_virtual.cpp(69): error: "#" not expected here
#pragma omp section
^


intel_stmtest_virtual.cpp(69): error: expected an expression
#pragma omp section
^


intel_stmtest_virtual.cpp(74): warning #12: parsing restarts here after previous syntax error
}
^


intel_stmtest_virtual.cpp(74): error: expected a ";"
}
^


compilation aborted for intel_stmtest_virtual.cpp (code 2)




2. As I'm using Linux, should I change all the __declspec(tm_callable) in the samples to __attribute__(tm_callable) in order to run them?


3. Is C++ class constructor implicitly declared as tm_callable? In the virtual function sample, I find "x=new BaseXXX()" in a transaction, but the constructor of BaseXXX is not explicitely declared.

16 帖子 / 0 new
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项
Xinmin Tian (Intel)的头像

Thisposted example was for Windows platforms (__declspec is a syntax for windows). If you want to compile and run it on Linux. All you need to change it to use Linux syntax.


__attribute__((tm_callable)). Please read our user's guide and release note, you will get more information.


Xinmin Tian (Intel)

Xinmin Tian (Intel)的头像

In the Prototype Edition, the constructor is implicitly treated as tm_waiver if it is not marked tm_callable explicitly.


Xinmin Tian (Intel)


martin.watt的头像

I get the same errors even after changing __declspec to __attribute__. The problem appears to be an interaction between OpenMP and the STM declarations inside the OpenMP code If I remove the __tm_atomic declarations, it compiles ok.

jiaq的头像

Excuse me, but is this problem solved? I mean, I still cannot get it compiled after several attempts, and got the same output as in my first post. I did change those "decl"s.

James Cownie (Intel)的头像

AFAICT you may be missing the "-Qstd=c99" compiler flag. See the discussion in the "_Pragma not supported" thread.


jiaq的头像

But I'm compiling it in Linux and using the Linux version of this compiler, which complaines that it does not support "-Qstd=c99". So I used "-std=c99". Although it recognized this option, there is still the same error:

$ icc -Qtm_enabled -openmp -std=c99 intel_stmtest_virtual.cpp -o virtual
intel_stmtest_virtual.cpp(69): error: "#" not expected here
#pragma omp section
^

intel_stmtest_virtual.cpp(69): error: expected an expression
#pragma omp section
^

intel_stmtest_virtual.cpp(74): warning #12: parsing restarts here after previous syntax error
}
^

intel_stmtest_virtual.cpp(74): error: expected a ";"
}
^

compilation aborted for intel_stmtest_virtual.cpp (code 2)


jiaq的头像

I changed all the #pragma directives to _Pragma(), just as it is in the hashtable example. It seems to have some effects but I got different errors:


]$ icc -openmp -Qtm_enabled -std=c99 intel_stmtest_virtual.cpp -o virtual
intel_stmtest_virtual.cpp(65): (col. 1) remark: OpenMP DEFINED SECTION WAS PARALLELIZED.
tx_warning: intel_stmtest_virtual.cpp(74): a non tm_callable/tm_waiver intrinsic function '_Unwind_Resume' called inside __tm_atomic section
tx_warning: intel_stmtest_virtual.cpp(74): a non tm_callable/tm_waiver function '__kmpc_end' called inside __tm_atomic section
tx_warning: intel_stmtest_virtual.cpp(68): a non tm_callable/tm_waiver intrinsic function '_Unwind_Resume' called inside __tm_atomic section
tx_warning: intel_stmtest_virtual.cpp(68): a non tm_callable/tm_waiver function '__kmpc_end' called inside __tm_atomic section
tx_warning: intel_stmtest_virtual.cpp(74): a non tm_callable/tm_waiver intrinsic function '_ZdlPv' called inside __tm_atomic section
tx_warning: intel_stmtest_virtual.cpp(68): a non tm_callable/tm_waiver intrinsic function '_ZdlPv' called inside __tm_atomic section
tx_warning: intel_stmtest_virtual.cpp(68): a non tm_callable/tm_waiver intrinsic function '_Znwj' called inside __tm_atomic section
tx_warning: intel_stmtest_virtual.cpp(74): a non tm_callable/tm_waiver intrinsic function '_Znwj' called inside __tm_atomic section
(0): internal error: backend signals

compilation aborted for intel_stmtest_virtual.cpp (code 4)

What's this problem?

jiaq的头像

I think the Linux version of this edition has some problems with c++. I wrote a simple program and it just complains the same thing.

#include
using namespace std;

class List{
public:
int val;
class List* next;
};

int main(){
class List* temp = new List();
class List* lHead = temp;
for(int i=0;i<10;i++){
temp->val=i;
temp->next = new List();
temp = temp->next;
}
temp = lHead;
for(int i=0;i<10;i++){
cout<<"val is "<val< __tm_atomic{
temp = temp->next;
}
}
}

and it complains:

a non tm_callable/tm_waiver intrinsic function '_Unwind_Resume' called inside __tm_atomic section

More errors will occur if I add some openmp directives, just as my previous post.

But it compiles and runs OK in the Windows version.

Ravi Narayanaswamy (Intel)的头像

You can ignore the warning about "a non tm_callable/tm_wavier intrinsic function_Unwind_resume called inside __tm_atomic section" . The next update of the compiler will not issue this warning. Compiler generates the function call _Unwind_resume for C++ programs to handle exception handling


If you provide the program with openmp directives which generate errors we can investigate the problem.

jiaq的头像

I used openmp directives in that program in the following way:

#include
#include
using namespace std;

class List{
public:
int val;
class List* next;
};

int main(){
class List* temp = new List();
class List* lHead = temp;
for(int i=0;i<10;i++){
temp->val=i;
temp->next = new List();
temp = temp->next;
}
temp = lHead;
#pragma omp parallel for
for(int i=0;i<10;i++){
int val;
__tm_atomic{
val = temp->val;
temp = temp->next;
}
cout<<"val is "< }

}

This is what I got when I tried to compile it:

icc -openmp -Qtm_enabled -std=c99 try_list.cpp -o list
try_list.cpp(20): (col. 1) remark: OpenMP DEFINED LOOP WAS PARALLELIZED.
tx_warning: try_list.cpp(24): a non tm_callable/tm_waiver intrinsic function '_Unwind_Resume' called inside __tm_atomic section
tx_warning: try_list.cpp(24): a non tm_callable/tm_waiver function '__kmpc_end' called inside __tm_atomic section
(0): internal error: backend signals

compilation aborted for try_list.cpp (code 4)


This program can be compiled successfully if written in C. The "internal error: backend signals" is the same error occured when I compiled the intel_stmtest_virtual.cpp program as in my previous post.

Ravi Narayanaswamy (Intel)的头像

I can reproduce the problem with your test case. Will investigate and update you on the progress.

Ravi Narayanaswamy (Intel)的头像

This problem has been fixed. Next update of the STM compiler should address this.

martin.watt的头像

Do you have a timescale for the release of this updated version? I've converted two algorithms over to use STM and both fail to compile on Linux with errors like the above, so an updated version would be very welcome.

jiaq的头像

I was trying to use function pointer and got some warnings. The program is like:


__attribute__((tm_callable))
int (*foop)(int a);


__attribute__((tm_callable))
int foo(int a)
{
return a+3;
}


int main()
{
int b;
foop = foo;
b = foop(8);
}


and I got warnings as:


try_funcp.c(3): warning #1287: invalid attribute for variable "foop"
__attribute__((tm_callable))


What's wrong with this program? btw, itonly happens on Linux andit does compileOK on Windows.

Xinmin Tian (Intel)的头像

It looks an issue in the linux version of the STM prototype compiler. In the next what-if release, to simplify the usage model, there will be no function pointer annotation required.


Xinmin Tian (Intel)

登陆并发表评论。