futhark
Safe HaskellNone
LanguageGHC2021

Futhark.Pass.Flatten.Distribute

Contents

Synopsis

Documentation

data MapArray t Source #

The input we are mapping over in distributeMap.

Constructors

MapArray VName Type

A straightforward array passed in to a top-level map.

MapOther t Type

Something more exotic - distribution will assign it a ResTag, but not do anything else. This is used to distributed nested maps whose inputs are produced in the outer nests.

type DistRep = (VName, Either SubExp DistInput) Source #

The results of a map-distribution that were free or identity mapped in the original map function. These correspond to plain replicated arrays.

type ResMap = Map ResTag [([DistInput], VName, Type)] Source #

First element of tuple are certificates for this result.

Second is the name to which is should be bound.

Third is the element type (i.e. excluding shape of segments).

data DistStm Source #

Instances

Instances details
Show DistStm Source # 
Instance details

Defined in Futhark.Pass.Flatten.Distribute

Eq DistStm Source # 
Instance details

Defined in Futhark.Pass.Flatten.Distribute

Methods

(==) :: DistStm -> DistStm -> Bool #

(/=) :: DistStm -> DistStm -> Bool #

Ord DistStm Source # 
Instance details

Defined in Futhark.Pass.Flatten.Distribute

Pretty DistStm Source # 
Instance details

Defined in Futhark.Pass.Flatten.Distribute

Methods

pretty :: DistStm -> Doc ann #

prettyList :: [DistStm] -> Doc ann #

type DistStms = Seq DistStm Source #

An efficient sequence of DistStms.

data DistBody Source #

The body of a distributed statement.

Constructors

ParallelStm (Stm SOACS)

A single statement that may involve parallel operations or produce an irregular array.

ScalarStm (Stms SOACS)

Single or Multiple scalar operations grouped into a single traversal

data DistInput Source #

Something that is mapped.

Constructors

DistInputFree VName Type

A value bound outside the original map-nest. By necessity regular. The type is the parameter type.

DistInput ResTag Type

A value constructed inside the original map-nest. May be irregular.

data DistType Source #

Constructors

DistType 

Fields

  • Segments

    Outer regular size.

  • Rank

    Irregular dimensions on top (but after the leading regular size).

  • Type

    The regular "element type" - in the worst case, at least a scalar.

Instances

Instances details
Show DistType Source # 
Instance details

Defined in Futhark.Pass.Flatten.Distribute

Eq DistType Source # 
Instance details

Defined in Futhark.Pass.Flatten.Distribute

Ord DistType Source # 
Instance details

Defined in Futhark.Pass.Flatten.Distribute

Pretty DistType Source # 
Instance details

Defined in Futhark.Pass.Flatten.Distribute

Methods

pretty :: DistType -> Doc ann #

prettyList :: [DistType] -> Doc ann #

distInputType :: DistInput -> Type Source #

The type of a DistInput. This corresponds to the parameter type of the original map-nest.

newtype ResTag Source #

Constructors

ResTag Int 

Instances

Instances details
Show ResTag Source # 
Instance details

Defined in Futhark.Pass.Flatten.Distribute

Eq ResTag Source # 
Instance details

Defined in Futhark.Pass.Flatten.Distribute

Methods

(==) :: ResTag -> ResTag -> Bool #

(/=) :: ResTag -> ResTag -> Bool #

Ord ResTag Source # 
Instance details

Defined in Futhark.Pass.Flatten.Distribute

Pretty ResTag Source # 
Instance details

Defined in Futhark.Pass.Flatten.Distribute

Methods

pretty :: ResTag -> Doc ann #

prettyList :: [ResTag] -> Doc ann #

data DistIrregularity Source #

How to treat irregularity when classifying the statements of a distributed body. This is mainly used to sequentialise nonuniform nested parallelism instead of actually exploiting the parallelism, as the overhead of doing so can sometimes be ruinous.

Constructors

DistributeIrregular

Distribute statements involving irregularity, relying on the machinery for flattening irregular arrays to handle them.

SequentialiseIrregularBasicOps

Sequentialise BasicOps that involve only internal nonuniformity instead of distributing them. Used when generating intrablock code, where the machinery for flattening nonuniform nested parallelism would produce SegOps whose sizes are bound inside the kernel body, which makes the enclosing intrablock kernel infeasible (noNonuniformPar would reject it). Irregularity that escapes the enclosing map must still be distributed; if it occurs, the intrablock version is correctly rejected.

SequentialiseIrregularAll

Sequentialise any statement whose nonuniformity stays internal.

stmHasMeaningfulParallelism :: FunHasParallelism -> Stm SOACS -> Bool Source #

Does the statement contain meaningful parallelism - a SOAC or a call to a parallel function, possibly nested inside sequential control flow? Basic operations such as Iota or Replicate do not count. See Note [Meaningful Parallelism].

Segments

type Segments = [SubExp] Source #

Widths of the enclosing map-nest, outermost first. For top-level parallel constructs, this is empty, which should be treated as an implicit single-element segment (see segmentCount). Generally, the empty-segments case must be treated specially in some places, which is unfortunate, but it helps unify code between the nested and top level cases.