Skip to content

Commit

Permalink
Do not combine reduction operators in intragroup.
Browse files Browse the repository at this point in the history
  • Loading branch information
athas committed Nov 14, 2023
1 parent d003046 commit 3efe52b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Futhark/Pass/ExtractKernels/Intragroup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -253,19 +253,22 @@ intraGroupStm stm@(Let pat aux e) = do
=<< runDistNestT env (distributeMapBodyStms acc (bodyStms $ lambdaBody lam))
Op (Screma w arrs form)
| Just (scans, mapfun) <- isScanomapSOAC form,
-- FIXME: Futhark.CodeGen.ImpGen.GPU.Group.compileGroupOp
-- cannot handle multiple scan operators yet.
Scan scanfun nes <- singleScan scans -> do
let scanfun' = soacsLambdaToGPU scanfun
mapfun' = soacsLambdaToGPU mapfun
certifying (stmAuxCerts aux) $
addStms =<< segScan lvl pat mempty w [SegBinOp Noncommutative scanfun' nes mempty] mapfun' arrs [] []
parallelMin [w]
Op (Screma w arrs form)
| Just (reds, map_lam) <- isRedomapSOAC form,
Reduce comm red_lam nes <- singleReduce reds -> do
let red_lam' = soacsLambdaToGPU red_lam
| Just (reds, map_lam) <- isRedomapSOAC form -> do
let onReduce (Reduce comm red_lam nes) =
SegBinOp comm (soacsLambdaToGPU red_lam) nes mempty
reds' = map onReduce reds
map_lam' = soacsLambdaToGPU map_lam
certifying (stmAuxCerts aux) $
addStms =<< segRed lvl pat mempty w [SegBinOp comm red_lam' nes mempty] map_lam' arrs [] []
addStms =<< segRed lvl pat mempty w reds' map_lam' arrs [] []
parallelMin [w]
Op (Screma w arrs form) ->
-- This screma is too complicated for us to immediately do
Expand Down

0 comments on commit 3efe52b

Please sign in to comment.