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

Map collapse transformation. More...

#include <sdfg/transformations/map_collapse.h>

Inheritance diagram for sdfg::transformations::MapCollapse:
[legend]

Public Member Functions

 MapCollapse (structured_control_flow::Map &loop, size_t count)
 Construct a map collapse transformation.
virtual std::string name () const override
 Get the name of this transformation.
virtual bool can_be_applied (builder::StructuredSDFGBuilder &builder, analysis::AnalysisManager &analysis_manager) override
 Check if this transformation can be applied.
virtual void apply (builder::StructuredSDFGBuilder &builder, analysis::AnalysisManager &analysis_manager) override
 Apply the map collapse transformation.
virtual void to_json (nlohmann::json &j) const override
 Serialize this transformation to JSON.
structured_control_flow::Map * collapsed_loop ()
 Get the resulting collapsed map after the transformation has been applied.
Public Member Functions inherited from sdfg::transformations::Transformation
virtual ~Transformation ()=default
virtual void set_report (PassReportConsumer *report)
 Set the report consumer for transformation feedback.
virtual bool try_apply (builder::StructuredSDFGBuilder &builder, analysis::AnalysisManager &analysis_manager)
 Attempt to apply the transformation if possible.

Static Public Member Functions

static MapCollapse from_json (builder::StructuredSDFGBuilder &builder, const nlohmann::json &j)
 Deserialize a map collapse transformation from JSON.

Additional Inherited Members

Protected Attributes inherited from sdfg::transformations::Transformation
PassReportConsumer * report_ = nullptr

Detailed Description

Map collapse transformation.

This transformation collapses tightly-nested maps into a single flat map, increasing the iteration space and exposing more parallelism.

Two modes are supported:

  • Perfect nesting: count perfectly-nested maps are flattened into one map using a product iteration space and modulo/division index recovery.
  • Imperfect nesting (CUDA-kernel style, count == 2): the outer map's body may contain several sibling maps and other "skipped" control-flow elements. The flattened inner extent is the maximum of all sibling-map bounds; each sibling map body is guarded by inner_idx < bound_i and each skipped element is guarded by inner_idx == 0 (executed once per outer iteration).
Note
The outermost map of the nest is passed as loop
count must be >= 2

Constructor & Destructor Documentation

◆ MapCollapse()

sdfg::transformations::MapCollapse::MapCollapse ( structured_control_flow::Map & loop,
size_t count )

Construct a map collapse transformation.

Parameters
loopThe outermost map of the nest to collapse
countThe number of maps to collapse (must be >= 2)

Member Function Documentation

◆ apply()

virtual void sdfg::transformations::MapCollapse::apply ( builder::StructuredSDFGBuilder & builder,
analysis::AnalysisManager & analysis_manager )
overridevirtual

Apply the map collapse transformation.

Parameters
builderThe SDFG builder
analysis_managerThe analysis manager

Implements sdfg::transformations::Transformation.

◆ can_be_applied()

virtual bool sdfg::transformations::MapCollapse::can_be_applied ( builder::StructuredSDFGBuilder & builder,
analysis::AnalysisManager & analysis_manager )
overridevirtual

Check if this transformation can be applied.

Parameters
builderThe SDFG builder
analysis_managerThe analysis manager
Returns
true if the transformation can be applied safely

Implements sdfg::transformations::Transformation.

◆ collapsed_loop()

structured_control_flow::Map * sdfg::transformations::MapCollapse::collapsed_loop ( )

Get the resulting collapsed map after the transformation has been applied.

◆ from_json()

MapCollapse sdfg::transformations::MapCollapse::from_json ( builder::StructuredSDFGBuilder & builder,
const nlohmann::json & j )
static

Deserialize a map collapse transformation from JSON.

Parameters
builderThe SDFG builder
jJSON description of the transformation
Returns
The deserialized transformation

◆ name()

virtual std::string sdfg::transformations::MapCollapse::name ( ) const
overridevirtual

Get the name of this transformation.

Returns
"MapCollapse"

Implements sdfg::transformations::Transformation.

◆ to_json()

virtual void sdfg::transformations::MapCollapse::to_json ( nlohmann::json & j) const
overridevirtual

Serialize this transformation to JSON.

Parameters
jJSON object to populate

Implements sdfg::transformations::Transformation.


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