# GTX 470 - Warp problem ?

**URL:** <https://forums.developer.nvidia.com/t/gtx-470-warp-problem/23327>\
**Category:** CUDA Programming and Performance\
**Created:** [July 2, 2011, 10:03am UTC](https://forums.developer.nvidia.com/t/gtx-470-warp-problem/23327 "2011-07-02T10:03:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Polar\_01](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Polar\_01](https://forums.developer.nvidia.com/u/Polar_01)\
**Post date:** [July 2, 2011, 10:03am UTC](https://forums.developer.nvidia.com/t/gtx-470-warp-problem/23327/1 "2011-07-02T10:03:33Z")

</div>

Hi,

I try to do a inclusive scan on 128 int on a GTX 470, but it fails !  
It works fine on a Quadro FX380 !!

It only works if I put ‘barriers’ everywhere !!! But the goal is to avoid synchro ! It should be naturally handled by the warp !

inline  
uint4 inclusive\_scan\_128(uint4 initialValue, \_\_local uint\* bitsOnCount)  
{   
\_\_local uint localBuffer[256];  
const uint tid = (uint)get\_local\_id(0);  
uint lane = tid & SIMT\_1;  
uint block = tid \>\> 5;

```
//---- scan : 4 bits
uint4 localBits = initialValue;
localBits.y += localBits.x;
localBits.z += localBits.y;
localBits.w += localBits.z;

//---- scan the last 4x32 bits (The sum in the previous scan)
uint tid2 = block * 2 * SIMT + lane;

localBuffer[tid2] = 0;
tid2 += SIMT;
localBuffer[tid2] = localBits.w;
	
localBuffer[tid2] += localBuffer[tid2 - 1];
localBuffer[tid2] += localBuffer[tid2 - 2];
localBuffer[tid2] += localBuffer[tid2 - 4];
localBuffer[tid2] += localBuffer[tid2 - 8];
localBuffer[tid2] += localBuffer[tid2 - 16];

//---- Add the sum to create a scan of 128 bits
return localBits + localBuffer[tid2 - 1];

```

}

---

<div class="post-metadata">

**Author:** ![hiko](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@hiko](https://forums.developer.nvidia.com/u/hiko)\
**Post date:** [October 14, 2011, 8:22am UTC](https://forums.developer.nvidia.com/t/gtx-470-warp-problem/23327/2 "2011-10-14T08:22:48Z")

</div>

Hello,

You should use volatile qualifier. The explanation is here in page 3:  
[http://developer.download.nvidia.com/compute/cuda/3\_2/toolkit/docs/Fermi\_Compatibility\_Guide.pdf](http://developer.download.nvidia.com/compute/cuda/3_2/toolkit/docs/Fermi_Compatibility_Guide.pdf)
