Skip to content

Commit

Permalink
Move __syncthreads after thread copy
Browse files Browse the repository at this point in the history
  • Loading branch information
edopao committed Dec 12, 2023
1 parent 8b99971 commit f5cd14b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions dace/runtime/include/dace/cuda/copy.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -743,9 +743,6 @@ namespace dace

static DACE_DFI void Copy(const T *smem, int src_xstride, T *ptr, int dst_xstride)
{
if (!ASYNC)
__syncthreads();

// Linear thread ID
int ltid = GetLinearTID<BLOCK_WIDTH, BLOCK_HEIGHT, BLOCK_DEPTH>();

Expand All @@ -759,14 +756,14 @@ namespace dace
*(ptr + (ltid + WRITES*BLOCK_SIZE)* dst_xstride) =
*(smem + (ltid + WRITES * BLOCK_SIZE) * src_xstride);
}

if (!ASYNC)
__syncthreads();
}

template <typename WCR>
static DACE_DFI void Accum(const T *smem, int src_xstride, T *ptr, int dst_xstride, WCR wcr)
{
if (!ASYNC)
__syncthreads();

// Linear thread ID
int ltid = GetLinearTID<BLOCK_WIDTH, BLOCK_HEIGHT, BLOCK_DEPTH>();

Expand All @@ -783,14 +780,14 @@ namespace dace
ptr + (ltid + WRITES * BLOCK_SIZE)* dst_xstride,
*(smem + (ltid + WRITES * BLOCK_SIZE) * src_xstride));
}

if (!ASYNC)
__syncthreads();
}

template <ReductionType REDTYPE>
static DACE_DFI void Accum(const T *smem, int src_xstride, T *ptr, int dst_xstride)
{
if (!ASYNC)
__syncthreads();

// Linear thread ID
int ltid = GetLinearTID<BLOCK_WIDTH, BLOCK_HEIGHT, BLOCK_DEPTH>();

Expand All @@ -807,6 +804,9 @@ namespace dace
ptr + (ltid + WRITES*BLOCK_SIZE)* dst_xstride,
*(smem + (ltid + WRITES * BLOCK_SIZE) * src_xstride));
}

if (!ASYNC)
__syncthreads();
}
};

Expand Down

0 comments on commit f5cd14b

Please sign in to comment.