Skip to content

Commit

Permalink
add roundtrip test
Browse files Browse the repository at this point in the history
  • Loading branch information
jorendumoulin committed Nov 7, 2023
1 parent 19e8d10 commit 2e975c4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
18 changes: 18 additions & 0 deletions tests/filecheck/dialects/linalg_extension.mlir
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// RUN: XDSL_ROUNDTRIP

%0, %1, %2 = "test.op"() : () -> (memref<64xi32>, memref<64xi32>, memref<64xi32>)

"linalg.mul"(%0, %1, %2) <{operandSegmentSizes = array<i32: 2, 1>}> ({
^bb0(%arg2: i32, %arg3: i32, %arg4: i32):
%s1 = "arith.muli"(%arg2, %arg3) : (i32, i32) -> i32
"linalg.yield"(%s1) : (i32) -> ()
}) : (memref<64xi32>, memref<64xi32>, memref<64xi32>) -> ()

//CHECK: builtin.module {
//CHECK-NEXT: %0, %1, %2 = "test.op"() : () -> (memref<64xi32>, memref<64xi32>, memref<64xi32>)
//CHECK-NEXT: "linalg.mul"(%0, %1, %2) <{"operandSegmentSizes" = array<i32: 2, 1>}> ({
//CHECK-NEXT: ^0(%arg2 : i32, %arg3 : i32, %arg4 : i32):
//CHECK-NEXT: %s1 = arith.muli %arg2, %arg3 : i32
//CHECK-NEXT: linalg.yield %s1 : i32
//CHECK-NEXT: }) : (memref<64xi32>, memref<64xi32>, memref<64xi32>) -> ()
//CHECK-NEXT: }
4 changes: 2 additions & 2 deletions tests/filecheck/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ config.name = "SNAX"
config.test_format = lit.formats.ShTest(preamble_commands=[f"cd {snax_src}"])
config.suffixes = ['.test', '.mlir', '.py']

config.substitutions.append(('XDSL_ROUNDTRIP', "snax-opt %s --print-op-generic --split-input-file | snax-opt --split-input-file | filecheck %s"))
config.substitutions.append(("XDSL_GENERIC_ROUNDTRIP", "snax-opt %s --print-op-generic --split-input-file | filecheck %s --check-prefix=CHECK-GENERIC"))
config.substitutions.append(('XDSL_ROUNDTRIP', "./compiler/snax-opt %s --print-op-generic --split-input-file | ./compiler/snax-opt --split-input-file | filecheck %s"))
config.substitutions.append(("XDSL_GENERIC_ROUNDTRIP", "./compiler/snax-opt %s --print-op-generic --split-input-file | filecheck %s --check-prefix=CHECK-GENERIC"))

0 comments on commit 2e975c4

Please sign in to comment.