llvm-project/mlir/test/Transforms/parallel-loop-collapsing.mlir
River Riddle f8479d9de5 [mlir] Set the namespace of the BuiltinDialect to 'builtin'
Historically the builtin dialect has had an empty namespace. This has unfortunately created a very awkward situation, where many utilities either have to special case the empty namespace, or just don't work at all right now. This revision adds a namespace to the builtin dialect, and starts to cleanup some of the utilities to no longer handle empty namespaces. For now, the assembly form of builtin operations does not require the `builtin.` prefix. (This should likely be re-evaluated though)

Differential Revision: https://reviews.llvm.org/D105149
2021-07-28 21:00:10 +00:00

47 lines
1.8 KiB
MLIR

// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='builtin.func(parallel-loop-collapsing{collapsed-indices-0=0,3 collapsed-indices-1=1,4 collapsed-indices-2=2}, canonicalize)' | FileCheck %s
// CHECK-LABEL: func @parallel_many_dims() {
func @parallel_many_dims() {
%c0 = constant 0 : index
%c1 = constant 1 : index
%c2 = constant 2 : index
%c3 = constant 3 : index
%c4 = constant 4 : index
%c5 = constant 5 : index
%c6 = constant 6 : index
%c7 = constant 7 : index
%c8 = constant 8 : index
%c9 = constant 9 : index
%c10 = constant 10 : index
%c11 = constant 11 : index
%c12 = constant 12 : index
%c13 = constant 13 : index
%c14 = constant 14 : index
%c15 = constant 15 : index
%c26 = constant 26 : index
scf.parallel (%i0, %i1, %i2, %i3, %i4) = (%c0, %c3, %c6, %c9, %c12)
to (%c2, %c5, %c8, %c26, %c14) step (%c1, %c4, %c7, %c10, %c13) {
%result = "magic.op"(%i0, %i1, %i2, %i3, %i4)
: (index, index, index, index, index) -> index
}
return
}
// CHECK-DAG: [[C12:%.*]] = constant 12 : index
// CHECK-DAG: [[C10:%.*]] = constant 10 : index
// CHECK-DAG: [[C9:%.*]] = constant 9 : index
// CHECK-DAG: [[C6:%.*]] = constant 6 : index
// CHECK-DAG: [[C4:%.*]] = constant 4 : index
// CHECK-DAG: [[C3:%.*]] = constant 3 : index
// CHECK-DAG: [[C2:%.*]] = constant 2 : index
// CHECK-DAG: [[C1:%.*]] = constant 1 : index
// CHECK-DAG: [[C0:%.*]] = constant 0 : index
// CHECK: scf.parallel ([[NEW_I0:%.*]]) = ([[C0]]) to ([[C4]]) step ([[C1]]) {
// CHECK: [[V0:%.*]] = remi_signed [[NEW_I0]], [[C2]] : index
// CHECK: [[I0:%.*]] = divi_signed [[NEW_I0]], [[C2]] : index
// CHECK: [[V2:%.*]] = muli [[V0]], [[C10]] : index
// CHECK: [[I3:%.*]] = addi [[V2]], [[C9]] : index
// CHECK: "magic.op"([[I0]], [[C3]], [[C6]], [[I3]], [[C12]]) : (index, index, index, index, index) -> index
// CHECK: scf.yield