futhark-0.21.6: 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 rep) => Prog rep -> 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.GPU.Op

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 rep) => OpMetrics (SOAC rep) Source # 
Instance details

Defined in Futhark.IR.SOACS.SOAC

Methods

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

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

Defined in Futhark.IR.Mem

Methods

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

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

Defined in Futhark.IR.SegOp

Methods

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

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

Defined in Futhark.IR.MC.Op

Methods

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

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

Defined in Futhark.IR.GPU.Op

Methods

opMetrics :: HostOp rep 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 rep) => Stm rep -> MetricsM () Source #

Compute metrics for this statement.

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

Compute metrics for this lambda.