Files
TheRock/compiler/amd-llvm/mlir/test/Analysis/test-toposort.mlir
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

117 lines
3.5 KiB
MLIR

// RUN: mlir-opt %s -topological-sort | FileCheck %s
// RUN: mlir-opt %s -test-topological-sort-analysis -verify-diagnostics | FileCheck %s -check-prefix=CHECK-ANALYSIS
// Test producer is after user.
// CHECK-LABEL: test.graph_region
// CHECK-ANALYSIS-LABEL: test.graph_region
test.graph_region attributes{"root"} {
// CHECK-NEXT: test.foo
// CHECK-NEXT: test.baz
// CHECK-NEXT: test.bar
// CHECK-ANALYSIS-NEXT: test.foo{{.*}} {pos = 0
// CHECK-ANALYSIS-NEXT: test.bar{{.*}} {pos = 2
// CHECK-ANALYSIS-NEXT: test.baz{{.*}} {pos = 1
%0 = "test.foo"() {selected} : () -> i32
"test.bar"(%1, %0) {selected} : (i32, i32) -> ()
%1 = "test.baz"() {selected} : () -> i32
}
// Test cycles.
// CHECK-LABEL: test.graph_region
// CHECK-ANALYSIS-LABEL: test.graph_region
test.graph_region attributes{"root"} {
// CHECK-NEXT: test.d
// CHECK-NEXT: test.a
// CHECK-NEXT: test.c
// CHECK-NEXT: test.b
// CHECK-ANALYSIS-NEXT: test.c{{.*}} {pos = 0
// CHECK-ANALYSIS-NEXT: test.b{{.*}} : (
// CHECK-ANALYSIS-NEXT: test.a{{.*}} {pos = 2
// CHECK-ANALYSIS-NEXT: test.d{{.*}} {pos = 1
%2 = "test.c"(%1) {selected} : (i32) -> i32
%1 = "test.b"(%0, %2) : (i32, i32) -> i32
%0 = "test.a"(%3) {selected} : (i32) -> i32
%3 = "test.d"() {selected} : () -> i32
}
// Test not all scheduled.
// CHECK-LABEL: test.graph_region
// CHECK-ANALYSIS-LABEL: test.graph_region
// expected-error@+1 {{could not schedule all ops}}
test.graph_region attributes{"root"} {
%0 = "test.a"(%1) {selected} : (i32) -> i32
%1 = "test.b"(%0) {selected} : (i32) -> i32
}
// CHECK-LABEL: func @test_multiple_blocks
// CHECK-ANALYSIS-LABEL: func @test_multiple_blocks
func.func @test_multiple_blocks() -> (i32) attributes{"root", "ordered"} {
// CHECK-ANALYSIS-NEXT: test.foo{{.*}} {pos = 0
%0 = "test.foo"() {selected = 2} : () -> (i32)
// CHECK-ANALYSIS-NEXT: test.foo
%1 = "test.foo"() : () -> (i32)
cf.br ^bb0
^bb0:
// CHECK-ANALYSIS: test.foo{{.*}} {pos = 1
%2 = "test.foo"() {selected = 3} : () -> (i32)
// CHECK-ANALYSIS-NEXT: test.bar{{.*}} {pos = 2
%3 = "test.bar"(%0, %1, %2) {selected = 0} : (i32, i32, i32) -> (i32)
cf.br ^bb1 (%2 : i32)
^bb1(%arg0: i32):
// CHECK-ANALYSIS: test.qux{{.*}} {pos = 3
%4 = "test.qux"(%arg0, %0) {selected = 1} : (i32, i32) -> (i32)
return %4 : i32
}
// Test block arguments.
// CHECK-LABEL: test.graph_region
test.graph_region {
// CHECK-NEXT: (%{{.*}}:
^entry(%arg0: i32):
// CHECK-NEXT: test.foo
// CHECK-NEXT: test.baz
// CHECK-NEXT: test.bar
%0 = "test.foo"(%arg0) : (i32) -> i32
"test.bar"(%1, %0) : (i32, i32) -> ()
%1 = "test.baz"(%arg0) : (i32) -> i32
}
// Test implicit block capture (and sort nested region).
// CHECK-LABEL: test.graph_region
func.func @test_graph_cfg() -> () {
%0 = "test.foo"() : () -> i32
cf.br ^next(%0 : i32)
^next(%1: i32):
test.graph_region {
// CHECK-NEXT: test.foo
// CHECK-NEXT: test.baz
// CHECK-NEXT: test.bar
%2 = "test.foo"(%1) : (i32) -> i32
"test.bar"(%3, %2) : (i32, i32) -> ()
%3 = "test.baz"(%0) : (i32) -> i32
}
return
}
// Test region ops (and recursive sort).
// CHECK-LABEL: test.graph_region
test.graph_region {
// CHECK-NEXT: test.baz
// CHECK-NEXT: test.graph_region attributes {a} {
// CHECK-NEXT: test.b
// CHECK-NEXT: test.a
// CHECK-NEXT: }
// CHECK-NEXT: test.bar
// CHECK-NEXT: test.foo
%0 = "test.foo"(%1) : (i32) -> i32
test.graph_region attributes {a} {
%a = "test.a"(%b) : (i32) -> i32
%b = "test.b"(%2) : (i32) -> i32
}
%1 = "test.bar"(%2) : (i32) -> i32
%2 = "test.baz"() : () -> i32
}