Skip to content

Commit ef06016

Browse files
committed
Revert "[MLIR] Introduce op trait PolyhedralScope"
This reverts commit dd2c639. It broke a few things -- the explanation will be posted to the review thread.
1 parent 6f588c6 commit ef06016

File tree

13 files changed

+93
-356
lines changed

13 files changed

+93
-356
lines changed

mlir/docs/Dialects/Affine.md

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -60,26 +60,20 @@ Example:
6060
### Restrictions on Dimensions and Symbols
6161

6262
The affine dialect imposes certain restrictions on dimension and symbolic
63-
identifiers to enable powerful analysis and transformation. An SSA value's use
64-
can be bound to a symbolic identifier if that SSA value is either
65-
1. a region argument for an op with trait `PolyhedralScope` (eg. `FuncOp`),
66-
2. a value defined at the top level of a `PolyhedralScope` op (i.e., immediately
67-
enclosed by the latter),
68-
3. a value that dominates the `PolyhedralScope` op enclosing the value's use,
69-
4. the result of a [`constant` operation](Standard.md#constant-operation),
70-
5. the result of an [`affine.apply`
71-
operation](#affineapply-operation) that recursively takes as arguments any valid
72-
symbolic identifiers, or
73-
6. the result of a [`dim` operation](Standard.md#dim-operation) on either a
74-
memref that is an argument to a `PolyhedralScope` op or a memref where the
75-
corresponding dimension is either static or a dynamic one in turn bound to a
76-
valid symbol.
77-
78-
Note that as a result of rule (3) above, symbol validity is sensitive to the
79-
location of the SSA use. Dimensions may be bound not only to anything that a
80-
symbol is bound to, but also to induction variables of enclosing
81-
[`affine.for`](#affinefor-operation) and
82-
[`affine.parallel`](#affineparallel-operation) operations, and the result of an
63+
identifiers to enable powerful analysis and transformation. A symbolic
64+
identifier can be bound to an SSA value that is either an argument to the
65+
function, a value defined at the top level of that function (outside of all
66+
loops and if operations), the result of a
67+
[`constant` operation](Standard.md#constant-operation), or the result of an
68+
[`affine.apply` operation](#affineapply-operation) that recursively takes as
69+
arguments any symbolic identifiers, or the result of a [`dim`
70+
operation](Standard.md#dim-operation) on either a memref that is a function
71+
argument or a memref where the corresponding dimension is either static or a
72+
dynamic one in turn bound to a symbolic identifier. Dimensions may be bound not
73+
only to anything that a symbol is bound to, but also to induction variables of
74+
enclosing [`affine.for`](#affinefor-affineforop) and
75+
[`afffine.parallel`](#affineparallel-affineparallelop) operations, and the
76+
result of an
8377
[`affine.apply` operation](#affineapply-operation) (which recursively may use
8478
other dimensions and symbols).
8579

mlir/docs/Traits.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -219,22 +219,6 @@ foo.region_op {
219219
This trait is an important structural property of the IR, and enables operations
220220
to have [passes](PassManagement.md) scheduled under them.
221221

222-
223-
### PolyhedralScope
224-
225-
* `OpTrait::PolyhedralScope` -- `PolyhedralScope`
226-
227-
This trait is carried by region holding operations that define a new scope for
228-
the purposes of polyhedral optimization and the affine dialect in particular.
229-
Any SSA values of 'index' type that either dominate such operations, or are
230-
defined at the top-level of such operations, or appear as region arguments for
231-
such operations automatically become valid symbols for the polyhedral scope
232-
defined by that operation. As a result, such SSA values could be used as the
233-
operands or index operands of various affine dialect operations like affine.for,
234-
affine.load, and affine.store. The polyhedral scope defined by an operation
235-
with this trait includes all operations in its region excluding operations that
236-
are nested inside of other operations that themselves have this trait.
237-
238222
### Single Block with Implicit Terminator
239223

240224
* `OpTrait::SingleBlockImplicitTerminator<typename TerminatorOpType>` :

mlir/include/mlir/Dialect/Affine/IR/AffineOps.h

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,9 @@ class AffineTerminatorOp;
3131
class FlatAffineConstraints;
3232
class OpBuilder;
3333

34-
/// A utility function to check if a value is defined at the top level of an
35-
/// op with trait `PolyhedralScope` or is a region argument for such an op. A
36-
/// value of index type defined at the top level is always a valid symbol for
37-
/// all its uses.
34+
/// A utility function to check if a value is defined at the top level of a
35+
/// function. A value of index type defined at the top level is always a valid
36+
/// symbol.
3837
bool isTopLevelValue(Value value);
3938

4039
/// AffineDmaStartOp starts a non-blocking DMA operation that transfers data
@@ -458,22 +457,12 @@ class AffineStoreOp : public Op<AffineStoreOp, OpTrait::ZeroResult,
458457
SmallVectorImpl<OpFoldResult> &results);
459458
};
460459

461-
/// Returns true if the given Value can be used as a dimension id in the region
462-
/// of the closest surrounding op that has the trait `PolyhedralScope`.
460+
/// Returns true if the given Value can be used as a dimension id.
463461
bool isValidDim(Value value);
464462

465-
/// Returns true if the given Value can be used as a dimension id in `region`,
466-
/// i.e., for all its uses in `region`.
467-
bool isValidDim(Value value, Region *region);
468-
469-
/// Returns true if the given value can be used as a symbol in the region of the
470-
/// closest surrounding op that has the trait `PolyhedralScope`.
463+
/// Returns true if the given Value can be used as a symbol.
471464
bool isValidSymbol(Value value);
472465

473-
/// Returns true if the given Value can be used as a symbol for `region`, i.e.,
474-
/// for all its uses in `region`.
475-
bool isValidSymbol(Value value, Region *region);
476-
477466
/// Modifies both `map` and `operands` in-place so as to:
478467
/// 1. drop duplicate operands
479468
/// 2. drop unused dims and symbols from map

mlir/include/mlir/Dialect/Affine/IR/AffineOps.td

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,12 @@ def AffineApplyOp : Affine_Op<"apply", [NoSideEffect]> {
8383
/// Returns the affine value map computed from this operation.
8484
AffineValueMap getAffineValueMap();
8585

86-
/// Returns true if the result of this operation can be used as dimension id
87-
/// in the region of the closest surrounding op with trait PolyhedralScope.
86+
/// Returns true if the result of this operation can be used as dimension id.
8887
bool isValidDim();
8988

90-
/// Returns true if the result of this operation can be used as dimension id
91-
/// within 'region', i.e., for all its uses with `region`.
92-
bool isValidDim(Region *region);
93-
94-
/// Returns true if the result of this operation is a symbol in the region
95-
/// of the closest surrounding op that has the trait PolyhedralScope.
89+
/// Returns true if the result of this operation is a symbol.
9690
bool isValidSymbol();
9791

98-
/// Returns true if the result of this operation is a symbol for all its
99-
/// uses in `region`.
100-
bool isValidSymbol(Region *region);
101-
10292
operand_range getMapOperands() { return getOperands(); }
10393
}];
10494

mlir/include/mlir/Dialect/Affine/IR/AffineOpsBase.td

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,4 @@ def AffineMapArrayAttr : TypedArrayAttrBase<AffineMapAttr,
2929
let constBuilderCall = "$_builder.getAffineMapArrayAttr($0)";
3030
}
3131

32-
//===----------------------------------------------------------------------===//
33-
// OpTrait definitions
34-
//===----------------------------------------------------------------------===//
35-
36-
// Op defines a polyhedral scope.
37-
def PolyhedralScope : NativeOpTrait<"PolyhedralScope">;
38-
3932
#endif // AFFINE_OPS_BASE

mlir/include/mlir/Dialect/Affine/Traits.h

Lines changed: 0 additions & 41 deletions
This file was deleted.

mlir/include/mlir/IR/Function.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#ifndef MLIR_IR_FUNCTION_H
1414
#define MLIR_IR_FUNCTION_H
1515

16-
#include "mlir/Dialect/Affine/Traits.h"
1716
#include "mlir/IR/Block.h"
1817
#include "mlir/IR/FunctionSupport.h"
1918
#include "mlir/IR/OpDefinition.h"
@@ -31,11 +30,10 @@ namespace mlir {
3130
/// implicitly capture global values, and all external references must use
3231
/// Function arguments or attributes that establish a symbolic connection(e.g.
3332
/// symbols referenced by name via a string attribute).
34-
class FuncOp
35-
: public Op<FuncOp, OpTrait::ZeroOperands, OpTrait::ZeroResult,
36-
OpTrait::IsIsolatedFromAbove, OpTrait::FunctionLike,
37-
OpTrait::AutomaticAllocationScope, OpTrait::PolyhedralScope,
38-
CallableOpInterface::Trait, SymbolOpInterface::Trait> {
33+
class FuncOp : public Op<FuncOp, OpTrait::ZeroOperands, OpTrait::ZeroResult,
34+
OpTrait::IsIsolatedFromAbove, OpTrait::FunctionLike,
35+
OpTrait::AutomaticAllocationScope,
36+
CallableOpInterface::Trait, SymbolOpInterface::Trait> {
3937
public:
4038
using Op::Op;
4139
using Op::print;

0 commit comments

Comments
 (0)