# Unexpected behavior from maxrregcount

**URL:** <https://forums.developer.nvidia.com/t/unexpected-behavior-from-maxrregcount/17806>\
**Category:** CUDA Programming and Performance\
**Created:** [July 19, 2010, 8:11pm UTC](https://forums.developer.nvidia.com/t/unexpected-behavior-from-maxrregcount/17806 "2010-07-19T20:11:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cuda\_Libre](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Cuda\_Libre](https://forums.developer.nvidia.com/u/Cuda_Libre)\
**Post date:** [July 19, 2010, 8:11pm UTC](https://forums.developer.nvidia.com/t/unexpected-behavior-from-maxrregcount/17806/1 "2010-07-19T20:11:02Z")

</div>

Hi

I have a kernel that takes 10 registers, and if I compile it with --maxrregcount=16, it takes 9 registers.  
Is it normal ? I’d rather keep it using 10 registers (in my mind, the maxrregcount optimizations often produce a little overhead (I’m not talking about register spilling))

Thanks !

PS : I use cuda 3.1

---

<div class="post-metadata">

**Author:** ![tera](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@tera](https://forums.developer.nvidia.com/u/tera)\
**Post date:** [July 19, 2010, 11:28pm UTC](https://forums.developer.nvidia.com/t/unexpected-behavior-from-maxrregcount/17806/2 "2010-07-19T23:28:50Z")

</div>

Does the [font=“Courier New”] **launch\_bounds** ()[/font] directive (see appendix B.16 of the Programming Guide) produce a better result?

---

<div class="post-metadata">

**Author:** ![Jimmy\_Pettersson](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Jimmy\_Pettersson](https://forums.developer.nvidia.com/u/Jimmy_Pettersson)\
**Post date:** [July 19, 2010, 11:36pm UTC](https://forums.developer.nvidia.com/t/unexpected-behavior-from-maxrregcount/17806/3 "2010-07-19T23:36:10Z")

</div>

Among other strange results:

regcount = 25 , maxrregcount = 33 =\> kerneltime = 80 ms  
regcount = 25 , maxrregcount = 54 =\> kerneltime = 100 ms

with cuda 2.1. Never had time to investigate further, maybe someone knows why ?
