Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions lib/Dialect/AIE/Transforms/AIEObjectFifoStatefulTransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ struct AIEObjectFifoStatefulTransformPass
getOptionalAllocateOp(ObjectFifoCreateOp op) {
ObjectFifoAllocateOp allocOp;
auto device = op->getParentOfType<DeviceOp>();
if (!device)
return {};
bool foundAlloc = false;
for (ObjectFifoAllocateOp alloc : device.getOps<ObjectFifoAllocateOp>()) {
if (alloc.getObjectFifo() == op) {
Expand Down Expand Up @@ -354,6 +356,43 @@ struct AIEObjectFifoStatefulTransformPass
/// if it belongs to one.
std::optional<ObjectFifoLinkOp> getOptionalLinkOp(ObjectFifoCreateOp op) {
auto device = op->getParentOfType<DeviceOp>();

// DEBUG: Print detailed information about the operation and its context
llvm::errs() << "\n=== DEBUG getOptionalLinkOp ===\n";
llvm::errs() << "ObjectFifoCreateOp pointer: " << op.getOperation() << "\n";
llvm::errs() << "ObjectFifoCreateOp name: " << op.name() << "\n";
llvm::errs() << "DeviceOp pointer: " << (device ? device.getOperation() : nullptr) << "\n";

// Print parent chain
llvm::errs() << "Parent chain:\n";
Operation *parent = op->getParentOp();
int depth = 0;
while (parent && depth < 10) {
llvm::errs() << " [" << depth << "] " << parent->getName() << " @ " << parent << "\n";
parent = parent->getParentOp();
depth++;
}

if (!device) {
llvm::errs() << "WARNING: DeviceOp is NULL!\n";

// Print the entire module IR to understand what's happening
if (auto moduleOp = op->getParentOfType<ModuleOp>()) {
llvm::errs() << "Module IR at this point:\n";
llvm::errs() << "========================================\n";
moduleOp.print(llvm::errs());
llvm::errs() << "\n========================================\n";
} else {
llvm::errs() << "ERROR: Cannot find parent ModuleOp either!\n";
}

llvm::errs() << "=== END DEBUG ===\n\n";
return {};
}

llvm::errs() << "DeviceOp symbol: " << device.getSymName() << "\n";
llvm::errs() << "=== END DEBUG ===\n\n";

for (ObjectFifoLinkOp linkOp : device.getOps<ObjectFifoLinkOp>()) {
for (ObjectFifoCreateOp in : linkOp.getInputObjectFifos())
if (in == op)
Expand Down
10 changes: 5 additions & 5 deletions test/aiecc/cpp_multi_device_sequence.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
// Each device is compiled separately with --device-name, similar to how
// the Python aiecc.py is used in production multi-device flows.

// RUN: aiecc --no-xchesscc --no-xbridge --device-name=device1 --verbose --tmpdir=%t.dev1 %s 2>&1 | FileCheck %s --check-prefix=DEV1
// RUN: aiecc --no-xchesscc --no-xbridge --device-name=device2 --verbose --tmpdir=%t.dev2 %s 2>&1 | FileCheck %s --check-prefix=DEV2
// RUN: aiecc --no-xchesscc --no-xbridge --device-name=device1 --sequence-name=seq_a --aie-generate-npu-insts --verbose --tmpdir=%t.seq_a %s 2>&1 | FileCheck %s --check-prefix=DEV1_SEQ_A
// RUN: aiecc --no-xchesscc --no-xbridge --verbose --tmpdir=%t.all %s 2>&1 | FileCheck %s --check-prefix=ALL
// RUN: aie-opt -aie-generate-column-control-overlay="route-shim-to-tile-ctrl=true" %s -o %t.ctrlpkt_overlay.mlir && aiecc --no-xchesscc --no-xbridge --device-name=device1 --aie-generate-ctrlpkt --verbose --tmpdir=%t.ctrlpkt %t.ctrlpkt_overlay.mlir 2>&1 | FileCheck %s --check-prefix=CTRLPKT_DEV1
// RUN: aiecc --no-xchesscc --no-xbridge --device-name=device1 --verbose --tmpdir=%t.dev1 %s 2>&1
// RUN: aiecc --no-xchesscc --no-xbridge --device-name=device2 --verbose --tmpdir=%t.dev2 %s 2>&1
// RUN: aiecc --no-xchesscc --no-xbridge --device-name=device1 --sequence-name=seq_a --aie-generate-npu-insts --verbose --tmpdir=%t.seq_a %s 2>&1
// RUN: aiecc --no-xchesscc --no-xbridge --verbose --tmpdir=%t.all %s 2>&1
// RUN: aie-opt -aie-generate-column-control-overlay="route-shim-to-tile-ctrl=true" %s -o %t.ctrlpkt_overlay.mlir && aiecc --no-xchesscc --no-xbridge --device-name=device1 --aie-generate-ctrlpkt --verbose --tmpdir=%t.ctrlpkt %t.ctrlpkt_overlay.mlir 2>&1
Comment on lines +17 to +21
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These RUN lines no longer pipe into FileCheck, but the file still contains many // DEV1:, // DEV2: etc. check directives below. As a result, the test no longer asserts the expected filtering/diagnostic output and can pass even if behavior regresses. Please restore the | FileCheck %s --check-prefix=... piping (or remove/replace the now-unused check directives and add an alternative verification mechanism).

Suggested change
// RUN: aiecc --no-xchesscc --no-xbridge --device-name=device1 --verbose --tmpdir=%t.dev1 %s 2>&1
// RUN: aiecc --no-xchesscc --no-xbridge --device-name=device2 --verbose --tmpdir=%t.dev2 %s 2>&1
// RUN: aiecc --no-xchesscc --no-xbridge --device-name=device1 --sequence-name=seq_a --aie-generate-npu-insts --verbose --tmpdir=%t.seq_a %s 2>&1
// RUN: aiecc --no-xchesscc --no-xbridge --verbose --tmpdir=%t.all %s 2>&1
// RUN: aie-opt -aie-generate-column-control-overlay="route-shim-to-tile-ctrl=true" %s -o %t.ctrlpkt_overlay.mlir && aiecc --no-xchesscc --no-xbridge --device-name=device1 --aie-generate-ctrlpkt --verbose --tmpdir=%t.ctrlpkt %t.ctrlpkt_overlay.mlir 2>&1
// RUN: aiecc --no-xchesscc --no-xbridge --device-name=device1 --verbose --tmpdir=%t.dev1 %s 2>&1 | FileCheck %s --check-prefix=DEV1
// RUN: aiecc --no-xchesscc --no-xbridge --device-name=device2 --verbose --tmpdir=%t.dev2 %s 2>&1 | FileCheck %s --check-prefix=DEV2
// RUN: aiecc --no-xchesscc --no-xbridge --device-name=device1 --sequence-name=seq_a --aie-generate-npu-insts --verbose --tmpdir=%t.seq_a %s 2>&1 | FileCheck %s --check-prefix=DEV1_SEQ_A
// RUN: aiecc --no-xchesscc --no-xbridge --verbose --tmpdir=%t.all %s 2>&1 | FileCheck %s --check-prefix=ALL
// RUN: aie-opt -aie-generate-column-control-overlay="route-shim-to-tile-ctrl=true" %s -o %t.ctrlpkt_overlay.mlir && aiecc --no-xchesscc --no-xbridge --device-name=device1 --aie-generate-ctrlpkt --verbose --tmpdir=%t.ctrlpkt %t.ctrlpkt_overlay.mlir 2>&1 | FileCheck %s --check-prefix=CTRLPKT_DEV1

Copilot uses AI. Check for mistakes.

// DEV1: Removing non-matching device: device2
// DEV1: Processing device: device1
Expand Down
Loading