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

Namespaces

namespace  detail

Classes

class  LoopParallelization
 Converts a single For loop into a sequential Map. More...
class  LocalStorage
 Local-storage transformation. More...
class  SoftwarePipelining
 Software-pipeline a sequential panel loop that cooperatively stages a shared-memory tile each iteration (the structure LocalStorage emits). More...
class  TileFusion
 Tile fusion transformation that merges two consecutive sibling tiled Maps. More...
class  TileVectorizer
 Widen every cooperative shared-staging copy in a subtree to the widest legal vector transfer. More...
class  CollapseToDepth
 Collapse a perfectly-nested map nest into a target number of loops. More...
class  LoopConditionNormalize
 Loop condition normalization to convert inequality conditions to relational comparisons. More...
class  LoopDistribute
 Loop distribution (loop fission) transformation. More...
struct  LoopHeader
 Bounds and step of a loop, keeping its induction variable. More...
struct  LoopSwap
 Two directly nested loops and their headers after swapping them. More...
class  LoopIndvarFinalize
 Computes closed-form final value of induction variable after loop. More...
class  LoopInterchange
 Loop interchange transformation that swaps two nested loops. More...
class  LoopPeeling
 Loop peeling for a perfectly nested chain of compound-condition loops. More...
class  LoopRotate
 Loop rotation transformation to convert negative stride to positive stride. More...
class  LoopShift
 Loop shift transformation to change loop initialization value. More...
class  LoopSkewing
 Loop skewing transformation for nested loops. More...
class  LoopSplit
 Loop splitting transformation at a symbolic boundary. More...
class  LoopTiling
 Loop tiling (blocking) transformation. More...
class  LoopUnitStride
 Loop unit stride transformation to convert non-unit stride loops to unit stride. More...
class  MapCollapse
 Map collapse transformation. More...
class  MapDelinearize
 Splits a map into nested maps along the divisions of its induction variable; the inverse of MapCollapse. More...
class  MapFusion
 Map fusion transformation that fuses two sequential maps. More...
class  FusionConsumerSubsetVisitor
class  FusionConsumerUpdateVisitor
class  MultiLevelTiling
 Multi-level loop tiling transformation. More...
class  CUDAParallelizeNestedMap
 Assigns a nested sequential map to the next available CUDA grid dimension. More...
class  GPUConditionPropagation
class  GPUConditionPropagationScope
 Root-anchored sweep of GPUConditionPropagation. More...
class  BarrierFinder
class  GPULoopReordering
class  GPUOffloadNestedLoop
class  OffloadTransform
class  SideEffectFinder
class  ROCMParallelizeNestedMap
 Assigns a nested sequential map to the next available ROCm grid dimension. More...
class  OMPTransform
 OMPTransform transformation for Map nodes. More...
class  Recorder
 Records transformation history for replay and analysis. More...
class  MmaNestOutputUses
 Collects the uses of an output container within a GPU MMA loop nest. More...
class  RedundantZeroInitElimination
 Eliminates a zero-initialization nest that is redundant before a GPU MMA matmul nest. More...
class  Replayer
 Replays recorded transformations on an SDFG. More...
class  StreamK
 Stream-K work decomposition: replace a static output-tile grid whose blocks each own one tile with a fixed persistent grid whose blocks each walk an equal contiguous slice of the flattened (tile x k-panel) iteration space, merging partially-owned tiles via the reduction. More...
class  Transformation
 Base class for all SDFG transformations. More...
class  InvalidTransformationException
 Exception thrown when a transformation cannot be applied. More...
class  InvalidTransformationDescriptionException
 Exception thrown when a transformation description is invalid. More...
class  TrivialLoopElimination
 Eliminates a trivial map, i.e., a map executing exactly one iteration. More...
class  UnrollTransform
 Marks a constant-trip loop for full unrolling. More...
class  VectorizeTransform
 VectorizeTransform transformation for StructuredLoop nodes. More...
class  RPCNodeTransform

Concepts

concept  transformation_concept
 Concept for types that are transformations.
concept  replayable_transformation_concept
 Concept for transformations that can be replayed from a JSON description.

Functions

template<typename Visitor>
decltype(auto) dispatch_transformation (const std::string &transformation_name, const nlohmann::json &desc, Visitor &&visitor)
 Central registry mapping transformation type names to their C++ types.
template<typename T>
requires replayable_transformation_concept<T>
bool verify_round_trip (builder::StructuredSDFGBuilder &builder, const nlohmann::json &desc, std::string &error_out)
 Verify that a transformation's from_json and to_json are consistent inverses.
bool verify_transformation_round_trip (builder::StructuredSDFGBuilder &builder, const nlohmann::json &desc, std::string &error_out)
 Verify from_json/to_json consistency for the transformation named in desc.
