tile
Safe HaskellNone
LanguageGHC2024

Tile.Tree

Description

trees.

The pipeline converts a Tiling into a Schedule through a sequence of tree transformations:

decompositionTreecontractAnchorshopTreesendTree

The generic spine (Tree, unfoldTree, mapTree) is the common substrate for all four views.

Synopsis

Generic tree

data Tree a Source #

A rose tree: a label with an ordered list of subtrees.

Constructors

Tree 

Fields

Instances

Instances details
Eq a => Eq (Tree a) Source # 
Instance details

Defined in Tile.Tree

Methods

(==) :: Tree a -> Tree a -> Bool #

(/=) :: Tree a -> Tree a -> Bool #

Show a => Show (Tree a) Source # 
Instance details

Defined in Tile.Tree

Methods

showsPrec :: Int -> Tree a -> ShowS #

show :: Tree a -> String #

showList :: [Tree a] -> ShowS #

mapTree :: (a -> b) -> Tree a -> Tree b Source #

Apply a function to every label in a tree.

unfoldTree :: (a -> [a]) -> a -> Tree a Source #

Build a tree from a seed by repeatedly applying a child function.

treeLabels :: Ord a => Tree a -> Set a Source #

Collect every label in a tree.

treeIndex :: Ord a => Tree a -> Map a (Tree a) Source #

Index every subtree by its root label.

renderTreeWith :: (a -> String) -> Tree a -> String Source #

Render a tree as an ASCII box-drawing string.

Tile tree views

data DecompositionView Source #

Phantom type distinguishing a structural decomposition tree.

data HopView Source #

Phantom type distinguishing a hop tree.

newtype TileTree (view :: k) Source #

A tree of TileNodes tagged with a phantom view type to prevent mixing structurally distinct tree views.

Constructors

TileTree 

Instances

Instances details
Eq (TileTree view) Source # 
Instance details

Defined in Tile.Tree

Methods

(==) :: TileTree view -> TileTree view -> Bool #

(/=) :: TileTree view -> TileTree view -> Bool #

Show (TileTree view) Source # 
Instance details

Defined in Tile.Tree

Methods

showsPrec :: Int -> TileTree view -> ShowS #

show :: TileTree view -> String #

showList :: [TileTree view] -> ShowS #

type DecompositionTree = TileTree DecompositionView Source #

A structural decomposition tree: every node carries the full Relation metadata from its parent split.

type HopTree = TileTree HopView Source #

A hop tree: anchor nodes have been contracted; every edge is a communication hop.

newtype SendTree Source #

A tree of Tiles whose roots are the communication destinations. Each parent–child edge corresponds to one Step in the fault-free schedule.

Constructors

SendTree 

Fields

Instances

Instances details
Eq SendTree Source # 
Instance details

Defined in Tile.Tree

Show SendTree Source # 
Instance details

Defined in Tile.Tree

newtype RoutedTree a Source #

A tree of schedule members reconstructed from a RoutedSchedule.

Constructors

RoutedTree 

Fields

Instances

Instances details
Eq a => Eq (RoutedTree a) Source # 
Instance details

Defined in Tile.Tree

Methods

(==) :: RoutedTree a -> RoutedTree a -> Bool #

(/=) :: RoutedTree a -> RoutedTree a -> Bool #

Show a => Show (RoutedTree a) Source # 
Instance details

Defined in Tile.Tree

Tile pipeline

decompositionTree :: Tiling t => t -> Tile -> DecompositionTree Source #

Unfold the structural decomposition of a tile using childNodes. Every node in the result carries its Relation to its parent.

contractAnchors :: DecompositionTree -> HopTree Source #

Convert a DecompositionTree into a HopTree by contracting anchor edges. Anchor nodes are spliced out and their sibling descendants promoted; the result contains only communication hops.

hopTree :: Tiling t => t -> Tile -> HopTree Source #

Build the hop tree for a tile: structural decomposition followed by anchor contraction.

hopTree = contractAnchors . decompositionTree

sendTree :: Tiling t => t -> Tile -> SendTree Source #

Project a HopTree to a tree of communication-root Tiles.

children :: Tiling t => t -> Tile -> [Tile] Source #

Direct communication children of a tile: the roots of the subtiles in its SendTree.

Schedule trees

scheduleTree :: Ord a => a -> Schedule a -> RoutedTree a Source #

Reconstruct a broadcast tree from a schedule by following sender-to-receiver edges in adjacencyList order.

Rendering

renderDecompositionTree :: [String] -> DecompositionTree -> String Source #

Render a DecompositionTree with numbered tile nodes.

renderHopTree :: [String] -> HopTree -> String Source #

Render a HopTree showing each tile's member set.

renderSendTree :: [String] -> SendTree -> String Source #

Render a SendTree showing each tile's communication root.