mirror of
https://github.com/intel/llvm.git
synced 2026-01-23 16:06:39 +08:00
[MLIR] Fix FileCheck annotations and add 32-bit coverage (#167149)
Addresses #93154 by ensuring the test RUN/FILECHECK prefixes across `mlir/test/Conversion/FuncToLLVM/` and related files match their expected outputs, and adds an `index-bitwidth=32` variant of `expand-then-convert-to-llvm.mlir` that exercises `@collapse_shape_dynamic_with_non_identity_layout` through the same MemRef-to-LLVM pipeline so the 32-bit layout descriptors are verified.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
// RUN: mlir-opt -set-llvm-module-datalayout -convert-func-to-llvm %s | FileCheck %s
|
||||
|
||||
// RUN-32: mlir-opt -set-llvm-module-datalayout='data-layout=p:32:32:32' -convert-func-to-llvm %s \
|
||||
// RUN-32: | FileCheck %s
|
||||
// RUN: mlir-opt -set-llvm-module-datalayout='data-layout=p:32:32:32' -convert-func-to-llvm %s \
|
||||
// RUN: | FileCheck %s --check-prefix=CHECK-32
|
||||
|
||||
// CHECK: module attributes {llvm.data_layout = ""}
|
||||
// CHECK-32: module attributes {llvm.data_layout ="p:32:32:32"}
|
||||
// CHECK-32: module attributes {llvm.data_layout = "p:32:32:32"}
|
||||
module {}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// RUN: mlir-opt -pass-pipeline="builtin.module(func.func(convert-arith-to-llvm),convert-func-to-llvm,convert-cf-to-llvm,reconcile-unrealized-casts)" -split-input-file %s | FileCheck %s
|
||||
// RUN: mlir-opt -pass-pipeline="builtin.module(func.func(convert-arith-to-llvm),convert-func-to-llvm{use-bare-ptr-memref-call-conv=1},convert-cf-to-llvm,reconcile-unrealized-casts)" -split-input-file %s | FileCheck %s --check-prefix=BAREPTR
|
||||
// RUN: mlir-opt -pass-pipeline="builtin.module(func.func(convert-arith-to-llvm{index-bitwidth=32}),convert-func-to-llvm{index-bitwidth=32},convert-cf-to-llvm{index-bitwidth=32},reconcile-unrealized-casts)" -split-input-file %s | FileCheck %s --check-prefix=CHECK32
|
||||
|
||||
// BAREPTR-LABEL: func @check_noalias
|
||||
// BAREPTR-SAME: %{{.*}}: !llvm.ptr {llvm.noalias}, %{{.*}}: !llvm.ptr {llvm.noalias}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// RUN: mlir-opt -expand-strided-metadata -finalize-memref-to-llvm -lower-affine -convert-arith-to-llvm -cse %s -split-input-file | FileCheck %s
|
||||
// RUN: mlir-opt -expand-strided-metadata -finalize-memref-to-llvm='index-bitwidth=32' -lower-affine -convert-arith-to-llvm='index-bitwidth=32' -cse %s -split-input-file | FileCheck %s --check-prefix=CHECK32
|
||||
//
|
||||
// This test demonstrates a full "memref to llvm" pipeline where
|
||||
// we first expand some of the memref operations (using affine,
|
||||
@@ -441,10 +442,31 @@ func.func @collapse_shape_dynamic_with_non_identity_layout(
|
||||
// CHECK: %[[RES:.*]] = builtin.unrealized_conversion_cast %[[DESC6]] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)> to memref<4x?xf32, strided<[?, ?], offset: ?>>
|
||||
// CHECK: return %[[RES]] : memref<4x?xf32, strided<[?, ?], offset: ?>>
|
||||
// CHECK: }
|
||||
// CHECK32-LABEL: func @collapse_shape_dynamic_with_non_identity_layout(
|
||||
// CHECK32: llvm.mlir.constant(1 : index) : i32
|
||||
// CHECK32: llvm.mlir.constant(4 : index) : i32
|
||||
// CHECK32: llvm.mlir.constant(1 : index) : i32
|
||||
// CHECK32-LABEL: func.func @collapse_shape_dynamic_with_non_identity_layout(
|
||||
// CHECK32-SAME: %[[ARG:.*]]: memref<4x?x?xf32, strided<[?, 4, 1], offset: ?>>) -> memref<4x?xf32, strided<[?, ?], offset: ?>> {
|
||||
// CHECK32: %[[MEM:.*]] = builtin.unrealized_conversion_cast %[[ARG]] : memref<4x?x?xf32, strided<[?, 4, 1], offset: ?>> to !llvm.struct<(ptr, ptr, i32, array<3 x i32>, array<3 x i32>)>
|
||||
// CHECK32: %[[BASE_BUFFER:.*]] = llvm.extractvalue %[[MEM]][0] : !llvm.struct<(ptr, ptr, i32,
|
||||
// CHECK32: %[[ALIGNED_BUFFER:.*]] = llvm.extractvalue %[[MEM]][1] : !llvm.struct<(ptr, ptr, i32,
|
||||
// CHECK32: %[[OFFSET:.*]] = llvm.extractvalue %[[MEM]][2] : !llvm.struct<(ptr, ptr, i32, array<3 x i32>, array<3 x i32>)>
|
||||
// CHECK32: %[[SIZE1:.*]] = llvm.extractvalue %[[MEM]][3, 1] : !llvm.struct<(ptr, ptr, i32, array<3 x i32>, array<3 x i32>)>
|
||||
// CHECK32: %[[SIZE2:.*]] = llvm.extractvalue %[[MEM]][3, 2] : !llvm.struct<(ptr, ptr, i32, array<3 x i32>, array<3 x i32>)>
|
||||
// CHECK32: %[[STRIDE0:.*]] = llvm.extractvalue %[[MEM]][4, 0] : !llvm.struct<(ptr, ptr, i32, array<3 x i32>, array<3 x i32>)>
|
||||
// CHECK32: %[[FINAL_SIZE1_I32:.*]] = llvm.mul %[[SIZE1]], %[[SIZE2]] overflow<nsw> : i32
|
||||
// CHECK32: %[[SIZE1_TO_IDX:.*]] = builtin.unrealized_conversion_cast %[[FINAL_SIZE1_I32]] : i32 to index
|
||||
// CHECK32: %[[FINAL_SIZE1_CAST:.*]] = builtin.unrealized_conversion_cast %[[SIZE1_TO_IDX]] : index to i32
|
||||
// CHECK32: %[[DESC:.*]] = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i32, array<2 x i32>, array<2 x i32>)>
|
||||
// CHECK32: %[[DESC0:.*]] = llvm.insertvalue %[[BASE_BUFFER]], %[[DESC]][0] : !llvm.struct<(ptr, ptr, i32, array<2 x i32>, array<2 x i32>)>
|
||||
// CHECK32: %[[DESC1:.*]] = llvm.insertvalue %[[ALIGNED_BUFFER]], %[[DESC0]][1] : !llvm.struct<(ptr, ptr, i32, array<2 x i32>, array<2 x i32>)>
|
||||
// CHECK32: %[[DESC2:.*]] = llvm.insertvalue %[[OFFSET]], %[[DESC1]][2] : !llvm.struct<(ptr, ptr, i32, array<2 x i32>, array<2 x i32>)>
|
||||
// CHECK32: %[[C4_I32:.*]] = llvm.mlir.constant(4 : index) : i32
|
||||
// CHECK32: %[[DESC3:.*]] = llvm.insertvalue %[[C4_I32]], %[[DESC2]][3, 0] : !llvm.struct<(ptr, ptr, i32, array<2 x i32>, array<2 x i32>)>
|
||||
// CHECK32: %[[DESC4:.*]] = llvm.insertvalue %[[STRIDE0]], %[[DESC3]][4, 0] : !llvm.struct<(ptr, ptr, i32, array<2 x i32>, array<2 x i32>)>
|
||||
// CHECK32: %[[DESC5:.*]] = llvm.insertvalue %[[FINAL_SIZE1_CAST]], %[[DESC4]][3, 1] : !llvm.struct<(ptr, ptr, i32, array<2 x i32>, array<2 x i32>)>
|
||||
// CHECK32: %[[C1_I32:.*]] = llvm.mlir.constant(1 : index) : i32
|
||||
// CHECK32: %[[DESC6:.*]] = llvm.insertvalue %[[C1_I32]], %[[DESC5]][4, 1] : !llvm.struct<(ptr, ptr, i32, array<2 x i32>, array<2 x i32>)>
|
||||
// CHECK32: %[[RES:.*]] = builtin.unrealized_conversion_cast %[[DESC6]] : !llvm.struct<(ptr, ptr, i32, array<2 x i32>, array<2 x i32>)> to memref<4x?xf32, strided<[?, ?], offset: ?>>
|
||||
// CHECK32: return %[[RES]] : memref<4x?xf32, strided<[?, ?], offset: ?>>
|
||||
// CHECK32: }
|
||||
|
||||
// -----
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// RUN: mlir-opt %s --split-input-file --duplicate-function-elimination | \
|
||||
// RUN: FileCheck %s
|
||||
// RUN: FileCheck %s --check-prefixes=CHECK,CHECK-2,CHECK-3
|
||||
|
||||
func.func @identity(%arg0: tensor<f32>) -> tensor<f32> {
|
||||
return %arg0 : tensor<f32>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// RUN: mlir-opt -split-input-file %s | FileCheck %s
|
||||
// RUN: mlir-opt -split-input-file %s | FileCheck %s --check-prefixes=CHECK,CHECK-3
|
||||
// Verify the printed output can be parsed.
|
||||
// RUN: mlir-opt -split-input-file %s | mlir-opt -split-input-file | FileCheck %s
|
||||
// RUN: mlir-opt -split-input-file %s | mlir-opt -split-input-file | FileCheck %s --check-prefixes=CHECK,CHECK-3
|
||||
// Verify the generic form can be parsed.
|
||||
// RUN: mlir-opt -split-input-file -mlir-print-op-generic %s | mlir-opt -split-input-file | FileCheck %s
|
||||
// RUN: mlir-opt -split-input-file -mlir-print-op-generic %s | mlir-opt -split-input-file | FileCheck %s --check-prefixes=CHECK,CHECK-3
|
||||
|
||||
func.func @compute1(%A: memref<10x10xf32>, %B: memref<10x10xf32>, %C: memref<10x10xf32>) -> memref<10x10xf32> {
|
||||
%c0 = arith.constant 0 : index
|
||||
|
||||
@@ -65,6 +65,9 @@ def NS_AOp : NS_Op<"a_op", [IsolatedFromAbove, IsolatedFromAbove]> {
|
||||
// CHECK: ::std::optional< ::llvm::APFloat > getSomeAttr2();
|
||||
// CHECK: ::mlir::Region &getSomeRegion() {
|
||||
// CHECK: ::mlir::RegionRange getSomeRegions() {
|
||||
// CHECK-NEXT: return odsRegions.drop_front(1);
|
||||
// CHECK: ::mlir::RegionRange getRegions() {
|
||||
// CHECK-NEXT: return odsRegions;
|
||||
// CHECK: };
|
||||
// CHECK: }
|
||||
|
||||
@@ -152,10 +155,6 @@ def NS_AOp : NS_Op<"a_op", [IsolatedFromAbove, IsolatedFromAbove]> {
|
||||
|
||||
// Check that `getAttrDictionary()` is used when not using properties.
|
||||
|
||||
// DECLS: ::mlir::RegionRange AOpGenericAdaptorBase::getSomeRegions()
|
||||
// DECLS-NEXT: return odsRegions.drop_front(1);
|
||||
// DECLS: ::mlir::RegionRange AOpGenericAdaptorBase::getRegions()
|
||||
|
||||
// Check AttrSizedOperandSegments
|
||||
// ---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user