xref: /llvm-project/mlir/test/Pass/dynamic-pipeline-nested.mlir (revision 13bd41096286305ee603428f6adf161f52981827)
1// RUN: mlir-opt %s -pass-pipeline='builtin.module(builtin.module(test-dynamic-pipeline{op-name=inner_mod1 dynamic-pipeline=cse}))'  --mlir-disable-threading  -mlir-print-ir-before-all 2>&1 | FileCheck %s --check-prefix=NOTNESTED --check-prefix=CHECK
2// RUN: mlir-opt %s -pass-pipeline='builtin.module(builtin.module(test-dynamic-pipeline{op-name=inner_mod1 run-on-nested-operations=1 dynamic-pipeline=cse}))'  --mlir-disable-threading  -mlir-print-ir-before-all 2>&1 | FileCheck %s --check-prefix=NESTED --check-prefix=CHECK
3
4
5// Verify that we can schedule a dynamic pipeline on a nested operation
6
7func.func @f() {
8  return
9}
10
11// CHECK: IR Dump Before
12// CHECK-SAME: TestDynamicPipelinePass
13// CHECK-NEXT: module @inner_mod1
14module @inner_mod1 {
15// We use the mlir-print-ir-after-all dumps to check the granularity of the
16// scheduling: if we are nesting we expect to see to individual "Dump Before
17// CSE" output: one for each of the function. If we don't nest, then we expect
18// the CSE pass to run on the `inner_mod1` module directly.
19
20// CHECK: Dump Before CSE
21// NOTNESTED-NEXT: @inner_mod1
22// NESTED-NEXT: @foo
23  module @foo {}
24// Only in the nested case we have a second run of the pass here.
25// NESTED: Dump Before CSE
26// NESTED-NEXT: @baz
27  module @baz {}
28}
29