accelforge.plotting package#
Submodules#
accelforge.plotting.accesstrace module#
Plot which tensor elements a LoopTree mapping touches at each timestep.
The x-axis is the timestep (one iteration of the innermost temporal loop) and the y-axis is the tensor element being accessed, so the shape of the scatter is the mapping’s data movement: horizontal streaks are elements held across many timesteps, diagonal sweeps are streaming accesses, and repeated blocks are refetches.
Passing memory_level= additionally shades, behind the points, the tile that level
holds at each timestep, which turns the same picture into a read on that level’s
capacity: a wide block is a long-lived tile, and a tall one is a large tile. Blocks show
live residency, i.e. they stop at the tile’s last use rather than running to the end of
whatever the mapping reserved.
- accelforge.plotting.accesstrace.plot_access_trace(trace, workload=None, tensors=None, color_by='einsum', rank=None, memory_level=None, level_color=_TILE_COLOR, marker_size=None, ncols=1, ax=None, figsize=None, **trace_kwargs)[source]#
Plot timestep (x) against accessed tensor element (y) for a LoopTree mapping.
One subplot is drawn per tensor, sharing the timestep axis, so that fusion and reuse across tensors line up vertically.
- Parameters:
trace – An
AccessTrace, or anythingtrace_accesses()accepts (aSpec, a mapper result, or aMapping).workload – The workload, required only when
traceis a bareMapping.tensors (
Iterable[str] |None) – Which tensors to plot, and in what order. Defaults to every traced tensor.color_by (
str) –"einsum"colors accesses by which Einsum made them;"access"colors by read vs. write. Use"access"when many Einsums share one tensor.rank (
str|None) – Plot the coordinate along this tensor rank on the y-axis instead of the flattened element index. Only applies to tensors that have this rank.memory_level (
str|None) – Shade, in a background block, the tile of each tensor that is resident in this memory level (a storage component of the architecture, e.g."GlobalBuffer"). One block covers one tile: its width is how long the tile is live – from its first touch to its last, not the whole span the mapping reserves for it – and its height is which elements it holds, so the blocks show directly what a level is holding while the points show what is being touched. Tensors that this level never holds are left unshaded.level_color (
str) – The background color of thememory_levelblocks.marker_size (
float|None) – Marker size in points. Chosen from the data density if not given.ncols (
int) – Number of subplot columns.ax – Draw into this existing axes instead of making a figure. Only valid when a single tensor is being plotted.
figsize – Figure size. Scaled to the number of subplots if not given.
**trace_kwargs – Passed to
trace_accesses()whentraceis not already anAccessTrace(e.g.max_timesteps=,einsums=,max_points=).
- Returns:
The figure and a list of the axes drawn into.
- Return type:
(fig, axes)
accelforge.plotting.latency module#
Latency timelines showing how per-component latency overlaps across Einsums.
- accelforge.plotting.latency.plot_latency(spec, mappings=None, ax=None)[source]#
Plots a latency timeline. Time is on the X axis, and component on the Y axis. Component latencies may be divided across multiple shared loop levels, and shared latencies may overlap across Einsums. Private latencies do not get a loop level.
- Parameters:
spec – The spec to plot.
mappings (
Mappings) – The mapping to plot. Must hold exactly one mapping. If not given, uses spec.mapping.ax (
Axes) – The axes to plot on. If not given, creates a new figure and axes.
- Return type:
tuple[Figure,Axes]- Returns:
fig – The figure containing the plot.
ax – The axes containing the plot.
accelforge.plotting.mappings module#
accelforge.plotting.roofline module#
- accelforge.plotting.roofline.plot_roofline(bandwidth, computational_throughput, min_computational_intensity=0, max_computational_intensity=None)[source]#
Plot a roofline model.
- Parameters:
bandwidth (
Number) – The memory bandwidth to use when generating the roofline.computational_throughput (
Number) – The peak computational throughput to use when generating the roofline.min_computational_intensity (
Number) – The minimum computational intensity to include in the x-axis.max_computational_intensity (
Number) – The maximum computational intensity to include in the x-axis.
accelforge.plotting.skislope module#
accelforge.plotting.specs module#
Module contents#
- accelforge.plotting.plot_access_trace(trace, workload=None, tensors=None, color_by='einsum', rank=None, memory_level=None, level_color=_TILE_COLOR, marker_size=None, ncols=1, ax=None, figsize=None, **trace_kwargs)[source]#
Plot timestep (x) against accessed tensor element (y) for a LoopTree mapping.
One subplot is drawn per tensor, sharing the timestep axis, so that fusion and reuse across tensors line up vertically.
- Parameters:
trace – An
AccessTrace, or anythingtrace_accesses()accepts (aSpec, a mapper result, or aMapping).workload – The workload, required only when
traceis a bareMapping.tensors (
Iterable[str] |None) – Which tensors to plot, and in what order. Defaults to every traced tensor.color_by (
str) –"einsum"colors accesses by which Einsum made them;"access"colors by read vs. write. Use"access"when many Einsums share one tensor.rank (
str|None) – Plot the coordinate along this tensor rank on the y-axis instead of the flattened element index. Only applies to tensors that have this rank.memory_level (
str|None) – Shade, in a background block, the tile of each tensor that is resident in this memory level (a storage component of the architecture, e.g."GlobalBuffer"). One block covers one tile: its width is how long the tile is live – from its first touch to its last, not the whole span the mapping reserves for it – and its height is which elements it holds, so the blocks show directly what a level is holding while the points show what is being touched. Tensors that this level never holds are left unshaded.level_color (
str) – The background color of thememory_levelblocks.marker_size (
float|None) – Marker size in points. Chosen from the data density if not given.ncols (
int) – Number of subplot columns.ax – Draw into this existing axes instead of making a figure. Only valid when a single tensor is being plotted.
figsize – Figure size. Scaled to the number of subplots if not given.
**trace_kwargs – Passed to
trace_accesses()whentraceis not already anAccessTrace(e.g.max_timesteps=,einsums=,max_points=).
- Returns:
The figure and a list of the axes drawn into.
- Return type:
(fig, axes)