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

Collapse a perfectly-nested map nest into a target number of loops. More...

#include <sdfg/transformations/collapse_to_depth.h>

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

Public Member Functions

 CollapseToDepth (structured_control_flow::Map &loop, size_t target_loops)
 Construct a collapse to depth 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 safely applied.
virtual void apply (builder::StructuredSDFGBuilder &builder, analysis::AnalysisManager &analysis_manager) override
 Apply this transformation to the SDFG.
virtual void to_json (nlohmann::json &j) const override
 Serialize this transformation to JSON.
structured_control_flow::Map * outer_loop ()
 Get the outer collapsed loop (or the single loop when target_loops == 1).
structured_control_flow::Map * inner_loop ()
 Get the inner collapsed loop (nullptr when target_loops == 1).
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 CollapseToDepth from_json (builder::StructuredSDFGBuilder &builder, const nlohmann::json &j)

Additional Inherited Members

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

Detailed Description

Collapse a perfectly-nested map nest into a target number of loops.

Given an outermost map of a perfectly-nested map chain and a target loop count (1 or 2), this transformation collapses the nest:

  • target_loops == 1: all maps are collapsed into a single map.
  • target_loops == 2: the nest is split into an outer half and an inner half, each collapsed separately. For an odd number of maps the outer half includes the middle loop.
Note
Delegates to MapCollapse for each individual collapse step.

Constructor & Destructor Documentation

◆ CollapseToDepth()

sdfg::transformations::CollapseToDepth::CollapseToDepth ( structured_control_flow::Map & loop,
size_t target_loops )

Construct a collapse to depth transformation.

Parameters
loopThe outermost map of the nest to collapse
target_loopsNumber of resulting loops (1 or 2)

Member Function Documentation

◆ apply()

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

Apply this transformation to the SDFG.

Parameters
builderThe SDFG builder
analysis_managerThe analysis manager (may be invalidated)

Implements sdfg::transformations::Transformation.

◆ can_be_applied()

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

Check if this transformation can be safely applied.

Parameters
builderThe SDFG builder
analysis_managerThe analysis manager providing necessary analyses
Returns
true if all preconditions are met

Implements sdfg::transformations::Transformation.

◆ from_json()

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

◆ inner_loop()

structured_control_flow::Map * sdfg::transformations::CollapseToDepth::inner_loop ( )

Get the inner collapsed loop (nullptr when target_loops == 1).

◆ name()

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

Get the name of this transformation.

Returns
The transformation name (e.g., "LoopInterchange")

Implements sdfg::transformations::Transformation.

◆ outer_loop()

structured_control_flow::Map * sdfg::transformations::CollapseToDepth::outer_loop ( )

Get the outer collapsed loop (or the single loop when target_loops == 1).

◆ to_json()

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

Serialize this transformation to JSON.

Parameters
jJSON object to populate with transformation description
Exceptions
std::logic_errorif not implemented

Implements sdfg::transformations::Transformation.


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