Skip to content

Commit 70882f0

Browse files
committed
address Copilot review comments
1 parent 80dde41 commit 70882f0

4 files changed

Lines changed: 15 additions & 7 deletions

File tree

lib/Dialect/AIEX/Utils/AIEUtils.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ void AIEX::emitScratchpadParamsFile(ModuleOp moduleOp, llvm::raw_ostream &os) {
211211
std::string typeStr;
212212
llvm::raw_string_ostream ts(typeStr);
213213
p.getType().print(ts);
214+
ts.flush();
214215
StringRef kindStr =
215216
p.getKind().value() == AIEX::ScratchpadParameterKind::Addr ? "addr"
216217
: "core";

tools/aiecc/ExecutionEngine.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,11 @@ inline void writeCheckpoint(llvm::ArrayRef<EdgeBase *> cutEdges,
370370
destName = std::to_string(i) + "_" + base;
371371
llvm::SmallString<256> dest(dir);
372372
llvm::sys::path::append(dest, destName);
373-
if (llvm::sys::fs::copy_file(src, dest))
373+
if (std::error_code ec = llvm::sys::fs::copy_file(src, dest)) {
374+
llvm::errs() << "aiecc: checkpoint failed to copy '" << src << "' to '"
375+
<< dest << "': " << ec.message() << "\n";
374376
continue;
377+
}
375378
frontier.push_back(llvm::json::Object{
376379
{"name", e->name}, {"key", it->key}, {"path", destName}});
377380
}

tools/aiecc/SidecarFiles.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,16 @@ makeFullElfConfigJson(const Node<OpInModule<xilinx::AIE::DeviceOp>> &devices,
277277

278278
llvm::json::Array instances;
279279
devOp.walk([&](xilinx::AIE::RuntimeSequenceOp seq) {
280-
// One `.bin` per runtime sequence, keyed "<device>_<sequence>".
280+
// One `.bin` per runtime sequence, keyed "<device>_<sequence>". Only
281+
// sequences that were actually lowered to a control-code binary have an
282+
// entry in `instsPaths`; skip the rest (e.g. filtered out via
283+
// `--sequence-name`) so we don't emit an instance with an empty
284+
// TXN_ctrl_code_file, which is invalid for `aiebu-asm -t aie2_config`.
281285
auto instsIt = instsPaths.find(npuSeqKey(devName, seq.getSymName()));
282-
std::string instsPath =
283-
instsIt == instsPaths.end() ? "" : instsIt->second;
284-
instances.push_back(
285-
O{{"id", seq.getSymName().str()}, {"TXN_ctrl_code_file", instsPath}});
286+
if (instsIt == instsPaths.end())
287+
return;
288+
instances.push_back(O{{"id", seq.getSymName().str()},
289+
{"TXN_ctrl_code_file", instsIt->second}});
286290
});
287291
if (instances.empty())
288292
continue;

tools/aiecc/Tools.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ inline mlir::LogicalResult assemblePdi(const Item<std::string> &bifItem,
126126
// directory name under `<aietools>/tps/lnx64/`. Empty for unsupported targets.
127127
inline std::string getChessTarget(llvm::StringRef aieTarget) {
128128
std::string t = aieTarget.lower();
129-
if (t == "aie2")
129+
if (t == "aie2" || t == "aieml")
130130
return "target_aie_ml";
131131
if (t == "aie2p")
132132
return "target_aie2p";

0 commit comments

Comments
 (0)