futhark
Safe HaskellNone
LanguageGHC2021

Futhark.Optimise.Fusion.Screma

Synopsis

Documentation

splitLambdaByPar :: MonadFail m => [VName] -> [inp] -> Lambda SOACS -> [out] -> m (([inp], Lambda SOACS, [out]), ([inp], Lambda SOACS, [out])) Source #

Given a list of parameter names and a lambda, split the lambda into two where the first function will depend on the given parameters given if they exist plus additional parameters if they are need for some computation. The other lambda will have all the other parameters and do the remaining computational work. Some statements may be present in both lambdas.

Further, each parameter is associated with some additional information a, and each result with some additional information b. This is also partitioned and returned appropriately.

fuseSuperScrema :: MonadFreshNames m => SubExp -> [Input] -> ScremaForm SOACS -> [VName] -> [Input] -> ScremaForm SOACS -> [VName] -> m (SuperScrema SOACS, [VName]) Source #

Given two scremas that are fusible, fuse them into a super screma. This is fused but work will have to be moved around in the super screma for it to become a screma.

data SuperScrema rep Source #

The fused representation of two scremas.

Constructors

SuperScrema SubExp [Input] (Lambda rep) [Scan rep] [Reduce rep] (Lambda rep) [Scan rep] [Reduce rep] (Lambda rep) 

Instances

Instances details
RepTypes rep => Show (SuperScrema rep) Source # 
Instance details

Defined in Futhark.Optimise.Fusion.Screma

Methods

showsPrec :: Int -> SuperScrema rep -> ShowS #

show :: SuperScrema rep -> String #

showList :: [SuperScrema rep] -> ShowS #

RepTypes rep => Eq (SuperScrema rep) Source # 
Instance details

Defined in Futhark.Optimise.Fusion.Screma

Methods

(==) :: SuperScrema rep -> SuperScrema rep -> Bool #

(/=) :: SuperScrema rep -> SuperScrema rep -> Bool #

RepTypes rep => Ord (SuperScrema rep) Source # 
Instance details

Defined in Futhark.Optimise.Fusion.Screma

Methods

compare :: SuperScrema rep -> SuperScrema rep -> Ordering #

(<) :: SuperScrema rep -> SuperScrema rep -> Bool #

(<=) :: SuperScrema rep -> SuperScrema rep -> Bool #

(>) :: SuperScrema rep -> SuperScrema rep -> Bool #

(>=) :: SuperScrema rep -> SuperScrema rep -> Bool #

max :: SuperScrema rep -> SuperScrema rep -> SuperScrema rep #

min :: SuperScrema rep -> SuperScrema rep -> SuperScrema rep #

PrettyRep rep => Pretty (SuperScrema rep) Source # 
Instance details

Defined in Futhark.Optimise.Fusion.Screma

Methods

pretty :: SuperScrema rep -> Doc ann #

prettyList :: [SuperScrema rep] -> Doc ann #

moveRedScanSuperScrema :: (MonadFail m, MonadFreshNames m) => SuperScrema SOACS -> m (SuperScrema SOACS) Source #

Moves the last scan and reduce from the super screma to the top of the super screma.

moveLastSuperScrema :: MonadFreshNames m => SuperScrema SOACS -> m (SuperScrema SOACS) Source #

Moves all work done in the last lambda to middle lambda of the super screma.

fusible :: MonadFail m => ScremaForm SOACS -> [VName] -> [Input] -> ScremaForm SOACS -> m () Source #

Check that two scremas are fusible if they are give back the producer scremas post lambda that has been split into the scan lambda and map lambda. It is not fusible if inputs and outputs are being transformed and if the producers scan result is used for the consumers scans or reduces.

toScrema :: SuperScrema SOACS -> ([Input], ScremaForm SOACS) Source #

Turn a SuperScrema into Screma.