# Error: ran out of registers

**URL:** <https://forums.developer.nvidia.com/t/error-ran-out-of-registers/6728>\
**Category:** CUDA Programming and Performance\
**Created:** [December 7, 2008, 4:14am UTC](https://forums.developer.nvidia.com/t/error-ran-out-of-registers/6728 "2008-12-07T04:14:45Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![gpugpu](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@gpugpu](https://forums.developer.nvidia.com/u/gpugpu)\
**Post date:** [December 7, 2008, 4:14am UTC](https://forums.developer.nvidia.com/t/error-ran-out-of-registers/6728/1 "2008-12-07T04:14:45Z")

</div>

Does the following error means I have ran out of registers for executing my kernel?  
Is there any way to solve this?? I used -g -maxrregcount and it didn’t have any effects …

Thanks.

* * *

### Assertion failure at line 2433 of ../../be/cg/NVISA/cgtarget.cxx:

### Compiler Error in file Test.cpp3.i during Register Allocation phase:

### ran out of registers in float

nvopencc INTERNAL ERROR: /usr/local/cuda/open64/lib//be returned non-zero status 1

---

<div class="post-metadata">

**Author:** ![E.D\_Riedijk](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@E.D\_Riedijk](https://forums.developer.nvidia.com/u/E.D_Riedijk)\
**Post date:** [December 7, 2008, 6:17am UTC](https://forums.developer.nvidia.com/t/error-ran-out-of-registers/6728/2 "2008-12-07T06:17:08Z")

</div>

> [@](#):
>
> Does the following error means I have ran out of registers for executing my kernel?
> 
> Is there any way to solve this?? I used -g -maxrregcount and it didn’t have any effects …
> 
> Thanks.
> 
> * * *
> 
> ### Assertion failure at line 2433 of …/…/be/cg/NVISA/cgtarget.cxx:
> 
> ### Compiler Error in file Test.cpp3.i during Register Allocation phase:
> 
> ### ran out of registers in float
> 
> nvopencc INTERNAL ERROR: /usr/local/cuda/open64/lib//be returned non-zero status 1

-g is not useful, could even be harmful.

-maxregcount needs a number after it.

---

<div class="post-metadata">

**Author:** ![gpugpu](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@gpugpu](https://forums.developer.nvidia.com/u/gpugpu)\
**Post date:** [December 7, 2008, 7:58pm UTC](https://forums.developer.nvidia.com/t/error-ran-out-of-registers/6728/3 "2008-12-07T19:58:32Z")

</div>

> [@](#):
>
> -maxregcount needs a number after it.

I did used a number after -maxregcount , but still has no effect on the compilation.

Any thoughts?

---

<div class="post-metadata">

**Author:** ![E.D\_Riedijk](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@E.D\_Riedijk](https://forums.developer.nvidia.com/u/E.D_Riedijk)\
**Post date:** [December 7, 2008, 9:55pm UTC](https://forums.developer.nvidia.com/t/error-ran-out-of-registers/6728/4 "2008-12-07T21:55:29Z")

</div>

> [@](#):
>
> I did used a number after -maxregcount , but still has no effect on the compilation.
> 
> Any thoughts?

which number?

Otherwise, you probably have a very large kernel?

---

<div class="post-metadata">

**Author:** ![asm](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@asm](https://forums.developer.nvidia.com/u/asm)\
**Post date:** [December 10, 2008, 4:25pm UTC](https://forums.developer.nvidia.com/t/error-ran-out-of-registers/6728/5 "2008-12-10T16:25:06Z")

</div>

> [@](#):
>
> I did used a number after -maxregcount , but still has no effect on the compilation.
> 
> Any thoughts?

according to my calculations, maximal allowed number of registers as defined

by nvopencc is 23999 / 64 + 1 = 375

So I guess if you exceed the limit this error should occur, how many registers you have specified for your kernel ?

---

<div class="post-metadata">

**Author:** ![alex\_dubinsky](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@alex\_dubinsky](https://forums.developer.nvidia.com/u/alex_dubinsky)\
**Post date:** [December 10, 2008, 6:02pm UTC](https://forums.developer.nvidia.com/t/error-ran-out-of-registers/6728/6 "2008-12-10T18:02:18Z")

</div>

> [@](#):
>
> according to my calculations, maximal allowed number of registers as defined
> 
> by nvopencc is 23999 / 64 + 1 = 375

Are you sure? Because of single-asignment, registres get used up very quickly. You might only need a few hundred lines of code to use that many. I have kernels with several thousand lines.

maxrregcount affects ptxas. this is an error in nvcc/open64

---

<div class="post-metadata">

**Author:** ![asm](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@asm](https://forums.developer.nvidia.com/u/asm)\
**Post date:** [December 11, 2008, 11:53am UTC](https://forums.developer.nvidia.com/t/error-ran-out-of-registers/6728/7 "2008-12-11T11:53:54Z")

</div>

> [@](#):
>
> Are you sure? Because of single-asignment, registres get used up very quickly. You might only need a few hundred lines of code to use that many. I have kernels with several thousand lines.
> 
> maxrregcount affects ptxas. this is an error in nvcc/open64

you are right, looks like the things are a bit more subtle here,

registers are divided into classes, there are at least 6 types: integer16, integer, integer64, float, float64 and predicate

you can look through open64 sources, each used register within class corresponds to 1 bit in an array of 64-bit ints of size 375 which I mentioned

before, so in total it should be 375\*64 = 24000 registers of one class

sorry for confusion :)

---

<div class="post-metadata">

**Author:** ![alex\_dubinsky](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@alex\_dubinsky](https://forums.developer.nvidia.com/u/alex_dubinsky)\
**Post date:** [December 11, 2008, 6:52pm UTC](https://forums.developer.nvidia.com/t/error-ran-out-of-registers/6728/8 "2008-12-11T18:52:52Z")

</div>

> [@](#):
>
> you are right, looks like the things are a bit more subtle here,
> 
> registers are divided into classes, there are at least 6 types: integer16, integer, integer64, float, float64 and predicate
> 
> you can look through open64 sources, each used register within class corresponds to 1 bit in an array of 64-bit ints of size 375 which I mentioned
> 
> before, so in total it should be 375\*64 = 24000 registers of one class
> 
> sorry for confusion :)

This is still a very interesting limit to keep in mind. So this is what gpugpu hit?

---

<div class="post-metadata">

**Author:** ![tangMin](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@tangMin](https://forums.developer.nvidia.com/u/tangMin)\
**Post date:** [January 12, 2009, 4:16pm UTC](https://forums.developer.nvidia.com/t/error-ran-out-of-registers/6728/9 "2009-01-12T16:16:18Z")

</div>

I alos get similar error:

1\>### Assertion failure at line 2433 of …/…/be/cg/NVISA/cgtarget.cxx:  
1\>### Compiler Error in file XXXX\Temp/tmpxft\_00000b98\_00000000-9\_cudaEntry.cpp3.i during Register Allocation phase:  
1\>### ran out of registers in float  
1\>nvopencc ERROR: F:\CUDA\bin/…/open64/lib//be.exe returned non-zero status 1

I admit my cu file is a bit long, are there any method to bypass it? (can device functions be called as external functions?)

Thanks in advance,

Min

---

<div class="post-metadata">

**Author:** ![alex\_dubinsky](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@alex\_dubinsky](https://forums.developer.nvidia.com/u/alex_dubinsky)\
**Post date:** [January 12, 2009, 11:13pm UTC](https://forums.developer.nvidia.com/t/error-ran-out-of-registers/6728/10 "2009-01-12T23:13:12Z")

</div>

NVIDIA, have you something to say?

It looks like the advertised “2 million PTX instructions” can never be hit because of opencc’s puzzling limitation. Is there no simple way to just increase the max?