const std::string & transformation_schema_text ()
 The transformation serialization schema as a JSON Schema (2020-12) document.
const nlohmann::json & transformation_schema ()
 The transformation serialization schema, parsed once.
bool validate_transformation_schema (const nlohmann::json &j, std::string &error_out)
 Validate that a transformation description respects the serialization schema.

Function Documentation

◆ dispatch_transformation()

template<typename Visitor>
decltype(auto) sdfg::transformations::dispatch_transformation ( const std::string & transformation_name,
const nlohmann::json & desc,
Visitor && visitor )

Central registry mapping transformation type names to their C++ types.

This is the single source of truth that replaces the per-replayer if/else dispatch chains (base Replayer, EmbeddingReplayer, RecordingReplayer). For a given transformation_name, the matching transformation type T is resolved and the caller-supplied visitor is invoked as visitor.template operator()<T>(). The visitor decides what to do with the type (e.g. apply and record it), while this function owns the name-to-type mapping and the compile-time validation of each registered type.

Template Parameters
VisitorA callable with a templated operator() (e.g. a C++20 generic lambda []<typename T>() { ... }). Its return value is forwarded back to the caller unchanged.
Parameters
transformation_nameThe registered transformation type name.
descThe transformation description; used to resolve parameterized dispatch (e.g. the GPU backend of GPUOffloadNestedLoop).
visitorThe visitor invoked with the resolved transformation type.
Exceptions
InvalidTransformationDescriptionExceptionif the name is not registered.

◆ transformation_schema()

const nlohmann::json & sdfg::transformations::transformation_schema ( )

The transformation serialization schema, parsed once.

Returns
The parsed JSON Schema document.

◆ transformation_schema_text()

const std::string & sdfg::transformations::transformation_schema_text ( )

The transformation serialization schema as a JSON Schema (2020-12) document.

The schema is authored in opt/json/transformation.schema.json and embedded into the library at build time, so it travels with the binary and serves as the canonical, human-readable documentation of the contract enforced below.

Returns
The raw schema document text.

◆ validate_transformation_schema()

bool sdfg::transformations::validate_transformation_schema ( const nlohmann::json & j,
std::string & error_out )
inline

Validate that a transformation description respects the serialization schema.

Every transformation's to_json() must produce an object with exactly this shape:

  • "transformation_type": non-empty string (equal to Transformation::name()).
  • "subgraph": object whose keys are the contiguous indices "0".."N-1". Each entry is an object with an unsigned "element_id" and a string "type" (the flat serialization of a constructor node).
  • "parameters": optional object (possibly empty) holding additional constructor inputs. Omitted for backward compatibility with older descriptions.

This is the single source of truth for the schema. It is consumed by the serialization tests and by the runtime invariants in the Recorder/Replayer.

Parameters
jThe transformation description to validate.
error_outPopulated with a human-readable reason when validation fails.
Returns
true if the description matches the schema.

◆ verify_round_trip()

template<typename T>
requires replayable_transformation_concept<T>
bool sdfg::transformations::verify_round_trip ( builder::StructuredSDFGBuilder & builder,
const nlohmann::json & desc,
std::string & error_out )

Verify that a transformation's from_json and to_json are consistent inverses.

This is the semantic counterpart to validate_transformation_schema: while the schema validates the shape of a single description, this check validates that the registry's from_json factory and the transformation's to_json serialization agree with each other. Concretely it:

  1. reconstructs the transformation from desc via T::from_json,
  2. re-serializes it via to_json (the canonical description),
  3. asserts the canonical description satisfies the shared schema,
  4. asserts the reconstructed transformation_type matches desc, and
  5. asserts the round-trip is a stable fixed point (to_json(from_json(x)) == to_json(from_json(to_json(from_json(x))))), which fails if from_json drops or misreads any field that to_json writes.
Template Parameters
TThe transformation type (must satisfy replayable_transformation_concept).
Parameters
builderThe SDFG builder whose elements the description refers to.
descThe transformation description to round-trip.
error_outPopulated with a human-readable reason when verification fails.
Returns
true if from_json and to_json are consistent for desc.

◆ verify_transformation_round_trip()

bool sdfg::transformations::verify_transformation_round_trip ( builder::StructuredSDFGBuilder & builder,
const nlohmann::json & desc,
std::string & error_out )
inline

Verify from_json/to_json consistency for the transformation named in desc.

Resolves the transformation type through the registry and delegates to verify_round_trip. This ties every registered from_json factory to its to_json serialization through a single, name-driven entry point.

Parameters
builderThe SDFG builder whose elements the description refers to.
descThe transformation description (must contain a string transformation_type).
error_outPopulated with a human-readable reason when verification fails.
Returns
true if from_json and to_json are consistent for desc.