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

single pass scan group virtualization #2041

Merged
merged 4 commits into from
Nov 17, 2023
Merged
Changes from 1 commit
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
8 changes: 7 additions & 1 deletion src/Futhark/CodeGen/ImpGen/GPU/SegScan/SinglePass.hs
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ compileSegScan pat lvl space scan_op map_kbody = do
debug_ "sumT'" $ fromIntegral sumT'

statusFlags <- sAllocArray "status_flags" int8 (Shape [num_virtgroups]) (Space "device")
sReplicate statusFlags $ intConst Int8 statusX

(aggregateArrays, incprefixArrays) <-
fmap unzip $
forM tys $ \ty ->
Expand Down Expand Up @@ -314,7 +316,11 @@ compileSegScan pat lvl space scan_op map_kbody = do
(untyped (1 :: Imp.TExp Int32))
sComment "Set dynamic id and reset status flag for this block" $ do
copyDWIMFix sharedId [0] (tvSize dyn_id) []
copyDWIMFix statusFlags [tvExp dyn_id] (intConst Int8 statusX) []
-- TODO: find out why this flag initialization (rather than
-- initializing using sReplicate outside the current kernel) is
-- causing problems. it was never a problem with any of our
-- prototypes.
-- copyDWIMFix statusFlags [tvExp dyn_id] (intConst Int8 statusX) []
athas marked this conversation as resolved.
Show resolved Hide resolved

sComment "First thread in last (virtual) block resets global dynamic_id" $ do
sWhen (tvExp dyn_id .==. num_virtgroups_e - 1) $
Expand Down
Loading