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

Safe Haskell | None
Language | GHC2021

Futhark.Optimise.Simplify.Rules

Description

This module defines a collection of simplification rules, as per Futhark.Optimise.Simplify.Rule. They are used in the simplifier.

For performance reasons, many sufficiently simple logically separate rules are merged into single "super-rules", like ruleIf and ruleBasicOp. This is because it is relatively expensive to activate a rule just to determine that it does not apply. Thus, it is more efficient to have a few very fat rules than a lot of small rules. This does not affect the compiler result in any way; it is purely an optimisation to speed up compilation.

Synopsis

- standardRules :: (BuilderOps rep, TraverseOpStms rep) => RuleBook rep
- removeUnnecessaryCopy :: BuilderOps rep => BottomUpRuleBasicOp rep

# Documentation

standardRules :: (BuilderOps rep, TraverseOpStms rep) => RuleBook rep Source #

A set of standard simplification rules. These assume pure functional semantics, and so probably should not be applied after memory block merging.

removeUnnecessaryCopy :: BuilderOps rep => BottomUpRuleBasicOp rep Source #

Turn `copy(x)` into `x` iff `x` is not used after this copy statement and it can be consumed.

This simplistic rule is only valid before we introduce memory.