forked from OSchip/llvm-project
NFC - update doc, comments, vim syntax file
- for the symbol rules, the code was updated but the doc wasn't. Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#284 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/284 from bondhugula:doc 9aad8b8a715559f7ce61265f3da3f8a3c11b45ea PiperOrigin-RevId: 284283712
This commit is contained in:
parent
fcc215e399
commit
ca23bd78d4
|
@ -66,9 +66,12 @@ function, a value defined at the top level of that function (outside of all
|
|||
loops and if operations), the result of a
|
||||
[`constant` operation](Standard.md#constant-operation), or the result of an
|
||||
[`affine.apply` operation](#affineapply-operation) that recursively takes as
|
||||
arguments any symbolic identifiers. Dimensions may be bound not only to anything
|
||||
that a symbol is bound to, but also to induction variables of enclosing
|
||||
[`affine.for` operations](#affinefor-operation), and the result of an
|
||||
arguments any symbolic identifiers, or the result of a [`dim`
|
||||
operation](Standard.md#dim-operation) on either a memref that is a function
|
||||
argument or a memref where the corresponding dimension is either static or a
|
||||
dynamic one in turn bound to a symbolic identifier. Dimensions may be bound not
|
||||
only to anything that a symbol is bound to, but also to induction variables of
|
||||
enclosing [`affine.for` operations](#affinefor-operation), and the result of an
|
||||
[`affine.apply` operation](#affineapply-operation) (which recursively may use
|
||||
other dimensions and symbols).
|
||||
|
||||
|
|
|
@ -655,7 +655,7 @@ public:
|
|||
Optional<int64_t> getConstantUpperBound(unsigned pos) const;
|
||||
|
||||
/// Gets the lower and upper bound of the pos^th identifier treating
|
||||
/// [0, offset) U [offset + num, symbStartPos) as dimensions and
|
||||
/// [0, offset) U [offset + num, symStartPos) as dimensions and
|
||||
/// [symStartPos, getNumDimAndSymbolIds) as symbols. The returned
|
||||
/// multi-dimensional maps in the pair represent the max and min of
|
||||
/// potentially multiple affine expressions. The upper bound is exclusive.
|
||||
|
@ -664,7 +664,7 @@ public:
|
|||
std::pair<AffineMap, AffineMap>
|
||||
getLowerAndUpperBound(unsigned pos, unsigned offset, unsigned num,
|
||||
unsigned symStartPos, ArrayRef<AffineExpr> localExprs,
|
||||
MLIRContext *context);
|
||||
MLIRContext *context) const;
|
||||
|
||||
/// Returns true if the set can be trivially detected as being
|
||||
/// hyper-rectangular on the specified contiguous set of identifiers.
|
||||
|
@ -788,11 +788,13 @@ private:
|
|||
AffineExpr simplifyAffineExpr(AffineExpr expr, unsigned numDims,
|
||||
unsigned numSymbols);
|
||||
|
||||
/// Flattens 'expr' into 'flattenedExpr'. Returns failure if 'expr' could not be
|
||||
/// flattened (i.e., semi-affine is not yet handled). 'cst' contains constraints
|
||||
/// that connect newly introduced local identifiers to existing dimensional and
|
||||
/// symbolic identifiers. See documentation for AffineExprFlattener on how
|
||||
/// mod's and div's are flattened.
|
||||
/// Flattens 'expr' into 'flattenedExpr', which contains the coefficients of the
|
||||
/// dimensions, symbols, and additional variables that represent floor divisions
|
||||
/// of dimensions, symbols, and in turn other floor divisions. Returns failure
|
||||
/// if 'expr' could not be flattened (i.e., semi-affine is not yet handled).
|
||||
/// 'cst' contains constraints that connect newly introduced local identifiers
|
||||
/// to existing dimensional and symbolic identifiers. See documentation for
|
||||
/// AffineExprFlattener on how mod's and div's are flattened.
|
||||
LogicalResult
|
||||
getFlattenedAffineExpr(AffineExpr expr, unsigned numDims, unsigned numSymbols,
|
||||
llvm::SmallVectorImpl<int64_t> *flattenedExpr,
|
||||
|
|
|
@ -267,9 +267,8 @@ AffineExpr simplifyAffineExpr(AffineExpr expr, unsigned numDims,
|
|||
|
||||
/// Flattens 'expr' into 'flattenedExpr'. Returns true on success or false
|
||||
/// if 'expr' could not be flattened (i.e., semi-affine is not yet handled).
|
||||
/// 'cst' contains constraints that connect newly introduced local identifiers
|
||||
/// to existing dimensional and / symbolic identifiers. See documentation for
|
||||
/// AffineExprFlattener on how mod's and div's are flattened.
|
||||
/// See documentation for AffineExprFlattener on how mod's and div's are
|
||||
/// flattened.
|
||||
bool getFlattenedAffineExpr(AffineExpr expr, unsigned numDims,
|
||||
unsigned numSymbols,
|
||||
llvm::SmallVectorImpl<int64_t> *flattenedExpr);
|
||||
|
|
|
@ -1525,7 +1525,7 @@ void FlatAffineConstraints::removeRedundantInequalities() {
|
|||
|
||||
std::pair<AffineMap, AffineMap> FlatAffineConstraints::getLowerAndUpperBound(
|
||||
unsigned pos, unsigned offset, unsigned num, unsigned symStartPos,
|
||||
ArrayRef<AffineExpr> localExprs, MLIRContext *context) {
|
||||
ArrayRef<AffineExpr> localExprs, MLIRContext *context) const {
|
||||
assert(pos + offset < getNumDimIds() && "invalid dim start pos");
|
||||
assert(symStartPos >= (pos + offset) && "invalid sym start pos");
|
||||
assert(getNumLocalIds() == localExprs.size() &&
|
||||
|
|
|
@ -173,7 +173,8 @@ static bool isDimOpValidSymbol(DimOp dimOp) {
|
|||
|
||||
// Value can be used as a symbol if it is a constant, or it is defined at
|
||||
// the top level, or it is a result of affine apply operation with symbol
|
||||
// arguments.
|
||||
// arguments, or a result of the dim op on a memref satisfying certain
|
||||
// constraints.
|
||||
bool mlir::isValidSymbol(Value *value) {
|
||||
// The value must be an index type.
|
||||
if (!value->getType().isIndex())
|
||||
|
@ -747,6 +748,8 @@ template <typename AffineOpTy>
|
|||
struct SimplifyAffineOp : public OpRewritePattern<AffineOpTy> {
|
||||
using OpRewritePattern<AffineOpTy>::OpRewritePattern;
|
||||
|
||||
/// Replace the affine op with another instance of it with the supplied
|
||||
/// map and mapOperands.
|
||||
void replaceAffineOp(PatternRewriter &rewriter, AffineOpTy affineOp,
|
||||
AffineMap map, ArrayRef<Value *> mapOperands) const;
|
||||
|
||||
|
@ -2039,5 +2042,9 @@ OpFoldResult AffineMinOp::fold(ArrayRef<Attribute> operands) {
|
|||
return results[minIndex];
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// TableGen'd op method definitions
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define GET_OP_CLASSES
|
||||
#include "mlir/Dialect/AffineOps/AffineOps.cpp.inc"
|
||||
|
|
|
@ -31,7 +31,11 @@ syn match mlirType /x\s*\zsvector/
|
|||
" Operations.
|
||||
" Core ops (not exhaustive yet).
|
||||
" TODO: the list is not exhaustive.
|
||||
syn keyword mlirOps alloc addf addi call call_indirect cmpi constant dealloc dma_start dma_wait dim extract_element for getTensor if load memref_cast mulf muli splat store select subf subi tensor_cast
|
||||
syn keyword mlirOps alloc alloca addf addi call call_indirect cmpi constant
|
||||
syn keyword mlirOps dealloc divf dma_start dma_wait dim extract_element
|
||||
syn keyword getTensor index_cast load memref_cast memref_shape_cast mulf muli
|
||||
syn keyword prefetch sitofp splat store select subf subi subview tensor_cast
|
||||
syn keyword view
|
||||
|
||||
" Affine ops.
|
||||
syn match mlirOps /\<affine\.apply\>/
|
||||
|
@ -41,13 +45,17 @@ syn match mlirOps /\<affine\.for\>/
|
|||
syn match mlirOps /\<affine\.if\>/
|
||||
syn match mlirOps /\<affine\.load\>/
|
||||
syn match mlirOps /\<affine\.store\>/
|
||||
syn match mlirOps /\<loop\.for\>/
|
||||
syn match mlirOps /\<loop\.if\>/
|
||||
|
||||
" TODO: dialect name prefixed ops (llvm or std).
|
||||
|
||||
" Keywords.
|
||||
syn keyword mlirKeyword
|
||||
\ dense
|
||||
\ else
|
||||
\ func
|
||||
\ module
|
||||
\ return
|
||||
\ step
|
||||
\ to
|
||||
|
|
Loading…
Reference in New Issue