Unverified Commit f9106ddb authored by peastman's avatar peastman Committed by GitHub
Browse files

Merge pull request #2102 from peastman/sort

Fixed race condition in sorting
parents ed8a48b6 2f565a0d
...@@ -144,6 +144,7 @@ __global__ void computeBucketPositions(unsigned int numBuckets, unsigned int* __ ...@@ -144,6 +144,7 @@ __global__ void computeBucketPositions(unsigned int numBuckets, unsigned int* __
// Load the bucket sizes into local memory. // Load the bucket sizes into local memory.
unsigned int globalIndex = startBucket+threadIdx.x; unsigned int globalIndex = startBucket+threadIdx.x;
__syncthreads();
posBuffer[threadIdx.x] = (globalIndex < numBuckets ? bucketOffset[globalIndex] : 0); posBuffer[threadIdx.x] = (globalIndex < numBuckets ? bucketOffset[globalIndex] : 0);
__syncthreads(); __syncthreads();
......
...@@ -147,6 +147,7 @@ __kernel void computeBucketPositions(uint numBuckets, __global uint* restrict bu ...@@ -147,6 +147,7 @@ __kernel void computeBucketPositions(uint numBuckets, __global uint* restrict bu
// Load the bucket sizes into local memory. // Load the bucket sizes into local memory.
uint globalIndex = startBucket+get_local_id(0); uint globalIndex = startBucket+get_local_id(0);
barrier(CLK_LOCAL_MEM_FENCE);
buffer[get_local_id(0)] = (globalIndex < numBuckets ? bucketOffset[globalIndex] : 0); buffer[get_local_id(0)] = (globalIndex < numBuckets ? bucketOffset[globalIndex] : 0);
barrier(CLK_LOCAL_MEM_FENCE); barrier(CLK_LOCAL_MEM_FENCE);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment