dependencygraph2

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2018 License: Apache-2.0 Imports: 16 Imported by: 21

Documentation

Index

Constants

View Source
const NodeNoID = NodeID(math.MaxUint32)

Variables

This section is empty.

Functions

func DCECapture

func DCECapture(ctx context.Context, name string, p *path.Capture, requestedCmds []*path.Command) (*path.Capture, error)

DCECapture returns a new capture containing only the requested commands and their dependencies.

Types

type CloseForwardDependencyEffect

type CloseForwardDependencyEffect struct {
	NodeID       NodeID
	DependencyID interface{}
}

CloseForwardDependencyEffect is a record of the *closing* of a forward dependency. See OpenForwardDependencyEffect above.

func (CloseForwardDependencyEffect) GetNodeID

func (e CloseForwardDependencyEffect) GetNodeID() NodeID

GetNodeID returns the dependency graph node associated with this effect

type CmdNode

type CmdNode struct {
	Index api.SubCmdIdx
}

CmdNode is a dependency node corresponding to an API call

type DCEBuilder

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

DCEBuilder tracks the data necessary to perform dead-command-eliminition on a capture

func NewDCEBuilder

func NewDCEBuilder(graph DependencyGraph) *DCEBuilder

NewDCEBuilder creates a new DCEBuiler using the specified dependency graph

func (*DCEBuilder) Build

func (b *DCEBuilder) Build(ctx context.Context) error

Build runs the dead-code-elimination. The subcommands specified in cmds are marked alive, along with their transitive dependencies.

func (*DCEBuilder) Flush

func (b *DCEBuilder) Flush(ctx context.Context, out transform.Writer)

Flush is to comform the interface of Transformer. Flush performs DCE, and sends the live commands to the writer

func (*DCEBuilder) LiveCmdID

func (b *DCEBuilder) LiveCmdID(oldCmdID api.CmdID) api.CmdID

LiveCmdID maps CmdIDs from the original capture to CmdIDs in within the live commands. If the old CmdID refers to a dead command, the returned command will refer to the next live command; if there is no next live command, api.CmdNoID is returned.

func (*DCEBuilder) LiveCmds

func (b *DCEBuilder) LiveCmds() []api.Cmd

LiveCmds returns the live commands

func (*DCEBuilder) LogStats

func (b *DCEBuilder) LogStats(ctx context.Context)

func (*DCEBuilder) NumLiveInitCmds

func (b *DCEBuilder) NumLiveInitCmds() int

NumLiveInitiCmds returns the number of live commands which are initial commands. (Initial commands are generated commands to recreate the initial state).

func (*DCEBuilder) OriginalCmdID

func (b *DCEBuilder) OriginalCmdID(liveCmdID api.CmdID) api.CmdID

OriginalCmdIDs maps a live CmdID to the CmdID of the corresponding command in the original capture

func (*DCEBuilder) Request

func (b *DCEBuilder) Request(ctx context.Context, fci api.SubCmdIdx) error

Request added a requsted command or subcommand, represented by its full command index, to the DCE.

func (*DCEBuilder) Transform

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

Transform is to comform the interface of Transformer, but does not accept any input.

type DependencyGraph

type DependencyGraph interface {

	// NumNodes returns the number of nodes in the graph
	NumNodes() int

	// NumDependencies returns the number of dependencies (edges) in the graph
	NumDependencies() uint64

	// GetNode returns the node data associated with the given NodeID
	GetNode(NodeID) Node

	// GetNodeID returns the NodeID associated with given node data
	GetNodeID(Node) NodeID

	// ForeachCmd iterates over all API calls in the graph.
	// If IncludeInitialCommands is true, this includes the initial commands
	// which reconstruct the initial state.
	// CmdIDs for initial commands are:
	//   CmdID(0).Derived(), CmdID(1).Derived(), ...
	// Whether or not IncludeInitialCommands is true, the CmdIDs for captured
	// commands are: 0, 1, 2, ...
	ForeachCmd(ctx context.Context,
		cb func(context.Context, api.CmdID, api.Cmd) error) error

	// ForeachNode iterates over all nodes in the graph in chronological order.
	// I.e., the following order:
	//   * For each initial command
	//     * Read observation nodes for this command
	//     * command node
	//     * Write observation nodes for this command
	//   * For each (non-initial) command
	//     * Read observation nodes for this command
	//     * command node
	//     * Write observation nodes for this command
	ForeachNode(cb func(NodeID, Node) error) error

	// ForeachDependency iterates over all pairs (src, tgt), where src depends on tgt
	ForeachDependency(cb func(NodeID, NodeID) error) error

	// ForeachDependencyFrom iterates over all the nodes tgt, where src depends on tgt
	ForeachDependencyFrom(src NodeID, cb func(NodeID) error) error

	// ForeachDependencyTo iterates over all the nodes src, where src depends on tgt.
	// If Config().ReverseDependencies is false, this will return an error.
	ForeachDependencyTo(tgt NodeID, cb func(NodeID) error) error

	// Capture returns the capture whose dependencies are stored in this graph
	Capture() *capture.Capture

	// GetCommand returns the command identified by the given CmdID
	GetCommand(api.CmdID) api.Cmd

	// NumInitialCommands returns the number of initial commands
	// (the commands needed to reconstruct the initial state before the
	// first command in the capture)
	NumInitialCommands() int

	// Config returns the config used to create this graph
	Config() DependencyGraphConfig
}

