Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add syncthreads to scans prevent overwriting shared memory of previous chunk #97

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -189,6 +189,10 @@ mkScanAllP1 dir uid aenv tp combine mseed marr = do
-- iterating over thread-block-wide segments
imapFromStepTo s0 gd' end $ \chunk -> do

-- Make sure all threads have finished previous iterations,
-- so we can reuse (and overwrite) shared memory.
__syncthreads

bd <- blockDim
bd' <- int bd
inf <- A.mul numType chunk bd'
@@ -499,6 +503,10 @@ mkScan'AllP1 dir uid aenv tp combine seed marr = do
-- iterate over thread-block wide segments
imapFromStepTo bid gd end $ \seg -> do

-- Make sure all threads have finished previous iterations,
-- so we can reuse (and overwrite) shared memory.
__syncthreads

bd <- int =<< blockDim
inf <- A.mul numType seg bd

@@ -819,6 +827,10 @@ mkScanDim dir uid aenv repr@(ArrayR (ShapeRsnoc shr) tp) combine mseed marr = do

imapFromStepTo bid gd end $ \seg -> do

-- Make sure all threads have finished previous iterations,
-- so we can reuse (and overwrite) shared memory.
__syncthreads

-- Index this thread reads from
tid <- threadIdx
tid' <- int tid