Files
clang-p2996/mlir/test/Bytecode/bytecode-lazy-loading.mlir
Mehdi Amini 3128b3105d Add support for Lazyloading to the MLIR bytecode
IsolatedRegions are emitted in sections in order for the reader to be
able to skip over them. A new class is exposed to manage the state and
allow the readers to load these IsolatedRegions on-demand.

Differential Revision: https://reviews.llvm.org/D149515
2023-05-20 15:24:33 -07:00

60 lines
1.8 KiB
MLIR

// RUN: mlir-opt --pass-pipeline="builtin.module(test-lazy-loading)" %s -o %t | FileCheck %s
// RUN: mlir-opt --pass-pipeline="builtin.module(test-lazy-loading{bytecode-version=1})" %s -o %t | FileCheck %s --check-prefix=OLD-BYTECODE
func.func @op_with_passthrough_region_args() {
%0 = arith.constant 10 : index
test.isolated_region %0 {
"test.consumer"(%0) : (index) -> ()
}
%result:2 = "test.op"() : () -> (index, index)
test.isolated_region %result#1 {
"test.consumer"(%result#1) : (index) -> ()
}
return
}
// Before version 2, we can't support lazy loading.
// OLD-BYTECODE-NOT: Has 1 ops to materialize
// OLD-BYTECODE-NOT: Materializing
// OLD-BYTECODE: Has 0 ops to materialize
// CHECK: Has 1 ops to materialize
// CHECK: Before Materializing...
// CHECK: "builtin.module"() ({
// CHECK-NOT: func
// CHECK: Materializing...
// CHECK: "builtin.module"() ({
// CHECK: "func.func"() <{function_type = () -> (), sym_name = "op_with_passthrough_region_args"}> ({
// CHECK-NOT: arith
// CHECK: Has 1 ops to materialize
// CHECK: Before Materializing...
// CHECK: "func.func"() <{function_type = () -> (), sym_name = "op_with_passthrough_region_args"}> ({
// CHECK-NOT: arith
// CHECK: Materializing...
// CHECK: "func.func"() <{function_type = () -> (), sym_name = "op_with_passthrough_region_args"}> ({
// CHECK: arith
// CHECK: isolated_region
// CHECK-NOT: test.consumer
// CHECK: Has 2 ops to materialize
// CHECK: Before Materializing...
// CHECK: test.isolated_region
// CHECK-NOT: test.consumer
// CHECK: Materializing...
// CHECK: test.isolated_region
// CHECK: ^bb0(%arg0: index):
// CHECK: test.consumer
// CHECK: Has 1 ops to materialize
// CHECK: Before Materializing...
// CHECK: test.isolated_region
// CHECK-NOT: test.consumer
// CHECK: Materializing...
// CHECK: test.isolated_region
// CHECK: test.consumer
// CHECK: Has 0 ops to materialize