Skip to content

Commit

Permalink
Merge pull request #1431 from NVIDIA/fix-nvexec-launch-test
Browse files Browse the repository at this point in the history
avoid race in `nvexec::launch` test; fixes #1430
  • Loading branch information
ericniebler authored Nov 4, 2024
2 parents 35e8941 + 113c90f commit c1508b1
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 c1508b1

Please sign in to comment.