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

Records transformation history for replay and analysis. More...

#include <sdfg/transformations/recorder.h>

Public Member Functions

 Recorder ()
 Construct an empty recorder.
virtual ~Recorder ()=default
bool record (Transformation &transformation, builder::StructuredSDFGBuilder &builder, analysis::AnalysisManager &analysis_manager, bool skip_if_not_applicable=false)
 Apply an already-constructed transformation and record it.
template<typename T, typename... Args>
requires transformation_concept<T>
void apply (builder::StructuredSDFGBuilder &builder, analysis::AnalysisManager &analysis_manager, bool skip_if_not_applicable, Args &&... args)
 Construct a transformation from args and record it.
void save (std::filesystem::path path) const
 Save recorded transformation history to a file.
nlohmann::json get_history () const
 Get the transformation history.
nlohmann::json & history ()
 Get mutable reference to transformation history.

Protected Member Functions

virtual void enrich (nlohmann::json &desc, builder::StructuredSDFGBuilder &builder, analysis::AnalysisManager &analysis_manager)
 Enrich a transformation descriptor after to_json and before it is recorded and applied.

Detailed Description

Records transformation history for replay and analysis.

The Recorder class tracks all transformations applied to an SDFG and serializes them to JSON. This enables:

  • Replay of transformation sequences on different SDFGs
  • Analysis of transformation impact
  • Debugging and validation of transformation sequences

Constructor & Destructor Documentation

◆ Recorder()

sdfg::transformations::Recorder::Recorder ( )

Construct an empty recorder.

◆ ~Recorder()

virtual sdfg::transformations::Recorder::~Recorder ( )
virtualdefault

Member Function Documentation

◆ apply()

template<typename T, typename... Args>
requires transformation_concept<T>
void sdfg::transformations::Recorder::apply ( builder::StructuredSDFGBuilder & builder,
analysis::AnalysisManager & analysis_manager,
bool skip_if_not_applicable,
Args &&... args )
inline

Construct a transformation from args and record it.

Convenience wrapper around record for call sites that hold the transformation's constructor arguments rather than a built object.

Template Parameters
TThe transformation type (must satisfy transformation_concept)
ArgsArgument types for transformation constructor
Exceptions
InvalidTransformationExceptionif not applicable and not skipped.

◆ enrich()

virtual void sdfg::transformations::Recorder::enrich ( nlohmann::json & desc,
builder::StructuredSDFGBuilder & builder,
analysis::AnalysisManager & analysis_manager )
inlineprotectedvirtual

Enrich a transformation descriptor after to_json and before it is recorded and applied.

The base implementation annotates each loop anchor of the descriptor's subgraph with loop_info.

◆ get_history()

nlohmann::json sdfg::transformations::Recorder::get_history ( ) const
inline

Get the transformation history.

Returns
JSON array of transformation descriptions

◆ history()

nlohmann::json & sdfg::transformations::Recorder::history ( )
inline

Get mutable reference to transformation history.

Returns
JSON array of transformation descriptions

◆ record()

bool sdfg::transformations::Recorder::record ( Transformation & transformation,
builder::StructuredSDFGBuilder & builder,
analysis::AnalysisManager & analysis_manager,
bool skip_if_not_applicable = false )
inline

Apply an already-constructed transformation and record it.

The single implementation of the record-and-apply flow: check applicability, serialize, run the virtual enrich hook, append to the history and apply. The templated apply overload is a thin constructor-forwarding wrapper around this.

Returns
true if applied, false if skipped (not applicable).
Exceptions
InvalidTransformationExceptionif not applicable and not skipped.

◆ save()

void sdfg::transformations::Recorder::save ( std::filesystem::path path) const

Save recorded transformation history to a file.

Parameters
pathThe file path to save to

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