Skip to content

Commit

Permalink
avoid race in nvexec::launch test; fixes #1430
Browse files Browse the repository at this point in the history
  • Loading branch information
ericniebler committed Nov 4, 2024
1 parent 35e8941 commit 113c90f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/nvexec/launch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ namespace { namespace {
| nvexec::launch( //
{NUM_BLOCKS, THREAD_BLOCK_SIZE}, //
[flags](cudaStream_t stm, int* first, int* last) -> void {
const int32_t idx = blockIdx.x * blockDim.x + threadIdx.x;
const ptrdiff_t size = last - first;

// this should be executing on the GPU
if (nvexec::is_on_gpu()) {
if (idx == 0 && nvexec::is_on_gpu()) {
flags.set(0);
}

const int32_t idx = blockIdx.x * blockDim.x + threadIdx.x;
const ptrdiff_t size = last - first;

if (idx < size) {
first[idx] *= scaling;
}
Expand Down

0 comments on commit 113c90f

Please sign in to comment.