Skip to content

Commit

Permalink
Only applies if no variant certificates are used.
Browse files Browse the repository at this point in the history
  • Loading branch information
athas committed Aug 15, 2024
1 parent eaa2df2 commit 13ee071
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/Futhark/Pass/ExtractKernels/DistributeNests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -586,14 +586,15 @@ maybeDistributeStm stm@(Let _ aux (BasicOp (Replicate shape (Var stm_arr)))) acc
Rearrange ([res_r - nest_r .. res_r - 1] ++ [0 .. res_r - nest_r - 1]) arr_tr_rep
maybeDistributeStm stm@(Let _ aux (BasicOp (Replicate shape v))) acc = do
distributeSingleStm acc stm >>= \case
Just (kernels, _, nest, acc') -> do
addPostStms kernels
let outerpat = loopNestingPat $ fst nest
nest_shape = Shape $ kernelNestWidths nest
localScope (typeEnvFromDistAcc acc') $ do
postStm <=< runBuilder_ . auxing aux . letBind outerpat $
BasicOp (Replicate (nest_shape <> shape) v)
pure acc'
Just (kernels, _, nest, acc')
| boundInKernelNest nest == mempty -> do
addPostStms kernels
let outerpat = loopNestingPat $ fst nest
nest_shape = Shape $ kernelNestWidths nest
localScope (typeEnvFromDistAcc acc') $ do
postStm <=< runBuilder_ . auxing aux . letBind outerpat $
BasicOp (Replicate (nest_shape <> shape) v)
pure acc'
_ -> addStmToAcc stm acc
-- Opaques are applied to the full array, because otherwise they can
-- drastically inhibit parallelisation in some cases.
Expand Down

0 comments on commit 13ee071

Please sign in to comment.