Hi all,
I’ve been working on very large project and after the amount of code within a global function (including several inlined device functions) gets too large I get the following error:
Assertion failure at line 2320 of ../../be/cg/NVISA/cgtarget.cxx:
Compiler Error in file /tmp/tmp_00006868-1.i during Register Allocation phase:
ran out of registers: 6
*** glibc detected *** /usr/local/cuda/open64/lib//be: free(): invalid pointer: 0x08a140b0 ***
Signal: Aborted in Register Allocation phase.
Error: Signal Aborted in phase Register Allocation – processing aborted
*** Internal stack backtrace:
/usr/local/cuda/open64/lib//be [0x8324736]
/usr/local/cuda/open64/lib//be [0x83247aa]
/usr/local/cuda/open64/lib//be [0x8325431]
/usr/local/cuda/open64/lib//be [0x8325500]
/usr/local/cuda/open64/lib//be [0x8325578]
/usr/local/cuda/open64/lib//be [0x8323e53]
[0xffffe420]
/lib/libc.so.6 [0x401b19fe]
nvopencc INTERNAL ERROR: /usr/local/cuda/open64/lib//be died due to signal 4
make: *** [all] Error 255
I have tried writing several different global functions and every time that the code gets too large I encounter this error again. I have tried to pin down the error to something specific in my code, but so far I havn’t been able to come up with anything.
for example, suppose I have defined the following function elsewhere:
/* A very large function calling other device functions */
device void mydevfunc(void);
The following code will compile and run just fine:
global void myglobalfunc(void){
mydevfunc();
mydevfunc();
mydevfunc();
mydevfunc();
}
However I get the error above by just adding one more call to mydevfunc(), for example the following code would not compile:
global void myglobalfunc(void){
mydevfunc();
mydevfunc();
mydevfunc();
mydevfunc();
mydevfunc();
}
I have been trying to run the code as a single thread as follows:
...
dim3 grid(1,1);
dim3 threads(1,1,1);
myglobalfunc<<<grid,threads>>>();
...
(Although in the actual code i have several parameters to the global and device functions, and return values from the device functions)
My questions:
Does anyone have any idea as to what the problem is? I am currently working under the assumption that it is a compiler bug.
If it is a compiler bug are there any workarounds to get the code to compile? Is there a way to tell the compiler to use memory instead of registers for most variables as a possible workaround?
I’ve done a Google search and haven’t been able to come up with anything at all. Any help would be greatly appreciated. If desired, I can be more specific and provide actual code (although it is very long).