From 153941cd3364f37e16f703fe9d70409595dbbf23 Mon Sep 17 00:00:00 2001 From: Hanchen Ye Date: Fri, 21 Jan 2022 03:14:04 -0600 Subject: [PATCH] Fix test cases --- lib/Dialect/HLSCpp/HLSCpp.cpp | 18 +++++++++--------- .../LegalizeToHLSCpp/test_assign.mlir | 2 +- test/Conversion/QuantizeOnnx.mlir | 2 +- test/EmitHLSCpp/test_signature.mlir | 6 ------ test/EmitHLSCpp/test_tensor.mlir | 2 +- 5 files changed, 12 insertions(+), 18 deletions(-) diff --git a/lib/Dialect/HLSCpp/HLSCpp.cpp b/lib/Dialect/HLSCpp/HLSCpp.cpp index cbcc3cd..2b7a2ff 100644 --- a/lib/Dialect/HLSCpp/HLSCpp.cpp +++ b/lib/Dialect/HLSCpp/HLSCpp.cpp @@ -55,8 +55,8 @@ Attribute ResourceAttr::parse(AsmParser &p, Type type) { } void ResourceAttr::print(AsmPrinter &p) const { - p << getMnemonic() << ""; + p << ""; } //===----------------------------------------------------------------------===// @@ -74,8 +74,8 @@ Attribute TimingAttr::parse(AsmParser &p, Type type) { } void TimingAttr::print(AsmPrinter &p) const { - p << getMnemonic() << "<" << getBegin() << " -> " << getEnd() << ", " - << getLatency() << ", " << getInterval() << ">"; + p << "<" << getBegin() << " -> " << getEnd() << ", " << getLatency() << ", " + << getInterval() << ">"; } //===----------------------------------------------------------------------===// @@ -102,7 +102,7 @@ Attribute LoopInfoAttr::parse(AsmParser &p, Type type) { } void LoopInfoAttr::print(AsmPrinter &p) const { - p << getMnemonic() << ""; } @@ -137,9 +137,9 @@ Attribute LoopDirectiveAttr::parse(AsmParser &p, Type type) { } void LoopDirectiveAttr::print(AsmPrinter &p) const { - p << getMnemonic() << ""; + p << ""; } //===----------------------------------------------------------------------===// @@ -170,7 +170,7 @@ Attribute FuncDirectiveAttr::parse(AsmParser &p, Type type) { } void FuncDirectiveAttr::print(AsmPrinter &p) const { - p << getMnemonic() << ""; } diff --git a/test/Conversion/LegalizeToHLSCpp/test_assign.mlir b/test/Conversion/LegalizeToHLSCpp/test_assign.mlir index 1843a0e..1436b62 100644 --- a/test/Conversion/LegalizeToHLSCpp/test_assign.mlir +++ b/test/Conversion/LegalizeToHLSCpp/test_assign.mlir @@ -5,7 +5,7 @@ func @test_assign(%arg0: f32, %arg1: memref<16xf32, 1>) -> (f32, memref<16xf32, 1>, i32, memref<2x2xi32, 1>) { %c11_i32 = arith.constant 11 : i32 %cst = arith.constant dense<[[11, 0], [0, -42]]> : tensor<2x2xi32> - %cst_memref = memref.buffer_cast %cst : memref<2x2xi32, 1> + %cst_memref = bufferization.to_memref %cst : memref<2x2xi32, 1> // CHECK: %1 = "hlscpp.assign"(%arg0) : (f32) -> f32 // CHECK: %2 = "hlscpp.assign"(%arg1) : (memref<16xf32, 1>) -> memref<16xf32, 1> diff --git a/test/Conversion/QuantizeOnnx.mlir b/test/Conversion/QuantizeOnnx.mlir index 06d51e4..7a3511d 100644 --- a/test/Conversion/QuantizeOnnx.mlir +++ b/test/Conversion/QuantizeOnnx.mlir @@ -164,7 +164,7 @@ module { call @dataflow4(%cst_0, %4, %arg2, %3) : (f32, memref<1x6x14x14xf32>, memref<16x6x5x5xf32>, memref<1x16x5x5xf32>) -> () call @dataflow3(%3, %cst_0, %2, %arg3, %cst, %arg4) : (memref<1x16x5x5xf32>, f32, memref<1x120xf32>, memref<120x400xf32>, f32, memref<120xf32>) -> () call @dataflow2(%2, %cst_0, %1, %arg5, %cst, %arg6) : (memref<1x120xf32>, f32, memref<1x84xf32>, memref<84x120xf32>, f32, memref<84xf32>) -> () - %5 = memref.buffer_cast %cst_1 : memref<10xf32> + %5 = bufferization.to_memref %cst_1 : memref<10xf32> call @dataflow1(%1, %cst_0, %0, %arg7, %cst, %5) : (memref<1x84xf32>, f32, memref<1x10xf32>, memref<10x84xf32>, f32, memref<10xf32>) -> () return %0 : memref<1x10xf32> } diff --git a/test/EmitHLSCpp/test_signature.mlir b/test/EmitHLSCpp/test_signature.mlir index 625a9c6..1c44da8 100644 --- a/test/EmitHLSCpp/test_signature.mlir +++ b/test/EmitHLSCpp/test_signature.mlir @@ -43,12 +43,6 @@ func @test_signature( // CHECK: int [[VAL_26:.*]] = 16; %0 = memref.dim %arg7, %c0 : memref<16x8xf32> - // CHECK: int [[VAL_28:.*]] = 2; - %3 = rank %arg7 : memref<16x8xf32> - - // CHECK: int [[VAL_29:.*]] = 2; - %4 = rank %arg8 : tensor<16x8xf32> - // CHECK: *[[VAL_13:.*]] = [[VAL_0:.*]]; // CHECK: for (int iv0 = 0; iv0 < 16; ++iv0) { // CHECK: for (int iv1 = 0; iv1 < 8; ++iv1) { diff --git a/test/EmitHLSCpp/test_tensor.mlir b/test/EmitHLSCpp/test_tensor.mlir index 848116f..4ce6c63 100644 --- a/test/EmitHLSCpp/test_tensor.mlir +++ b/test/EmitHLSCpp/test_tensor.mlir @@ -30,7 +30,7 @@ func @test_tensor_load_store(%arg0: memref<16x8xi32>) { // CHECK: [[VAL_0:.*]][iv0][iv1] = [[ARG_0:.*]][iv0][iv1]; // CHECK: } // CHECK: } - %0 = memref.tensor_load %arg0 : memref<16x8xi32> + %0 = bufferization.to_tensor %arg0 : memref<16x8xi32> // CHECK: for (int iv0 = 0; iv0 < 16; ++iv0) { // CHECK: for (int iv1 = 0; iv1 < 8; ++iv1) {