Skip to content

Commit bc0695c

Browse files
author
Shiran
committed
Align is_steering_unwrapped_op with InsertDataMovPass behavior
1 parent 49cc61a commit bc0695c

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lib/NeuraDialect/Mapping/mapping_util.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ bool is_non_materialized(Operation *op) {
8787
return mlir::isa<neura::ReserveOp, neura::CtrlMovOp, neura::DataMovOp>(op);
8888
}
8989

90-
// Returns true if the operation is a steering-mode operation that doesn't
91-
// require DataMovOp wrapping (e.g., carry, invariant, reserve).
90+
// Returns true if the operation doesn't require DataMovOp wrapping.
91+
// This must match InsertDataMovPass behavior which only skips ReserveOp.
9292
bool is_steering_unwrapped_op(Operation *op) {
93-
return mlir::isa<neura::CarryOp, neura::InvariantOp, neura::ReserveOp>(op);
93+
return mlir::isa<neura::ReserveOp>(op);
9494
}
9595

9696
} // namespace neura
@@ -632,15 +632,15 @@ bool mlir::neura::tryRouteDataMove(Operation *mov_op, MappingLoc src_loc,
632632
Operation *mlir::neura::getMaterializedProducer(Value operand) {
633633
Operation *producer = operand.getDefiningOp();
634634

635-
// In steering mode, some operations (like carry, invariant, reserve)
636-
// may not be wrapped by DataMovOp. Return them directly.
635+
// ReserveOp is not wrapped by DataMovOp (see InsertDataMovPass).
636+
// Return it directly as it represents the loop-carried dependency placeholder.
637637
if (is_steering_unwrapped_op(producer)) {
638638
return producer;
639639
}
640640

641641
// For operations wrapped by DataMovOp, find the actual producer.
642642
assert(isa<neura::DataMovOp>(producer) &&
643-
"Expected a DataMovOp as operand producer for non-steering operations");
643+
"Expected a DataMovOp as operand producer for non-ReserveOp operations");
644644
auto mov_op = dyn_cast<neura::DataMovOp>(producer);
645645
auto materialized_producer = mov_op.getOperand().getDefiningOp();
646646
return materialized_producer;
@@ -970,21 +970,21 @@ bool mlir::neura::placeAndRoute(Operation *op, const MappingLoc &target_loc,
970970
for (Value operand : op->getOperands()) {
971971
llvm::errs() << "Processing operand: " << operand << "\n";
972972
if (isa<neura::ReserveOp>(operand.getDefiningOp())) {
973-
// Skips Reserve ops (backward ctrl move) when estimate cost.
973+
// Skips Reserve ops (backward ctrl move) when routing.
974974
continue;
975975
}
976976
Operation *data_move = operand.getDefiningOp();
977977

978-
// In steering mode, some operands may not be DataMovOp (e.g., carry,
979-
// invariant, reserve). Skip routing for these operations.
978+
// ReserveOp is not wrapped by DataMovOp (see InsertDataMovPass).
979+
// Skip routing for ReserveOp as it represents loop-carried dependency.
980980
if (is_steering_unwrapped_op(data_move)) {
981-
llvm::errs() << "Skipping steering unwrapped operand: " << *data_move
981+
llvm::errs() << "Skipping unwrapped operand: " << *data_move
982982
<< "\n";
983983
continue;
984984
}
985985

986986
assert(isa<neura::DataMovOp>(data_move) &&
987-
"Expected a DataMovOp as operand for non-steering operations");
987+
"Expected a DataMovOp as operand for non-ReserveOp operations");
988988

989989
Operation *producer = getMaterializedProducer(operand);
990990
MappingLoc src_loc = mapping_state.getAllLocsOfOp(producer).back();

0 commit comments

Comments
 (0)