docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
sdfg::tiles::LocalityPlan Class Reference

How a tile relates to its enclosing parallel loop nest, and the storage space that relationship demands. More...

#include <sdfg/tiles/locality.h>

Public Member Functions

 LocalityPlan ()=default
 LocalityPlan (std::vector< TileAxis > axes, bool loop_is_outermost=false, bool loop_has_scratchpad=false, bool has_scratchpad_descendant=false, bool enclosing_cooperative=false)
 Construct a plan from known axes and loop-context flags (e.g.
const std::vector< TileAxis > & axes () const
bool loop_is_outermost () const
bool loop_has_scratchpad () const
bool has_scratchpad_descendant () const
bool enclosing_cooperative () const
bool inside_scratchpad_scope () const
 True when a scratchpad-scheduled axis encloses us (we are inside a device kernel).
bool has_scratchpad_cooperative () const
 True when any cooperative scratchpad axis exists (threads share the tile on-chip).
bool has_cooperative_at (Level level) const
 True when a cooperative scratchpad axis at level exists.
bool has_global_cooperative () const
 True when a cooperative axis backed only by global memory exists (no private stack fits: a host-parallel shared operand).
std::vector< TileAxis > private_axes () const
 The scratchpad per-thread axes (indvar in a tile base) — each owns a buffer slot.
std::vector< TileAxis > cooperative_axes () const
 The scratchpad cooperative axes (the shared/copy parallelism axes).
std::optional< Space > required_space (bool container_written) const
 The memory space this tile must be staged in, or std::nullopt when the schedule cannot be safely localized.

Static Public Member Functions

static LocalityPlan analyze (structured_control_flow::StructuredLoop &loop, const std::vector< TileAxis > &axes, analysis::AnalysisManager &analysis_manager)
 Analyze the placement of a tile with the given axes at loop (TileAxis::enclosing produces the axes; Tile::placement is the usual entry).

Detailed Description

How a tile relates to its enclosing parallel loop nest, and the storage space that relationship demands.

A LocalityPlan is the tile's parallel TileAxis partition plus a few loop-context flags; required_space maps it to the memory Space a localizing transformation must stage the tile in (or std::nullopt when the schedule cannot be safely localized). Build one with Tile::placement, or directly with LocalityPlan::analyze.

Constructor & Destructor Documentation

◆ LocalityPlan() [1/2]

sdfg::tiles::LocalityPlan::LocalityPlan ( )
default

◆ LocalityPlan() [2/2]

sdfg::tiles::LocalityPlan::LocalityPlan ( std::vector< TileAxis > axes,
bool loop_is_outermost = false,
bool loop_has_scratchpad = false,
bool has_scratchpad_descendant = false,
bool enclosing_cooperative = false )
inline

Construct a plan from known axes and loop-context flags (e.g.

for tests or callers that already have the facts); analyze derives the flags instead.

Member Function Documentation

◆ analyze()

LocalityPlan sdfg::tiles::LocalityPlan::analyze ( structured_control_flow::StructuredLoop & loop,
const std::vector< TileAxis > & axes,
analysis::AnalysisManager & analysis_manager )
static

Analyze the placement of a tile with the given axes at loop (TileAxis::enclosing produces the axes; Tile::placement is the usual entry).

Fills the loop-context flags from the surrounding nest.

◆ axes()

const std::vector< TileAxis > & sdfg::tiles::LocalityPlan::axes ( ) const
inline

◆ cooperative_axes()

std::vector< TileAxis > sdfg::tiles::LocalityPlan::cooperative_axes ( ) const

The scratchpad cooperative axes (the shared/copy parallelism axes).

◆ enclosing_cooperative()

bool sdfg::tiles::LocalityPlan::enclosing_cooperative ( ) const
inline

◆ has_cooperative_at()

bool sdfg::tiles::LocalityPlan::has_cooperative_at ( Level level) const

True when a cooperative scratchpad axis at level exists.

◆ has_global_cooperative()

bool sdfg::tiles::LocalityPlan::has_global_cooperative ( ) const

True when a cooperative axis backed only by global memory exists (no private stack fits: a host-parallel shared operand).

◆ has_scratchpad_cooperative()

bool sdfg::tiles::LocalityPlan::has_scratchpad_cooperative ( ) const

True when any cooperative scratchpad axis exists (threads share the tile on-chip).

◆ has_scratchpad_descendant()

bool sdfg::tiles::LocalityPlan::has_scratchpad_descendant ( ) const
inline

◆ inside_scratchpad_scope()

bool sdfg::tiles::LocalityPlan::inside_scratchpad_scope ( ) const

True when a scratchpad-scheduled axis encloses us (we are inside a device kernel).

◆ loop_has_scratchpad()

bool sdfg::tiles::LocalityPlan::loop_has_scratchpad ( ) const
inline

◆ loop_is_outermost()

bool sdfg::tiles::LocalityPlan::loop_is_outermost ( ) const
inline

◆ private_axes()

std::vector< TileAxis > sdfg::tiles::LocalityPlan::private_axes ( ) const

The scratchpad per-thread axes (indvar in a tile base) — each owns a buffer slot.

◆ required_space()

std::optional< Space > sdfg::tiles::LocalityPlan::required_space ( bool container_written) const

The memory space this tile must be staged in, or std::nullopt when the schedule cannot be safely localized.

  • Register — thread-private / sequential buffer (also a CPU stack buffer).
  • Shared — block-shared GPU buffer.
  • Global — grid-wide GPU buffer.

A cooperative CPU read tile replicates privately (Register); a cooperative write is a reduction/race and declines. A cooperative GPU read tile follows the coarsest cooperative level; warp-only cooperation is served by shuffles (declines).


The documentation for this class was generated from the following file: