dependencygraph

package
v0.0.0-...-15b4445 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const NullStateAddress = StateAddress(0)

Variables

This section is empty.

Functions

This section is empty.

Types

type BehaviourProvider

type BehaviourProvider interface {
	GetBehaviourForCommand(context.Context, *api.GlobalState, api.CmdID, api.Cmd, *DependencyGraph) CmdBehaviour
}

type CmdBehaviour

type CmdBehaviour struct {
	Reads     []StateAddress // States read by a command.
	Modifies  []StateAddress // States read and written by a command.
	Writes    []StateAddress // States written by a command.
	Roots     []StateAddress // States labeled as root by a command.
	KeepAlive bool           // Force the command to be live.
	Aborted   bool           // Mutation of this command aborts.
}

func (*CmdBehaviour) Modify

func (b *CmdBehaviour) Modify(g *DependencyGraph, state StateKey)

func (*CmdBehaviour) Read

func (b *CmdBehaviour) Read(g *DependencyGraph, state StateKey)

func (*CmdBehaviour) Write

func (b *CmdBehaviour) Write(g *DependencyGraph, state StateKey)

type DeadCodeElimination

type DeadCodeElimination struct {
	KeepAllAlive bool
	// contains filtered or unexported fields
}

DeadCodeElimination is an implementation of Transformer that outputs live commands. That is, all commands which do not affect the requested output are omitted. It is named after the standard compiler optimization. (state is like memory and commands are instructions which read/write it). Construct with NewDeadCodeElimination, do not build directly.

func NewDeadCodeElimination

func NewDeadCodeElimination(ctx context.Context, depGraph *DependencyGraph) *DeadCodeElimination

NewDeadCodeElimination constructs and returns a new DeadCodeElimination transform.

The transform generates commands from the given depGraph, it does not take inputs.

func (*DeadCodeElimination) BuffersCommands

func (t *DeadCodeElimination) BuffersCommands() bool

func (*DeadCodeElimination) Flush

func (*DeadCodeElimination) PostLoop

func (t *DeadCodeElimination) PostLoop(ctx context.Context, out transform.Writer)

func (*DeadCodeElimination) PreLoop

func (t *DeadCodeElimination) PreLoop(ctx context.Context, out transform.Writer)

func (*DeadCodeElimination) Request

func (t *DeadCodeElimination) Request(id api.CmdID)

Request ensures that we keep alive all commands needed to render framebuffer at the given point.

func (*DeadCodeElimination) Transform

func (t *DeadCodeElimination) Transform(ctx context.Context, id api.CmdID, c api.Cmd, out transform.Writer) error

type DependencyGraph

type DependencyGraph struct {
	// Number of generated commands in 'Commands' which build the initial state.
	NumInitialCommands int

	Commands   []api.Cmd             // Command list which this graph was build for.
	Behaviours []CmdBehaviour        // State reads/writes for each command (graph edges).
	Roots      map[StateAddress]bool // State to mark live at requested commands.
	// contains filtered or unexported fields
}

func GetDependencyGraph

func GetDependencyGraph(ctx context.Context, device *path.Device) (*DependencyGraph, error)

func (*DependencyGraph) GetCmdID

func (g *DependencyGraph) GetCmdID(cmdIndex int) api.CmdID

GetCmdID returns the CmdID for given element in the Commands slice.

func (*DependencyGraph) GetHierarchyStateMap

func (g *DependencyGraph) GetHierarchyStateMap() map[StateAddress]StateAddress

func (*DependencyGraph) GetStateAddressOf

func (g *DependencyGraph) GetStateAddressOf(key StateKey) StateAddress

func (*DependencyGraph) Print

func (g *DependencyGraph) Print(ctx context.Context, b *CmdBehaviour)

func (*DependencyGraph) SetRoot

func (g *DependencyGraph) SetRoot(key StateKey)

type DependencyGraphBehaviourProvider

type DependencyGraphBehaviourProvider interface {
	GetDependencyGraphBehaviourProvider(ctx context.Context) BehaviourProvider
}

type LivenessTree

type LivenessTree struct {
	// contains filtered or unexported fields
}

LivenessTree assigns boolean value to each state (live or dead). Think of each node as memory range, with children being sub-ranges.

func NewLivenessTree

func NewLivenessTree(parents map[StateAddress]StateAddress) LivenessTree

NewLivenessTree creates a new tree. The parent map defines parent for each node, and it must be continuous with no gaps.

func (*LivenessTree) IsLive

func (l *LivenessTree) IsLive(address StateAddress) bool

IsLive returns true if the state, or any of its descendants, are live.

func (*LivenessTree) MarkDead

func (l *LivenessTree) MarkDead(address StateAddress)

MarkDead makes the given state, and all of its descendants, dead.

func (*LivenessTree) MarkLive

func (l *LivenessTree) MarkLive(address StateAddress)

MarkLive makes the given state, and all of its descendants, live.

type StateAddress

type StateAddress uint32

type StateKey

type StateKey interface {
	// Parent returns enclosing state (and this state is strict subset of it).
	// This allows efficient implementation of operations which access a lot state.
	Parent() StateKey
}

StateKey uniquely represents part of the GL state. Think of it as memory range (which stores the state data).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL