futhark-0.19.5: An optimising compiler for a functional, array-oriented language.
Safe HaskellTrustworthy
LanguageHaskell2010

Futhark.Analysis.Metrics

Description

Abstract Syntax Tree metrics. This is used in the futhark test program, for the structure stanzas.

Synopsis

Documentation

newtype AstMetrics Source #

AST metrics are simply a collection from identifiable node names to the number of times that node appears.

Constructors

AstMetrics (Map Text Int) 

progMetrics :: OpMetrics (Op lore) => Prog lore -> AstMetrics Source #

Compute the metrics for a program.

Extensibility

class OpMetrics op where Source #

Compute the metrics for some operation.

Methods

opMetrics :: op -> MetricsM () Source #

Instances

Instances details
OpMetrics () Source # 
Instance details

Defined in Futhark.Analysis.Metrics

Methods

opMetrics :: () -> MetricsM () Source #

OpMetrics SizeOp Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Methods

opMetrics :: SizeOp -> MetricsM () Source #

OpMetrics a => OpMetrics (Maybe a) Source # 
Instance details

Defined in Futhark.Analysis.Metrics

Methods

opMetrics :: Maybe a -> MetricsM () Source #

OpMetrics (Op lore) => OpMetrics (SOAC lore) Source # 
Instance details

Defined in Futhark.IR.SOACS.SOAC

Methods

opMetrics :: SOAC lore -> MetricsM () Source #

OpMetrics inner => OpMetrics (MemOp inner) Source # 
Instance details

Defined in Futhark.IR.Mem

Methods

opMetrics :: MemOp inner -> MetricsM () Source #

OpMetrics (Op lore) => OpMetrics (SegOp lvl lore) Source # 
Instance details

Defined in Futhark.IR.SegOp

Methods

opMetrics :: SegOp lvl lore -> MetricsM () Source #

(OpMetrics (Op lore), OpMetrics op) => OpMetrics (MCOp lore op) Source # 
Instance details

Defined in Futhark.IR.MC.Op

Methods

opMetrics :: MCOp lore op -> MetricsM () Source #

(OpMetrics (Op lore), OpMetrics op) => OpMetrics (HostOp lore op) Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Methods

opMetrics :: HostOp lore op -> MetricsM () Source #

seen :: Text -> MetricsM () Source #

Add this node to the current tally.

inside :: Text -> MetricsM () -> MetricsM () Source #

Enclose a metrics counting operation. Most importantly, this prefixes the name of the context to all the metrics computed in the enclosed operation.

data MetricsM a Source #

This monad is used for computing metrics. It internally keeps track of what we've seen so far. Use seen to add more stuff.

Instances

Instances details
Monad MetricsM Source # 
Instance details

Defined in Futhark.Analysis.Metrics

Methods

(>>=) :: MetricsM a -> (a -> MetricsM b) -> MetricsM b #

(>>) :: MetricsM a -> MetricsM b -> MetricsM b #

return :: a -> MetricsM a #

Functor MetricsM Source # 
Instance details

Defined in Futhark.Analysis.Metrics

Methods

fmap :: (a -> b) -> MetricsM a -> MetricsM b #

(<$) :: a -> MetricsM b -> MetricsM a #

Applicative MetricsM Source # 
Instance details

Defined in Futhark.Analysis.Metrics

Methods

pure :: a -> MetricsM a #

(<*>) :: MetricsM (a -> b) -> MetricsM a -> MetricsM b #

liftA2 :: (a -> b -> c) -> MetricsM a -> MetricsM b -> MetricsM c #

(*>) :: MetricsM a -> MetricsM b -> MetricsM b #

(<*) :: MetricsM a -> MetricsM b -> MetricsM a #

stmMetrics :: OpMetrics (Op lore) => Stm lore -> MetricsM () Source #

Compute metrics for this statement.

lambdaMetrics :: OpMetrics (Op lore) => Lambda lore -> MetricsM () Source #

Compute metrics for this lambda.