tilelang.tools.plot_layout¶

Functions¶

plot_layout(layout[, save_directory, name, colormap, ...])

Plot the layout mapping as a 2D grid visualization.

plot_fragment_tv(frag[, save_directory, name, ...])

Plot fragment in terms of thread and local index mapping.

Module Contents¶

tilelang.tools.plot_layout.plot_layout(layout, save_directory='./tmp', name='layout', colormap=None, verbose=False, formats='pdf')¶

Plot the layout mapping as a 2D grid visualization.

Dispatches to Fragment-specific or Layout-specific plotting based on the type of the layout object.

Parameters:
  • layout (T.Layout or T.Fragment) – The layout object to visualize.

  • save_directory (str, optional) – Output directory (default “./tmp”).

  • name (str, optional) – Base filename for saved images (default “layout”).

  • colormap (str, optional) – Matplotlib colormap name. Defaults to “RdPu” for Fragment, “Spectral” for Layout.

  • verbose (bool, optional) – If True, print mapping details.

  • formats (str | list[str], optional) – Output format(s): “pdf”, “png”, “svg”, “all”, or comma-separated (default “pdf”).

Return type:

None

tilelang.tools.plot_layout.plot_fragment_tv(frag, save_directory=None, name='layout', apply_idx_fn=lambda *args: ..., colormap='RdPu', item_scale=0.75, formats='pdf', dpi=80)¶

Plot fragment in terms of thread and local index mapping. :param frag: The fragment object that describes how indices are mapped. :type frag: T.Fragment :param save_directory: The directory where the output images will be saved. :type save_directory: str | None, optional :param name: The base name of the output files (default is “layout”). :type name: str, optional :param apply_idx_fn: A function to apply to the source indices for labeling (default is identity). :type apply_idx_fn: function, optional :param colormap: The colormap to use for visualization (default is “RdPu”). :type colormap: str, optional :param item_scale: The scale factor for each item in the plot (default is 0.75). :type item_scale: float, optional :param formats: The formats to save the image in (default is “pdf”). :type formats: str | list[str], optional :param dpi: The resolution in dots per inch for the saved image (default is 80). :type dpi: int, optional

Parameters:
  • frag (tilelang.language.Fragment)

  • save_directory (str | None)

  • name (str)

  • colormap (str)

  • item_scale (float)

  • formats (str | list[str])