Linalg ops are perfect loop nests. When materializing the concrete loop nest, the default order specified by the Linalg op's iterators may not be the best for further CodeGen: targets frequently need to plan the loop order in order to gain better data access. And different targets can have different preferences. So there should exist a way to control the order. Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D91795
25 lines
1.0 KiB
MLIR
25 lines
1.0 KiB
MLIR
// RUN: mlir-opt %s -convert-linalg-to-loops="interchange-vector=4,0,3,1,2" | FileCheck --check-prefix=LOOP %s
|
|
// RUN: mlir-opt %s -convert-linalg-to-parallel-loops="interchange-vector=4,0,3,1,2" | FileCheck --check-prefix=PARALLEL %s
|
|
// RUN: mlir-opt %s -convert-linalg-to-affine-loops="interchange-vector=4,0,3,1,2" | FileCheck --check-prefix=AFFINE %s
|
|
|
|
func @copy(%input: memref<1x2x3x4x5xf32>, %output: memref<1x2x3x4x5xf32>) {
|
|
linalg.copy(%input, %output): memref<1x2x3x4x5xf32>, memref<1x2x3x4x5xf32>
|
|
return
|
|
}
|
|
|
|
// LOOP: scf.for %{{.*}} = %c0 to %c5 step %c1
|
|
// LOOP: scf.for %{{.*}} = %c0 to %c1 step %c1
|
|
// LOOP: scf.for %{{.*}} = %c0 to %c4 step %c1
|
|
// LOOP: scf.for %{{.*}} = %c0 to %c2 step %c1
|
|
// LOOP: scf.for %{{.*}} = %c0 to %c3 step %c1
|
|
|
|
// PARALLEL: scf.parallel
|
|
// PARALLEL-SAME: to (%c5, %c1, %c4, %c2, %c3)
|
|
|
|
// AFFINE: affine.for %{{.*}} = 0 to 5
|
|
// AFFINE: affine.for %{{.*}} = 0 to 1
|
|
// AFFINE: affine.for %{{.*}} = 0 to 4
|
|
// AFFINE: affine.for %{{.*}} = 0 to 2
|
|
// AFFINE: affine.for %{{.*}} = 0 to 3
|
|
|