Striped Difference-Bounded Matrix (SDBM) expression is a base left-hand side expression for the SDBM framework. SDBM expressions are a subset of affine expressions supporting low-complexity algorithms for the operations used in loop transformations. In particular, are supported:
- constant expressions;
- single variables (dimensions and symbols) with +1 or -1 coefficient;
- stripe expressions: "x # C", where "x" is a single variable or another stripe expression, "#" is the stripe operator, and "C" is a constant expression; "#" is defined as x - x mod C.
- sum expressions between single variable/stripe expressions and constant expressions;
- difference expressions between single variable/stripe expressions.
SDBMExpr
class hierarchy provides a type-safe interface to constructing and operating on SDBM expressions. For example, it requires the LHS of a sum expression to be a single variable or a stripe expression. These restrictions are intended to force the caller to perform the necessary simplifications to stay within the SDBM domain, because SDBM expressions do not combine in more cases than they do. This choice may be reconsidered in the future.
SDBM expressions are grouped into the following structure
- expression
- varying
- direct
- sum <- (term, constant)
- term
- symbol
- dimension
- stripe <- (direct, constant)
- negation <- (direct)
- difference <- (direct, term)
- constant The notation <- (...) denotes the types of subexpressions a compound expression can combine. The tree of subexpressions essentially imposes the following canonicalization rules:
- constants are always folded;
- constants can only appear on the RHS of an expression;
- double negation must be elided;
- an additive constant term is only allowed in a sum expression, and should be sunk into the nearest such expression in the tree;
- zero constant expression can only appear at the top level.
SDBMExpr
and derived classes are thin wrappers around a pointer owned by an MLIRContext, and should be used by-value. They are uniqued in the MLIRContext and immortal.