xref: /llvm-project/mlir/test/Bytecode/versioning/versioned_op.mlir (revision cf0e8dca8496660fc18a8bbbb4da765027f2080d)
1// This file contains test cases related to the dialect post-parsing upgrade
2// mechanism.
3
4//===--------------------------------------------------------------------===//
5// Test generic
6//===--------------------------------------------------------------------===//
7
8// COM: bytecode contains
9// COM: module {
10// COM:   version: 2.0
11// COM:   "test.versionedA"() <{dims = 123 : i64, modifier = false}> : () -> ()
12// COM: }
13// RUN: mlir-opt %S/versioned-op-with-prop-2.0.mlirbc 2>&1 | FileCheck %s --check-prefix=CHECK1
14// CHECK1: "test.versionedA"() <{dims = 123 : i64, modifier = false}> : () -> ()
15
16//===--------------------------------------------------------------------===//
17// Test upgrade
18//===--------------------------------------------------------------------===//
19
20// COM: bytecode contains
21// COM: module {
22// COM:   version: 1.12
23// COM:   "test.versionedA"() <{dimensions = 123 : i64}> : () -> ()
24// COM: }
25// RUN: mlir-opt %S/versioned-op-with-prop-1.12.mlirbc 2>&1 | FileCheck %s --check-prefix=CHECK3
26// CHECK3: "test.versionedA"() <{dims = 123 : i64, modifier = false}> : () -> ()
27
28//===--------------------------------------------------------------------===//
29// Test forbidden downgrade
30//===--------------------------------------------------------------------===//
31
32// COM: bytecode contains
33// COM: module {
34// COM:   version: 2.2
35// COM:   "test.versionedA"() <{dims = 123 : i64, modifier = false}> : () -> ()
36// COM: }
37// RUN: not mlir-opt %S/versioned-op-2.2.mlirbc 2>&1 | FileCheck %s --check-prefix=ERR_NEW_VERSION
38// ERR_NEW_VERSION: current test dialect version is 2.0, can't parse version: 2.2
39