Skip to content

Commit

Permalink
Forward FXOutputName
Browse files Browse the repository at this point in the history
  • Loading branch information
mgehre-amd committed Jul 28, 2023
1 parent 5fb1178 commit 364dd51
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lib/Dialect/Torch/Transforms/GlobalizeObjectGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,9 @@ static LogicalResult rewriteMonomorphizedFuncClone(
auto newOp = OpBuilder(op).create<GlobalSlotGetOp>(
op.getLoc(), op.getType(),
objectGraphInfo.getGlobalSlotFor(affectedSlot).getSymName());
newOp->setAttr("FXOutputName", op->getAttr("FXOutputName"));
//llvm::errs() << "PrimGetAttrOp replaced by\n";
//newOp.dump();
op.replaceAllUsesWith(&*newOp);
}
toErase.push_back(op);
Expand Down
10 changes: 8 additions & 2 deletions lib/Dialect/Torch/Transforms/InlineGlobalSlots.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,12 +375,18 @@ class InlineGlobalSlotsPass
getBackwardSliceIncludingRoot(initialValue);
IRMapping mapping;
OpBuilder builder(op);
for (Operation *opInSlice : slice)
builder.clone(*opInSlice, mapping);
for (Operation *opInSlice : slice) {
//llvm::errs() << "cloning\n";
//opInSlice->dump();
auto clonedOp = builder.clone(*opInSlice, mapping);
clonedOp->setAttr("FXOutputName", op->getAttr("FXOutputName"));
}
auto inlinedInitialValue = mapping.lookup(initialValue);
inlinedInitialValue = Torch::adjustStaticInformation(
builder, op.getLoc(), inlinedInitialValue, op.getType(),
/*userAllowsRefinement=*/false);
//llvm::errs() << "Replacing GlobalSlotGetOp by\n";
//inlinedInitialValue.dump();
op.replaceAllUsesWith(inlinedInitialValue);
toErase.insert(op);
});
Expand Down

0 comments on commit 364dd51

Please sign in to comment.