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

Map fusion transformation that fuses two sequential maps. More...

#include <sdfg/transformations/map_fusion.h>

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

Public Member Functions

 MapFusion (structured_control_flow::Map &first_map, structured_control_flow::StructuredLoop &second_loop, bool require_consecutive=true, bool allow_init_hoist=true, bool allow_prod_into_cons=true)
 Construct a map fusion transformation.
passes::loop_fusion::LoopFusionByAccessWorker::FusionDirection last_fusion_direction () const
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 fusion transformation.
virtual void to_json (nlohmann::json &j) const override
 Serialize this transformation to JSON.
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 MapFusion from_json (builder::StructuredSDFGBuilder &builder, const nlohmann::json &j)
 Deserialize a map fusion transformation from JSON.

Friends

class FusionConsumerUpdateVisitor

Additional Inherited Members

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

Detailed Description

Map fusion transformation that fuses two sequential maps.

This transformation fuses two sequential maps (children of the same sequence) when the second map reads from containers that are written by the first map.

Supports three patterns:

  • Pattern 1 (ProducerIntoConsumer): Both perfectly nested. Inlines producer into consumer.
  • Pattern 2 (ConsumerIntoProducer): Producer non-perfectly-nested, consumer perfectly nested. Inlines consumer blocks at the producer's write location to avoid replicating the producer's shallow sibling computations.
  • Reverse Pattern 2 (ProducerIntoConsumer): Producer perfectly nested, consumer non-perfectly-nested. Inlines producer blocks at the consumer's read location.

Constructor & Destructor Documentation

◆ MapFusion()

sdfg::transformations::MapFusion::MapFusion ( structured_control_flow::Map & first_map,
structured_control_flow::StructuredLoop & second_loop,
bool require_consecutive = true,
bool allow_init_hoist = true,
bool allow_prod_into_cons = true )

Construct a map fusion transformation.

Parameters
first_mapThe first map (producer) to be fused
second_loopThe second loop (consumer, can be Map or For) to be fused
require_consecutiveWhether the maps must be consecutive in the sequence for fusion to be applied
allow_init_hoistWhether Case 2 (init-into-reduction hoisting) may be applied
allow_prod_into_consAllow ProducerIntoConsumer fusions

Member Function Documentation

◆ apply()

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

Apply the map fusion transformation.

Inlines the producer computation from the first map into the second map, eliminating intermediate storage accesses.

Parameters
builderThe SDFG builder
analysis_managerThe analysis manager

Implements sdfg::transformations::Transformation.

◆ can_be_applied()

virtual bool sdfg::transformations::MapFusion::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.

◆ from_json()

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

Deserialize a map fusion transformation from JSON.

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

◆ last_fusion_direction()

passes::loop_fusion::LoopFusionByAccessWorker::FusionDirection sdfg::transformations::MapFusion::last_fusion_direction ( ) const

◆ name()

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

Get the name of this transformation.

Returns
"MapFusion"

Implements sdfg::transformations::Transformation.

◆ to_json()

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

Serialize this transformation to JSON.

Parameters
jJSON object to populate

Implements sdfg::transformations::Transformation.

◆ FusionConsumerUpdateVisitor

friend class FusionConsumerUpdateVisitor
friend

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