Skip to content

Commit 8dfca70

Browse files
author
Maximilian Ehlers
committed
[668]: renames trait PushDownWithIntervalUpdate to PushDownIncrementUpdate
Signed-off-by: Maximilian Ehlers <daphnevm@sodawa.com>
1 parent a92a27f commit 8dfca70

File tree

5 files changed

+23
-11
lines changed

5 files changed

+23
-11
lines changed

src/ir/daphneir/Canonicalize.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ template <class Operation> bool tryPushDownBinary(Operation op, mlir::PatternRew
376376
const bool rhsIsSca = CompilerUtils::isScaType(rhs.getType());
377377

378378
const bool supportsPushDownLinear = op->template hasTrait<mlir::OpTrait::PushDownLinear>();
379-
const bool supportsPushDownWithIntervalUpdate = op->template hasTrait<mlir::OpTrait::PushDownWithIntervalUpdate>();
379+
const bool supportsPushDownIncrementUpdate = op->template hasTrait<mlir::OpTrait::PushDownIncrementUpdate>();
380380

381381
// This will check for the fill operation to push down the arithmetic inside
382382
// of it
@@ -426,7 +426,7 @@ template <class Operation> bool tryPushDownBinary(Operation op, mlir::PatternRew
426426
auto newFrom = rewriter.create<Operation>(op.getLoc(), from, rhs);
427427
auto newTo = rewriter.create<Operation>(op.getLoc(), to, rhs);
428428

429-
if (supportsPushDownWithIntervalUpdate) {
429+
if (supportsPushDownIncrementUpdate) {
430430
auto incInt = CompilerUtils::isConstant<int>(inc);
431431
auto valueInt = CompilerUtils::isConstant<int>(rhs);
432432
auto valueDouble = CompilerUtils::isConstant<double>(rhs);

src/ir/daphneir/DaphneOps.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,10 @@ def Daphne_EwAddOp : Daphne_EwBinaryOp<"ewAdd", AnyScalar, [ValueTypeFromArgs
352352
def Daphne_EwSubOp : Daphne_EwBinaryOp<"ewSub", NumScalar, [ValueTypeFromArgs, CastArgsToResType, EwSparseIfBoth, CUDASupport, PushDownLinear]> {
353353
let hasCanonicalizeMethod = 1;
354354
}
355-
def Daphne_EwMulOp : Daphne_EwBinaryOp<"ewMul", NumScalar, [ValueTypeFromArgs, CastArgsToResType, Commutative, EwSparseIfEither, CUDASupport, PushDownLinear, PushDownWithIntervalUpdate]> {
355+
def Daphne_EwMulOp : Daphne_EwBinaryOp<"ewMul", NumScalar, [ValueTypeFromArgs, CastArgsToResType, Commutative, EwSparseIfEither, CUDASupport, PushDownLinear, PushDownIncrementUpdate]> {
356356
let hasCanonicalizeMethod = 1;
357357
}
358-
def Daphne_EwDivOp : Daphne_EwBinaryOp<"ewDiv", NumScalar, [ValueTypeFromArgs, CastArgsToResType, CUDASupport, PushDownLinear, PushDownWithIntervalUpdate]> {
358+
def Daphne_EwDivOp : Daphne_EwBinaryOp<"ewDiv", NumScalar, [ValueTypeFromArgs, CastArgsToResType, CUDASupport, PushDownLinear, PushDownIncrementUpdate]> {
359359
let hasCanonicalizeMethod = 1;
360360
}
361361
def Daphne_EwPowOp : Daphne_EwBinaryOp<"ewPow", NumScalar, [ValueTypeFromArgs, CastArgsToResType, CUDASupport]> {

src/ir/daphneir/DaphnePushDownTraits.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,20 @@
44
namespace mlir::OpTrait {
55

66
// ============================================================================
7-
// Traits determining pushdown rewrite possibilities
7+
// Traits determining advanced push-down rewrite possibilities
88
// ============================================================================
99

10-
// Dynamic First Argument
11-
12-
template <class ConcreteOp> class PushDown : public TraitBase<ConcreteOp, PushDown> {};
10+
/**
11+
* @brief This trait is for operations that are linear and might allow for push-downs into functions that
12+
* act on e.g. ranges
13+
*/
1314
template <class ConcreteOp> class PushDownLinear : public TraitBase<ConcreteOp, PushDownLinear> {};
14-
template <class ConcreteOp>
15-
class PushDownWithIntervalUpdate : public TraitBase<ConcreteOp, PushDownWithIntervalUpdate> {};
15+
16+
/**
17+
* @brief This trait is for operations that are using an increment value which
18+
* needs to be accounted for during push-down optimizations
19+
*/
20+
template <class ConcreteOp> class PushDownIncrementUpdate : public TraitBase<ConcreteOp, PushDownIncrementUpdate> {};
1621

1722
} // namespace mlir::OpTrait
1823

src/ir/daphneir/DaphnePushDownTraits.td

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919

2020
include "mlir/IR/OpBase.td"
2121

22+
// ============================================================================
23+
// Traits determining pushdown rewrite possibilities
24+
// ============================================================================
25+
2226
def PushDownLinear: NativeOpTrait<"PushDownLinear">;
23-
def PushDownWithIntervalUpdate: NativeOpTrait<"PushDownWithIntervalUpdate">;
27+
def PushDownIncrementUpdate: NativeOpTrait<"PushDownIncrementUpdate">;
2428

2529
#endif //SRC_IR_DAPHNEIR_DAPHNEPUSHDOWNTRAITS_TD

workspace/minus.daphne

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
b = - rand(1,3,-6,-3,1.0,7);
3+
print(b);

0 commit comments

Comments
 (0)