Skip to content
Merged
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
19 changes: 19 additions & 0 deletions lib/NeuraDialect/Transforms/CanonicalizeLiveInPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,25 @@ identifyDirectDominatingLiveIns(Region &region, DominanceInfo &dom_info,
continue;
}

// If the using block is a loop header (has a back-edge), we must NOT treat
// any live-in as a direct dominating live-in. This is because:
// 1. Live-ins from outer scopes have rate mismatch and need PHI_START
// 2. Live-ins from inner blocks are loop-carried dependencies that need PHI
bool using_block_is_loop_header = false;
for (Block *pred : block.getPredecessors()) {
if (dom_info.dominates(&block, pred)) {
using_block_is_loop_header = true;
break;
}
}

if (using_block_is_loop_header) {
// Skips direct dominating live-in optimization for loop headers.
// The value must be promoted to a block argument so that the
// transform-ctrl-to-data-flow pass creates an inner-rate PHI_START.
continue;
}

// Pattern 1: Single-Source-Single-Sink with one conditional branch.
if (isSingleSourceSingleSinkPattern(defining_block, &block, dom_info,
post_dom_info)) {
Expand Down
447 changes: 181 additions & 266 deletions test/e2e/bicg/bicg_int_kernel.mlir

Large diffs are not rendered by default.

436 changes: 313 additions & 123 deletions test/e2e/bicg/bicg_kernel.mlir

Large diffs are not rendered by default.

945 changes: 529 additions & 416 deletions test/e2e/fft/fft_kernel.mlir

Large diffs are not rendered by default.

577 changes: 346 additions & 231 deletions test/e2e/gemm/gemm_kernel.mlir

Large diffs are not rendered by default.

345 changes: 194 additions & 151 deletions test/e2e/gemv/gemv_kernel.mlir

Large diffs are not rendered by default.

512 changes: 382 additions & 130 deletions test/e2e/spmv/spmv_kernel.mlir

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions test/multi-cgra/taskflow/resnet/simple_resnet_tosa.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,8 @@ module attributes {torch.debug_module_name = "SimpleResNetBlock"} {
// KERNEL-NEXT: }
// KERNEL-NEXT: }



// STREAM: module attributes {torch.debug_module_name = "SimpleResNetBlock"} {
// STREAM-NEXT: memref.global "private" constant @__constant_64xf32 : memref<64xf32> = dense<0.000000e+00> {alignment = 64 : i64}
// STREAM-NEXT: memref.global "private" constant @__constant_64x3x3x64xf32_0 : memref<64x3x3x64xf32> = dense<-0.0151730878> {alignment = 64 : i64}
Expand Down
125 changes: 44 additions & 81 deletions test/neura/fusion/test.mlir

Large diffs are not rendered by default.