Skip to content

Commit

Permalink
Remove in-place lowering. (#2055)
Browse files Browse the repository at this point in the history
This is one of our oldest optimisations, and mainly served to clean up
the code produced by sequentialisation, as well as a few other simple
things that we would today call "memory short circuiting".

In-place lowering is a really complicated optimisation, so now that we
have a propert short circuiting pass, we can get rid of it.
Short circuiting is even more complicated, but it
is also properly principled, and more general.

We still largely have the sequentialisation problems that in-place
lowering was supposed to address (mostly nested maps), but at least on
the GPU backends there seems to be no real impact from it anymore. I
would still like to one day fix sequentialisation so that it produces
better code for nested SOACs.
  • Loading branch information
athas authored Dec 4, 2023
1 parent 6bf0e8a commit 9663bd2
Show file tree
Hide file tree
Showing 20 changed files with 7 additions and 1,162 deletions.
3 changes: 0 additions & 3 deletions futhark.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,6 @@ library
Futhark.Optimise.Fusion.TryFusion
Futhark.Optimise.GenRedOpt
Futhark.Optimise.HistAccs
Futhark.Optimise.InPlaceLowering
Futhark.Optimise.InPlaceLowering.LowerIntoStm
Futhark.Optimise.InPlaceLowering.SubstituteIndices
Futhark.Optimise.InliningDeadFun
Futhark.Optimise.MemoryBlockMerging
Futhark.Optimise.MemoryBlockMerging.GreedyColoring
Expand Down
19 changes: 0 additions & 19 deletions src/Futhark/CLI/Dev.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import Futhark.Optimise.CSE
import Futhark.Optimise.DoubleBuffer
import Futhark.Optimise.Fusion
import Futhark.Optimise.HistAccs
import Futhark.Optimise.InPlaceLowering
import Futhark.Optimise.InliningDeadFun
import Futhark.Optimise.MemoryBlockMerging qualified as MemoryBlockMerging
import Futhark.Optimise.ReduceDeviceSyncs (reduceDeviceSyncs)
Expand Down Expand Up @@ -330,23 +329,6 @@ allocateOption short =
long = [passLongOption pass]
pass = Seq.explicitAllocations

iplOption :: String -> FutharkOption
iplOption short =
passOption (passDescription pass) (UntypedPass perform) short long
where
perform (GPU prog) config =
GPU
<$> runPipeline (onePass inPlaceLoweringGPU) config prog
perform (Seq prog) config =
Seq
<$> runPipeline (onePass inPlaceLoweringSeq) config prog
perform s _ =
externalErrorS $
"Pass '" ++ passDescription pass ++ "' cannot operate on " ++ representation s

long = [passLongOption pass]
pass = inPlaceLoweringSeq

cseOption :: String -> FutharkOption
cseOption short =
passOption (passDescription pass) (UntypedPass perform) short long
Expand Down Expand Up @@ -616,7 +598,6 @@ commandLineOptions =
kernelsPassOption reduceDeviceSyncs [],
typedPassOption soacsProg GPU extractKernels [],
typedPassOption soacsProg MC extractMulticore [],
iplOption [],
allocateOption "a",
kernelsMemPassOption doubleBufferGPU [],
mcMemPassOption doubleBufferMC [],
Expand Down
Loading

0 comments on commit 9663bd2

Please sign in to comment.