 	uint blocksums[];
 };
 
-shared uint temp[BLOCKSIZE];
+#define NUM_BANKS 16
+#define LOG_NUM_BANKS 4
+#define CONFLICT_FREE_OFFSET(n) ((n) >> LOG_NUM_BANKS)
+
+shared uint temp[BLOCKSIZE + CONFLICT_FREE_OFFSET(BLOCKSIZE)];
 
 const int n = BLOCKSIZE;
 

	
	if (lid == 0)
	{
		blocksums[gl_WorkGroupID.x] = temp[n - 1];
		temp[n - 1] = 0;
	}
	
	for (int d = 1; d < n; d *= 2)

	int lid = int (gl_LocalInvocationIndex);
	int offset = 1;
	
	int ai = lid;
	int bi = lid + (n/2);
	
	int bankOffsetA = CONFLICT_FREE_OFFSET(ai);
	int bankOffsetB = CONFLICT_FREE_OFFSET(bi);
	
	temp[ai + bankOffsetA] = data[gid];
	temp[bi + bankOffsetB] = data[gid + (n/2)];
	
	for (int d = n >> 1; d > 0; d >>= 1)
	{
