brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · a1981fc Raw
111 lines · plain
1// RUN: mlir-opt --pass-pipeline="builtin.module(test-lazy-loading)" %s -o %t | FileCheck %s2// RUN: mlir-opt --pass-pipeline="builtin.module(test-lazy-loading{bytecode-version=1})" %s -o %t | FileCheck %s --check-prefix=OLD-BYTECODE3 4 5func.func @op_with_passthrough_region_args() {6  %0 = arith.constant 10 : index7 8  // Ensure we can handle nested non-isolated/non-lazy regions.9  "test.one_region_op"() ({10    "test.consumer"(%0) : (index) -> ()11  }) : () -> ()12 13  test.isolated_region %0 {14    "test.consumer"(%0) : (index) -> ()15  }16  %result:2 = "test.op"() : () -> (index, index)17  test.isolated_region %result#1 {18    "test.consumer"(%result#1) : (index) -> ()19  }20  21  test.isolated_regions {22    "test.unknown_op"() : () -> ()23  }, {24    "test.unknown_op"() : () -> ()25  }26  27  // Ensure operations that aren't tagged as IsolatedFromAbove can28  // still be lazy loaded if they don't have references to values29  // defined above.30  "test.one_region_op"() ({31    "test.unknown_op"() : () -> ()32  }) : () -> ()33 34  // Similar test as above, but check that if one region has a reference35  // to a value defined above, we don't lazy load the operation.36  "test.two_region_op"() ({37    "test.unknown_op"() : () -> ()38  }, {39    "test.consumer"(%0) : (index) -> ()40  }) : () -> ()41  return42}43 44// Before version 2, we can't support lazy loading.45// OLD-BYTECODE-NOT: Has 1 ops to materialize46// OLD-BYTECODE-NOT: Materializing47// OLD-BYTECODE: Has 0 ops to materialize48 49 50// CHECK: Has 1 ops to materialize51 52// CHECK: Before Materializing...53// CHECK: "builtin.module"() ({54// CHECK-NOT: func55// CHECK: Materializing...56// CHECK: "builtin.module"() ({57// CHECK: "func.func"() <{function_type = () -> (), sym_name = "op_with_passthrough_region_args"}> ({58// CHECK-NOT: arith59// CHECK: Has 1 ops to materialize60 61// CHECK: Before Materializing...62// CHECK: "func.func"() <{function_type = () -> (), sym_name = "op_with_passthrough_region_args"}> ({63// CHECK-NOT: arith64// CHECK: Materializing...65// CHECK: "func.func"() <{function_type = () -> (), sym_name = "op_with_passthrough_region_args"}> ({66// CHECK: arith67// CHECK: one_region_op68// CHECK: test.consumer69// CHECK: isolated_region70// CHECK-NOT: test.consumer71// CHECK: test.one_region_op72// CHECK-NOT: test.op73// CHECK: test.two_region_op74// CHECK: test.unknown_op75// CHECK: test.consumer76// CHECK: Has 4 ops to materialize77 78// CHECK: Before Materializing...79// CHECK: test.isolated_region80// CHECK-NOT:  test.consumer81// CHECK: Materializing...82// CHECK: test.isolated_region83// CHECK: ^bb0(%arg0: index):84// CHECK:  test.consumer85// CHECK: Has 3 ops to materialize86 87// CHECK: Before Materializing...88// CHECK: test.isolated_region89// CHECK-NOT: test.consumer90// CHECK: Materializing...91// CHECK: test.isolated_region92// CHECK: test.consumer93// CHECK: Has 2 ops to materialize94 95// CHECK: Before Materializing...96// CHECK: test.isolated_regions97// CHECK-NOT: test.unknown_op98// CHECK: Materializing...99// CHECK: test.isolated_regions100// CHECK: test.unknown_op101// CHECK: test.unknown_op102// CHECK: Has 1 ops to materialize103 104// CHECK: Before Materializing...105// CHECK: test.one_region_op106// CHECK-NOT: test.unknown_op107// CHECK: Materializing...108// CHECK: test.one_region_op109// CHECK: test.unknown_op110// CHECK: Has 0 ops to materialize111