Skip to content

Commit bf3556f

Browse files
authored
Merge pull request #82 from andrew-hardin/fix/two-races
Resolve race conditions identified by racecheck.
2 parents 42bda27 + f603edf commit bf3556f

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/popsift/common/excl_blk_prefix_sum.h

+2-6
Original file line numberDiff line numberDiff line change
@@ -132,19 +132,15 @@ class Block
132132
*/
133133
_mapping_writer.set( ebs, self, cell );
134134
}
135+
__syncthreads();
135136

136137
if( threadIdx.y == 0 && threadIdx.x == 31 ) {
137138
loop_total += ibs;
138139
}
139140
__syncthreads();
140141
}
141142

142-
// if( threadIdx.y == 0 && threadIdx.x == 31 )
143-
if( threadIdx.y == 0 )
144-
{
145-
loop_total = popsift::shuffle( loop_total, 31 );
146-
_total_writer.set( loop_total );
147-
}
143+
_total_writer.set( loop_total );
148144
}
149145
};
150146

src/popsift/s_orientation.cu

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ void ori_par( const int octave,
7676
__shared__ float sm_hist[ORI_NBINS];
7777

7878
for( int i = threadIdx.x; i < ORI_NBINS; i += blockDim.x ) hist[i] = 0.0f;
79+
__syncthreads();
7980

8081
/* keypoint fractional geometry */
8182
const float x = iext->xpos;
@@ -204,6 +205,7 @@ void ori_par( const int octave,
204205
refined_angle[bin] = predicate ? prev + newbin : -1;
205206
yval[bin] = predicate ? -(num*num) / (4.0f * denB) + sm_hist[prev] : -INFINITY;
206207
}
208+
__syncthreads();
207209

208210
int2 best_index = make_int2( threadIdx.x, threadIdx.x + 32 );
209211

0 commit comments

Comments
 (0)