Skip to content
Open
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
2 changes: 1 addition & 1 deletion mlir/include/mlir/Dialect/SCF/IR/SCFOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def ConditionOp : SCF_Op<"condition", [
//===----------------------------------------------------------------------===//

def ExecuteRegionOp : SCF_Op<"execute_region", [
DeclareOpInterfaceMethods<RegionBranchOpInterface>]> {
DeclareOpInterfaceMethods<RegionBranchOpInterface>, RecursiveMemoryEffects]> {
let summary = "operation that executes its region exactly once";
let description = [{
The `scf.execute_region` operation is used to allow multiple blocks within SCF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,24 @@ func.func @manual_deallocation(%c: i1, %f: f32, %idx: index) -> f32 {
// CHECK: cf.assert %[[true]], "expected that the block does not have ownership"
// CHECK: memref.dealloc %[[manual_alloc]]
// CHECK: bufferization.dealloc (%[[managed_alloc]] : memref<5xf32>) if (%[[true]])

// -----

// CHECK-LABEL: func.func private @properly_creats_deallocations_in_execute_region(
Copy link
Member

Choose a reason for hiding this comment

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

typo here, which makes the test fail

// CHECK: %[[true:.*]] = arith.constant true
// CHECK: scf.execute_region no_inline {
// CHECK: %[[alloc:.*]] = memref.alloc() {alignment = 64 : i64} : memref<1x63x378x16xui8>
// CHECK: bufferization.dealloc (%[[alloc]] : memref<1x63x378x16xui8>) if (%[[true]])

func.func private @properly_creates_deallocations_in_execute_region(%arg1: memref<1x16x252x380xui8> ) -> (memref<1x250x378x16xui8> ) {
%alloc = memref.alloc() {alignment = 64 : i64} : memref<1x250x378x16xui8>
scf.execute_region no_inline {
%subview = memref.subview %arg1[0, 0, 0, 0] [1, 16, 65, 380] [1, 1, 1, 1] : memref<1x16x252x380xui8> to memref<1x16x65x380xui8, strided<[1532160, 95760, 380, 1]>>
%alloc_3 = memref.alloc() {alignment = 64 : i64} : memref<1x63x378x16xui8>
test.buffer_based in(%subview: memref<1x16x65x380xui8, strided<[1532160, 95760, 380, 1]>>) out(%alloc_3: memref<1x63x378x16xui8>)
%subview_7 = memref.subview %alloc[0, 0, 0, 0] [1, 63, 378, 16] [1, 1, 1, 1] : memref<1x250x378x16xui8> to memref<1x63x378x16xui8, strided<[1512000, 6048, 16, 1]>>
test.copy(%alloc_3, %subview_7) : (memref<1x63x378x16xui8>, memref<1x63x378x16xui8, strided<[1512000, 6048, 16, 1]>>)
scf.yield
}
return %alloc : memref<1x250x378x16xui8>
}
Original file line number Diff line number Diff line change
Expand Up @@ -381,15 +381,19 @@ func.func private @execute_region_test(%t1 : tensor<?xf32>)
// -----

// CHECK-LABEL: func @no_inline_execute_region_not_canonicalized
func.func @no_inline_execute_region_not_canonicalized() {
%c = arith.constant 42 : i32
// CHECK: scf.execute_region
// CHECK-SAME: no_inline
%v = scf.execute_region -> i32 no_inline {
scf.yield %c : i32
module {
func.func private @foo()->()
func.func @no_inline_execute_region_not_canonicalized() {
%c = arith.constant 42 : i32
// CHECK: scf.execute_region
// CHECK-SAME: no_inline
%v = scf.execute_region -> i32 no_inline {
func.call @foo():()->()
scf.yield %c : i32
}
// CHECK: return
return
}
// CHECK: return
return
}

// -----
Expand Down
Loading