DependencyGraph stores the dependencies among api calls and memory observations,

func BuildDependencyGraph

func BuildDependencyGraph(ctx context.Context, config DependencyGraphConfig,
	c *capture.Capture, initialCmds []api.Cmd, initialRanges interval.U64RangeList) (DependencyGraph, error)

func GetDependencyGraph

func GetDependencyGraph(ctx context.Context, c *path.Capture, config DependencyGraphConfig) (DependencyGraph, error)

type DependencyGraphConfig

type DependencyGraphConfig struct {
	// MergeSubCmdNodes indicates whether the graph should have one node per
	// command (true), or a separate node for each subcommand (false)
	MergeSubCmdNodes bool

	// IncludeInitialCommands indicates whether nodes should be created for
	// the initial (state rebuild) commands
	IncludeInitialCommands bool

	// ReverseDependencies indicates whether reverse edges should be created
	ReverseDependencies bool
}

Information about what sort of data to store in a dependency graph

type Effect

type Effect interface {
	// GetNodeID returns the dependency graph node associated with this effect
	GetNodeID() NodeID
	// contains filtered or unexported methods
}

Effect is a record of a read or write of a piece of state.

type FragmentEffect

type FragmentEffect interface {
	Effect
	// GetFragment returns the Fragment which is read or written by this effect
	GetFragment() api.Fragment
}

type Node

type Node interface {
	// contains filtered or unexported methods
}

Node represents a node in the dependency graph, and holds data about the associated command or memory observation.

type NodeID

type NodeID uint32

NodeID identifies a node in a dependency graph

type ObsNode

type ObsNode struct {
	CmdObservation api.CmdObservation
	CmdID          api.CmdID
	IsWrite        bool
	Index          int
}

ObsNode is a dependency node corresponding to a memory observation

type OpenForwardDependencyEffect

type OpenForwardDependencyEffect struct {
	NodeID       NodeID
	DependencyID interface{}
}

OpenForwardDependencyEffect is a record of the *opening* of a forward dependency. The opening effect must occur before the corresponding *closing* effect (represented by CloseForwardDependencyEffect); the opening node associated with the opening of the foward dependency will depend on the node associated with the closing. E.g. vkAcquireNextImageKHR opens a foward dependency, which is closed by the corresponding vkQueuePresentKHR call.

func (OpenForwardDependencyEffect) GetNodeID

func (e OpenForwardDependencyEffect) GetNodeID() NodeID

GetNodeID returns the dependency graph node associated with this effect

type ReadEffect

type ReadEffect interface {
	Effect
	// contains filtered or unexported methods
}

ReadEffect is a record of a read of a piece of state.

type ReadFragmentEffect

type ReadFragmentEffect struct {
	NodeID   NodeID
	Fragment api.Fragment
}

ReadFragmentEffect is a record of a read of a piece of state in the state graph (as opposed to a memory range)

func (ReadFragmentEffect) GetFragment

func (e ReadFragmentEffect) GetFragment() api.Fragment

GetFragment returns the Fragment which is read or written by this effect

func (ReadFragmentEffect) GetNodeID

func (e ReadFragmentEffect) GetNodeID() NodeID

GetNodeID returns the dependency graph node associated with this effect

type ReadMemEffect

type ReadMemEffect struct {
	NodeID NodeID
	Slice  memory.Slice
}

ReadMemEffect is a record of a read of a memory range (either application or device memory)

func (ReadMemEffect) GetNodeID

func (e ReadMemEffect) GetNodeID() NodeID

GetNodeID returns the dependency graph node associated with this effect

type ReverseEffect

type ReverseEffect interface {
	Effect
	// contains filtered or unexported methods
}

ReverseEffect is a record of an effect whose dependency goes in both directions (read <-> write)

type WriteEffect

type WriteEffect interface {
	Effect
	// contains filtered or unexported methods
}

WriteEffect is a record of a write of a piece of state.

type WriteFragmentEffect

type WriteFragmentEffect struct {
	NodeID   NodeID
	Fragment api.Fragment
}

WriteFragmentEffect is a record of a write to a piece of state in the state graph (as opposed to a memory range)

func (WriteFragmentEffect) GetFragment

func (e WriteFragmentEffect) GetFragment() api.Fragment

GetFragment returns the Fragment which is read or written by this effect

func (WriteFragmentEffect) GetNodeID

func (e WriteFragmentEffect) GetNodeID() NodeID

GetNodeID returns the dependency graph node associated with this effect

type WriteMemEffect

type WriteMemEffect struct {
	NodeID NodeID
	Slice  memory.Slice
}

WriteMemEffect is a record of a write to a memory range (either application or device memory)

func (WriteMemEffect) GetNodeID

func (e WriteMemEffect) GetNodeID() NodeID

GetNodeID returns the dependency graph node associated with this effect

Jump to

Keyboard shortcuts

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