Skip to content

Commit d33048b

Browse files
Copilotfifield
authored andcommitted
fix missing device guard in AIEToConfiguration
1 parent 0bb8253 commit d33048b

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

lib/Conversion/AIEToConfiguration/AIEToConfiguration.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,9 +636,15 @@ static LogicalResult convertTransactionOpsToMLIR(
636636
// for each blockwrite in the binary, create a GlobalOp with the data at the
637637
// device level
638638
std::vector<memref::GlobalOp> global_data;
639-
DeviceOp device = llvm::dyn_cast<DeviceOp>(builder.getBlock()->getParentOp());
639+
Operation *parentOp = builder.getBlock()->getParentOp();
640+
DeviceOp device = llvm::dyn_cast<DeviceOp>(parentOp);
640641
if (!device) {
641-
device = builder.getBlock()->getParentOp()->getParentOfType<DeviceOp>();
642+
device = parentOp->getParentOfType<DeviceOp>();
643+
}
644+
if (!device) {
645+
parentOp->emitError(
646+
"expected insertion point to be nested under an aie.device op");
647+
return failure();
642648
}
643649
Location loc = device.getLoc();
644650
{

0 commit comments

Comments
 (0)