futhark-0.25.32: An optimising compiler for a functional, array-oriented language.

Safe Haskell | None
Language | GHC2021

Futhark.Optimise.Fusion.TryFusion

Description

Facilities for fusing two SOACs.

When the fusion algorithm decides that it's worth fusing two SOAC statements, this is the module that tries to see if that's possible. May involve massaging either producer or consumer in various ways.

Synopsis

- data FusedSOAC = FusedSOAC {
  - fsSOAC :: SOAC
  - fsOutputTransform :: ArrayTransforms
  - fsOutNames :: [VName]
  }
- data Mode
  - = Horizontal
  - | Vertical
- attemptFusion :: (HasScope SOACS m, MonadFreshNames m) => Mode -> Names -> [VName] -> SOAC -> FusedSOAC -> m (Maybe FusedSOAC)

# Documentation

data FusedSOAC Source #

A fused SOAC contains a bit of extra information.

Constructors

FusedSOAC |

Fields

- fsSOAC :: SOAC

  The actual SOAC.

- fsOutputTransform :: ArrayTransforms

  A transformation to be applied to *all* results of the SOAC.

- fsOutNames :: [VName]

  The outputs of the SOAC (i.e. the names in the pattern that the result of this SOAC should be bound to).

#### Instances

Instances details

Show FusedSOAC Source # |
Instance details Defined in Futhark.Optimise.Fusion.TryFusion Methods showsPrec :: Int -> FusedSOAC -> ShowS Source # show :: FusedSOAC -> String Source # showList :: [FusedSOAC] -> ShowS Source #

data Mode Source #

Whether we are doing horizontal or vertical fusion. Note that vertical also includes "diagonal" fusion, where some producer results are also produced by the final SOAC.

Constructors

Horizontal |
Vertical |

attemptFusion Source #

Arguments

:: (HasScope SOACS m, MonadFreshNames m) |
=> Mode |
-> Names | Outputs of the producer that should still be output by the fusion result (corresponding to "diagonal fusion").
-> [VName] | The outputs of the SOAC.
-> SOAC |
-> FusedSOAC |
-> m (Maybe FusedSOAC) |

Attempt fusing the producer into the consumer.