futhark-0.25.25: An optimising compiler for a functional, array-oriented language.
Safe HaskellSafe-Inferred
LanguageGHC2021

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 SizeOp Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

opMetrics :: SizeOp -> MetricsM () Source #

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

Defined in Futhark.IR.SOACS.SOAC

Methods

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

Defined in Futhark.IR.GPU.Op

Methods

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

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

Defined in Futhark.IR.MC.Op

Methods

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

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

Defined in Futhark.IR.Mem

Methods

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

OpMetrics (NoOp rep) Source # 
Instance details

Defined in Futhark.Analysis.Metrics

Methods

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

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

Defined in Futhark.IR.SegOp

Methods

opMetrics :: SegOp lvl rep -> 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
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 #

Functor MetricsM Source # 
Instance details

Defined in Futhark.Analysis.Metrics

Methods

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

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

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 #

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.

bodyMetrics :: OpMetrics (Op rep) => Body rep -> MetricsM () Source #

Compute metrics for this body.