[mlir] Remove the type keyword from type alias definitions

This was carry over from LLVM IR where the alias definition can
be ambiguous, but MLIR type aliases have no such problems.
Having the `type` keyword is superfluous and doesn't add anything.
This commit drops it, which also nicely aligns with the syntax for
attribute aliases (which doesn't have a keyword).

Differential Revision: https://reviews.llvm.org/D125501
This commit is contained in:
River Riddle 2022-05-12 13:36:05 -07:00
parent c8457eb532
commit a6cef03f66
36 changed files with 137 additions and 150 deletions

View File

@ -2576,7 +2576,7 @@ def fir_GenTypeDescOp : fir_OneResultOp<"gentypedesc", [NoSideEffect]> {
is `!fir.tdesc<T>`.
```mlir
!T = type !fir.type<T{...}>
!T = !fir.type<T{...}>
%t = fir.gentypedesc !T // returns value of !fir.tdesc<!T>
```
}];

View File

@ -2,7 +2,7 @@
// RUN: fir-opt --split-input-file --promote-to-affine --affine-loop-invariant-code-motion --cse %s | FileCheck %s
!arr_d1 = type !fir.ref<!fir.array<?xf32>>
!arr_d1 = !fir.ref<!fir.array<?xf32>>
#arr_len = affine_map<()[j1,k1] -> (k1 - j1 + 1)>
func.func @loop_with_load_and_store(%a1: !arr_d1, %a2: !arr_d1, %a3: !arr_d1) {
@ -75,7 +75,7 @@ func.func @loop_with_load_and_store(%a1: !arr_d1, %a2: !arr_d1, %a3: !arr_d1) {
// -----
!arr_d1 = type !fir.ref<!fir.array<?xf32>>
!arr_d1 = !fir.ref<!fir.array<?xf32>>
#arr_len = affine_map<()[j1,k1] -> (k1 - j1 + 1)>
func.func @loop_with_if(%a: !arr_d1, %v: f32) {

View File

@ -6,7 +6,7 @@
// RUN: fir-opt --array-value-copy %s | FileCheck %s
!t_with_alloc_comp = type !fir.type<t{i:!fir.box<!fir.heap<!fir.array<?xi32>>>}>
!t_with_alloc_comp = !fir.type<t{i:!fir.box<!fir.heap<!fir.array<?xi32>>>}>
func.func private @custom_assign(!fir.ref<!t_with_alloc_comp>, !fir.ref<!t_with_alloc_comp>)
func.func @test_overlap_with_alloc_components(%arg0: !fir.ref<!fir.array<10x!t_with_alloc_comp>>) {
%0 = fir.alloca !fir.box<!t_with_alloc_comp>

View File

@ -4,7 +4,7 @@
// Missing derived type descriptor pointers are replaced by null pointers.
// RUN: tco --ignore-missing-type-desc -o - %s | FileCheck %s
!some_freestyle_type = type !fir.type<some_not_mangled_type{j:i32}>
!some_freestyle_type = !fir.type<some_not_mangled_type{j:i32}>
func.func private @bar(!fir.box<!some_freestyle_type>)

View File

@ -5,10 +5,10 @@
// RUN: fir-opt --fir-to-llvm-ir="target=i386-unknown-linux-gnu" %s | FileCheck %s
// RUN: fir-opt --fir-to-llvm-ir="target=powerpc64le-unknown-linux-gn" %s | FileCheck %s
!t1 = type !fir.type<t1 {a1:!fir.ptr<!fir.type<t1>>}>
!t2 = type !fir.type<t2 {b1:f32,b2:!fir.ptr<!fir.type<t2>>,b3:i32,b4:!fir.ptr<!fir.type<t2>>}>
!t3 = type !fir.type<t3 {c1:!fir.ptr<!fir.type<t4>>}>
!t4 = type !fir.type<t4 {d1:!fir.ptr<!fir.type<t3>>}>
!t1 = !fir.type<t1 {a1:!fir.ptr<!fir.type<t1>>}>
!t2 = !fir.type<t2 {b1:f32,b2:!fir.ptr<!fir.type<t2>>,b3:i32,b4:!fir.ptr<!fir.type<t2>>}>
!t3 = !fir.type<t3 {c1:!fir.ptr<!fir.type<t4>>}>
!t4 = !fir.type<t4 {d1:!fir.ptr<!fir.type<t3>>}>
// CHECK-LABEL: llvm.func @recursiveTypes
// CHECK-SAME: %{{.*}}: !llvm.struct<"[[T1:.*]]", (ptr<struct<"[[T1]]">>)>

View File

@ -657,7 +657,7 @@ function-type ::= (type | type-list-parens) `->` (type | type-list-parens)
### Type Aliases
```
type-alias-def ::= '!' alias-name '=' 'type' type
type-alias-def ::= '!' alias-name '=' type
type-alias ::= '!' alias-name
```
@ -669,7 +669,7 @@ names are reserved for [dialect types](#dialect-types).
Example:
```mlir
!avx_m128 = type vector<4 x f32>
!avx_m128 = vector<4 x f32>
// Using the original type.
"foo"(%x) : vector<4 x f32> -> ()

View File

@ -367,8 +367,7 @@ func.func @foo(%arg0: memref<?xf32>) -> () {
// Gets converted to the following
// (using type alias for brevity):
!llvm.memref_1d = type !llvm.struct<(ptr<f32>, ptr<f32>, i64,
array<1xi64>, array<1xi64>)>
!llvm.memref_1d = !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<1xi64>, array<1xi64>)>
llvm.func @foo(%arg0: !llvm.ptr<f32>, // Allocated pointer.
%arg1: !llvm.ptr<f32>, // Aligned pointer.
@ -398,8 +397,7 @@ func.func @bar() {
// Gets converted to the following
// (using type alias for brevity):
!llvm.memref_1d = type !llvm.struct<(ptr<f32>, ptr<f32>, i64,
array<1xi64>, array<1xi64>)>
!llvm.memref_1d = !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<1xi64>, array<1xi64>)>
llvm.func @bar() {
%0 = "get"() : () -> !llvm.memref_1d
@ -619,8 +617,7 @@ func.func @qux(%arg0: memref<?x?xf32>)
// Gets converted into the following
// (using type alias for brevity):
!llvm.memref_2d = type !llvm.struct<(ptr<f32>, ptr<f32>, i64,
array<2xi64>, array<2xi64>)>
!llvm.memref_2d = !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2xi64>, array<2xi64>)>
// Function with unpacked arguments.
llvm.func @qux(%arg0: !llvm.ptr<f32>, %arg1: !llvm.ptr<f32>,
@ -665,10 +662,8 @@ func.func @foo(%arg0: memref<?x?xf32>) {
// Gets converted into the following
// (using type alias for brevity):
!llvm.memref_2d = type !llvm.struct<(ptr<f32>, ptr<f32>, i64,
array<2xi64>, array<2xi64>)>
!llvm.memref_2d_ptr = type !llvm.ptr<struct<(ptr<f32>, ptr<f32>, i64,
array<2xi64>, array<2xi64>)>>
!llvm.memref_2d = !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2xi64>, array<2xi64>)>
!llvm.memref_2d_ptr = !llvm.ptr<struct<(ptr<f32>, ptr<f32>, i64, array<2xi64>, array<2xi64>)>>
// Function with unpacked arguments.
llvm.func @foo(%arg0: !llvm.ptr<f32>, %arg1: !llvm.ptr<f32>,
@ -704,10 +699,8 @@ func.func @foo(%arg0: memref<?x?xf32>) -> memref<?x?xf32> {
// Gets converted into the following
// (using type alias for brevity):
!llvm.memref_2d = type !llvm.struct<(ptr<f32>, ptr<f32>, i64,
array<2xi64>, array<2xi64>)>
!llvm.memref_2d_ptr = type !llvm.ptr<struct<(ptr<f32>, ptr<f32>, i64,
array<2xi64>, array<2xi64>)>>
!llvm.memref_2d = !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2xi64>, array<2xi64>)>
!llvm.memref_2d_ptr = !llvm.ptr<struct<(ptr<f32>, ptr<f32>, i64, array<2xi64>, array<2xi64>)>>
// Function with unpacked arguments.
llvm.func @foo(%arg0: !llvm.ptr<f32>, %arg1: !llvm.ptr<f32>, %arg2: i64,

View File

@ -822,7 +822,7 @@ void AliasState::printAliases(raw_ostream &os, NewLineCounter &newLine,
}
for (const auto &it : llvm::make_filter_range(typeToAlias, filterFn)) {
it.second.print(os << '!');
os << " = type " << it.first << newLine;
os << " = " << it.first << newLine;
}
}

View File

@ -2105,7 +2105,7 @@ ParseResult TopLevelOperationParser::parseAttributeAliasDef() {
/// Parse a type alias declaration.
///
/// type-alias-def ::= '!' alias-name `=` 'type' type
/// type-alias-def ::= '!' alias-name `=` type
///
ParseResult TopLevelOperationParser::parseTypeAliasDef() {
assert(getToken().is(Token::exclamation_identifier));
@ -2119,12 +2119,10 @@ ParseResult TopLevelOperationParser::parseTypeAliasDef() {
if (aliasName.contains('.'))
return emitError("type names with a '.' are reserved for "
"dialect-defined names");
consumeToken(Token::exclamation_identifier);
// Parse the '=' and 'type'.
if (parseToken(Token::equal, "expected '=' in type alias definition") ||
parseToken(Token::kw_type, "expected 'type' in type alias definition"))
// Parse the '='.
if (parseToken(Token::equal, "expected '=' in type alias definition"))
return failure();
// Parse the type.

View File

@ -101,7 +101,7 @@ func.func @check_scalar_func_call(%in : f32) {
// -----
!base_type = type memref<64xi32, 201>
!base_type = memref<64xi32, 201>
// CHECK-LABEL: func @loop_carried
// BAREPTR-LABEL: func @loop_carried

View File

@ -197,10 +197,10 @@ func.func @ptr_elem_interface(%arg0: !llvm.ptr<!test.smpla>) {
// DialectAsmPrinter to have a mechanism for querying the presence and
// usability of an alias outside of its `printType` method.
!baz = type i64
!qux = type !llvm.struct<(!baz)>
!baz = i64
!qux = !llvm.struct<(!baz)>
!rec = type !llvm.struct<"a", (ptr<struct<"a">>)>
!rec = !llvm.struct<"a", (ptr<struct<"a">>)>
// CHECK: aliases
llvm.func @aliases() {

View File

@ -37,13 +37,13 @@ func.func @dot(%arg0: memref<?xf32, offset: ?, strides: [1]>,
library_call = "external_outerproduct_matmul"
}
!vector_type_A = type vector<4xf32>
!vector_type_B = type vector<4xf32>
!vector_type_C = type vector<4x4xf32>
!vector_type_A = vector<4xf32>
!vector_type_B = vector<4xf32>
!vector_type_C = vector<4x4xf32>
!matrix_type_A = type memref<?x?x!vector_type_A>
!matrix_type_B = type memref<?x?x!vector_type_B>
!matrix_type_C = type memref<?x?x!vector_type_C>
!matrix_type_A = memref<?x?x!vector_type_A>
!matrix_type_B = memref<?x?x!vector_type_B>
!matrix_type_C = memref<?x?x!vector_type_C>
func.func @matmul_vec_impl(%A: !matrix_type_A, %B: !matrix_type_B, %C: !matrix_type_C) {
linalg.generic #matmul_trait

View File

@ -3,59 +3,59 @@
// -----
// Unrecognized token: missing storage type maximum
// expected-error@+1 {{expected ':'}}
!qalias = type !quant.any<i8<16>:f32>
!qalias = !quant.any<i8<16>:f32>
// -----
// Unrecognized token: missing closing angle bracket
// expected-error@+1 {{expected '>'}}
!qalias = type !quant<"any<i8<-4:3:f32>">
!qalias = !quant<"any<i8<-4:3:f32>">
// -----
// Unrecognized token: missing type colon
// expected-error@+1 {{expected '>'}}
!qalias = type !quant.any<i8<-4:3>f32>
!qalias = !quant.any<i8<-4:3>f32>
// -----
// Unrecognized storage type: illegal prefix
// expected-error@+1 {{illegal storage type prefix}}
!qalias = type !quant.any<int8<-4:3>:f32>
!qalias = !quant.any<int8<-4:3>:f32>
// -----
// Unrecognized storage type: no width
// expected-error@+1 {{illegal storage type prefix}}
!qalias = type !quant.any<i<-4:3>:f32>
!qalias = !quant.any<i<-4:3>:f32>
// -----
// Unrecognized storage type: storage size > 32
// expected-error@+1 {{illegal storage type size: 33}}
!qalias = type !quant.any<i33:f32>
!qalias = !quant.any<i33:f32>
// -----
// Unrecognized storage type: storage size < 0
// expected-error@+1 {{illegal storage type size: 1024}}
!qalias = type !quant.any<i1024<-4:3>:f32>
!qalias = !quant.any<i1024<-4:3>:f32>
// -----
// Unrecognized storage type: storage size
// expected-error@+1 {{invalid integer width}}
!qalias = type !quant.any<i0123123123123123<-4:3>:f32>
!qalias = !quant.any<i0123123123123123<-4:3>:f32>
// -----
// Illegal storage min/max: max - min < 0
// expected-error@+1 {{illegal storage min and storage max: (2:1)}}
!qalias = type !quant.any<i8<2:1>:f32>
!qalias = !quant.any<i8<2:1>:f32>
// -----
// Illegal storage min/max: max - min == 0
// expected-error@+1 {{illegal storage min and storage max: (1:1)}}
!qalias = type !quant.any<i8<1:1>:f32>
!qalias = !quant.any<i8<1:1>:f32>
// -----
// Illegal storage min/max: max > defaultMax
// expected-error@+1 {{illegal storage type maximum: 9}}
!qalias = type !quant.any<i4<-1:9>:f32>
!qalias = !quant.any<i4<-1:9>:f32>
// -----
// Illegal storage min/max: min < defaultMin
// expected-error@+1 {{illegal storage type minimum: -9}}
!qalias = type !quant.any<i4<-9:1>:f32>
!qalias = !quant.any<i4<-9:1>:f32>

View File

@ -3,7 +3,7 @@
// -----
// CHECK-LABEL: parseFullySpecified
// CHECK: !quant.any<i8<-8:7>:f32>
!qalias = type !quant.any<i8<-8:7>:f32>
!qalias = !quant.any<i8<-8:7>:f32>
func.func @parseFullySpecified() -> !qalias {
%0 = "foo"() : () -> !qalias
return %0 : !qalias
@ -12,7 +12,7 @@ func.func @parseFullySpecified() -> !qalias {
// -----
// CHECK-LABEL: parseNoExpressedType
// CHECK: !quant.any<i8<-8:7>>
!qalias = type !quant.any<i8<-8:7>>
!qalias = !quant.any<i8<-8:7>>
func.func @parseNoExpressedType() -> !qalias {
%0 = "foo"() : () -> !qalias
return %0 : !qalias
@ -21,7 +21,7 @@ func.func @parseNoExpressedType() -> !qalias {
// -----
// CHECK-LABEL: parseOnlyStorageType
// CHECK: !quant.any<i8>
!qalias = type !quant.any<i8>
!qalias = !quant.any<i8>
func.func @parseOnlyStorageType() -> !qalias {
%0 = "foo"() : () -> !qalias
return %0 : !qalias

View File

@ -4,25 +4,25 @@
// Unrecognized token: missing calibrated type maximum
// expected-error@+2 {{calibrated values must be present}}
// expected-error@+1 {{expected ':'}}
!qalias = type !quant.calibrated<f32<-0.998>>
!qalias = !quant.calibrated<f32<-0.998>>
// -----
// Unrecognized token: missing closing angle bracket
// expected-error@+1 {{expected '>'}}
!qalias = type !quant<"calibrated<f32<-0.998:1.232>">
!qalias = !quant<"calibrated<f32<-0.998:1.232>">
// -----
// Unrecognized expressed type: integer type
// expected-error@+2 {{invalid kind of type specified}}
// expected-error@+1 {{expecting float expressed type}}
!qalias = type !quant.calibrated<i8<-4:3>>
!qalias = !quant.calibrated<i8<-4:3>>
// -----
// Illegal storage min/max: max - min < 0
// expected-error@+1 {{illegal min and max: (1.000000e+00:-1.000000e+00)}}
!qalias = type !quant.calibrated<f32<1.0:-1.0>>
!qalias = !quant.calibrated<f32<1.0:-1.0>>
// -----
// Illegal storage min/max: max - min == 0
// expected-error@+1 {{illegal min and max: (1.000000e+00:1.000000e+00)}}
!qalias = type !quant.calibrated<f32<1.0:1.0>>
!qalias = !quant.calibrated<f32<1.0:1.0>>

View File

@ -3,7 +3,7 @@
// -----
// CHECK-LABEL: parseCalibrated
// CHECK: !quant.calibrated<f32<-0.998:1.232100e+00>
!qalias = type !quant.calibrated<f32<-0.998:1.2321>>
!qalias = !quant.calibrated<f32<-0.998:1.2321>>
func.func @parseCalibrated() -> !qalias {
%0 = "foo"() : () -> !qalias
return %0 : !qalias

View File

@ -3,120 +3,120 @@
// -----
// Invalid type.
// expected-error@+1 {{unknown quantized type foobar}}
!qalias = type !quant.foobar
!qalias = !quant.foobar
// -----
// Unrecognized token: illegal token
// expected-error@+1 {{unknown quantized type __}}
!qalias = type !quant.__
!qalias = !quant.__
// -----
// Unrecognized token: trailing
// expected-error@+1 {{expected '>'}}
!qalias = type !quant.uniform<i8<-4:3>:f32, 0.99872:127 23>
!qalias = !quant.uniform<i8<-4:3>:f32, 0.99872:127 23>
// -----
// Unrecognized token: missing storage type maximum
// expected-error@+1 {{expected ':'}}
!qalias = type !quant.uniform<i8<16>:f32, 0.99872:127>
!qalias = !quant.uniform<i8<16>:f32, 0.99872:127>
// -----
// Unrecognized token: missing closing angle bracket
// expected-error@+1 {{expected '>'}}
!qalias = type !quant<"uniform<i8<-4:3:f32, 0.99872:127>">
!qalias = !quant<"uniform<i8<-4:3:f32, 0.99872:127>">
// -----
// Unrecognized token: missing type colon
// expected-error@+1 {{expected ':'}}
!qalias = type !quant.uniform<i8<-4:3>f32, 0.99872:127>
!qalias = !quant.uniform<i8<-4:3>f32, 0.99872:127>
// -----
// Unrecognized token: missing comma
// expected-error@+1 {{expected ','}}
!qalias = type !quant.uniform<i8<-4:3>:f32 0.99872:127>
!qalias = !quant.uniform<i8<-4:3>:f32 0.99872:127>
// -----
// Unrecognized storage type: illegal prefix
// expected-error@+1 {{illegal storage type prefix}}
!qalias = type !quant.uniform<int8<-4:3>:f32, 0.99872:127>
!qalias = !quant.uniform<int8<-4:3>:f32, 0.99872:127>
// -----
// Unrecognized storage type: no width
// expected-error@+1 {{illegal storage type prefix}}
!qalias = type !quant.uniform<i<-4:3>:f32, 0.99872:127>
!qalias = !quant.uniform<i<-4:3>:f32, 0.99872:127>
// -----
// Unrecognized storage type: storage size > 32
// expected-error@+1 {{illegal storage type size: 33}}
!qalias = type !quant.uniform<i33:f32, 0.99872:127>
!qalias = !quant.uniform<i33:f32, 0.99872:127>
// -----
// Unrecognized storage type: storage size < 0
// expected-error@+1 {{illegal storage type prefix}}
!qalias = type !quant.uniform<i-1<-4:3>:f32, 0.99872:127>
!qalias = !quant.uniform<i-1<-4:3>:f32, 0.99872:127>
// -----
// Unrecognized storage type: storage size
// expected-error@+1 {{invalid integer width}}
!qalias = type !quant.uniform<i123123123120<-4:3>:f32, 0.99872:127>
!qalias = !quant.uniform<i123123123120<-4:3>:f32, 0.99872:127>
// -----
// Illegal storage min/max: max - min < 0
// expected-error@+1 {{illegal storage min and storage max: (2:1)}}
!qalias = type !quant.uniform<i8<2:1>:f32, 0.99872:127>
!qalias = !quant.uniform<i8<2:1>:f32, 0.99872:127>
// -----
// Illegal storage min/max: max - min == 0
// expected-error@+1 {{illegal storage min and storage max: (1:1)}}
!qalias = type !quant.uniform<i8<1:1>:f32, 0.99872:127>
!qalias = !quant.uniform<i8<1:1>:f32, 0.99872:127>
// -----
// Illegal storage min/max: max > defaultMax
// expected-error@+1 {{illegal storage type maximum: 9}}
!qalias = type !quant.uniform<i4<-1:9>:f32, 0.99872:127>
!qalias = !quant.uniform<i4<-1:9>:f32, 0.99872:127>
// -----
// Illegal storage min/max: min < defaultMin
// expected-error@+1 {{illegal storage type minimum: -9}}
!qalias = type !quant.uniform<i4<-9:1>:f32, 0.99872:127>
!qalias = !quant.uniform<i4<-9:1>:f32, 0.99872:127>
// -----
// Illegal uniform params: invalid scale
// expected-error@+1 {{expected floating point literal}}
!qalias = type !quant.uniform<i8<-4:3>:f32, abc:127>
!qalias = !quant.uniform<i8<-4:3>:f32, abc:127>
// -----
// Illegal uniform params: invalid zero point separator
// expected-error@+1 {{expected '>'}}
!qalias = type !quant.uniform<i8<-4:3>:f32, 0.1abc>
!qalias = !quant.uniform<i8<-4:3>:f32, 0.1abc>
// -----
// Illegal uniform params: missing zero point
// expected-error@+1 {{expected integer value}}
!qalias = type !quant.uniform<i8<-4:3>:f32, 0.1:>
!qalias = !quant.uniform<i8<-4:3>:f32, 0.1:>
// -----
// Illegal uniform params: invalid zero point
// expected-error@+1 {{expected integer value}}
!qalias = type !quant.uniform<i8<-4:3>:f32, 0.1:abc>
!qalias = !quant.uniform<i8<-4:3>:f32, 0.1:abc>
// -----
// Illegal expressed type: f33
// expected-error@+1 {{expected non-function type}}
!qalias = type !quant.uniform<i8<-4:3>:f33, 0.99872:127>
!qalias = !quant.uniform<i8<-4:3>:f33, 0.99872:127>
// -----
// Illegal scale: negative
// expected-error@+1 {{illegal scale: -1.000000}}
!qalias = type !quant.uniform<i8<-4:3>:f32, -1.0:127>
!qalias = !quant.uniform<i8<-4:3>:f32, -1.0:127>
// -----
// Illegal uniform params: missing quantized dimension
// expected-error@+1 {{expected integer value}}
!qalias = type !quant.uniform<i8<-4:3>:f32:, {2.000000e+02:-19.987200e-01:1}>
!qalias = !quant.uniform<i8<-4:3>:f32:, {2.000000e+02:-19.987200e-01:1}>
// -----
// Illegal uniform params: unspecified quantized dimension, when multiple scales
// provided.
// expected-error@+1 {{expected floating point literal}}
!qalias = type !quant.uniform<i8<-4:3>:f32, {2.000000e+02,-19.987200e-01:1}>
!qalias = !quant.uniform<i8<-4:3>:f32, {2.000000e+02,-19.987200e-01:1}>

View File

@ -4,7 +4,7 @@
// All per-layer params specified:
// [signed] storageType, storageTypeMin, storageTypeMax, expressedType, scale, zeroPoint
// CHECK: !quant.uniform<i8<-8:7>:f32, 9.987200e-01:127>
!qalias = type !quant.uniform<i8<-8:7>:f32, 0.99872:127>
!qalias = !quant.uniform<i8<-8:7>:f32, 0.99872:127>
func.func @parse() -> !qalias {
%0 = "foo"() : () -> !qalias
return %0 : !qalias
@ -13,7 +13,7 @@ func.func @parse() -> !qalias {
// -----
// Trailing whitespace.
// CHECK: !quant.uniform<i8<-8:7>:f32, 9.987200e-01:127>
!qalias = type !quant.uniform<i8<-8:7>:f32, 0.99872:127 >
!qalias = !quant.uniform<i8<-8:7>:f32, 0.99872:127 >
func.func @parse() -> !qalias {
%0 = "foo"() : () -> !qalias
return %0 : !qalias
@ -23,7 +23,7 @@ func.func @parse() -> !qalias {
// Required per-layer params specified:
// [unsigned] storageType, expressedType, scale
// CHECK: !quant.uniform<u8:f32, 9.987200e-01>
!qalias = type !quant.uniform<u8:f32, 0.99872>
!qalias = !quant.uniform<u8:f32, 0.99872>
func.func @parse() -> !qalias {
%0 = "foo"() : () -> !qalias
return %0 : !qalias
@ -32,7 +32,7 @@ func.func @parse() -> !qalias {
// -----
// Exponential scale (-)
// CHECK: !quant.uniform<u8:f32, 2.000000e-02>
!qalias = type !quant.uniform<u8:f32, 2.0e-2>
!qalias = !quant.uniform<u8:f32, 2.0e-2>
func.func @parse() -> !qalias {
%0 = "foo"() : () -> !qalias
return %0 : !qalias
@ -41,7 +41,7 @@ func.func @parse() -> !qalias {
// -----
// Exponential scale (+)
// CHECK: !quant.uniform<u8:f32, 2.000000e+02>
!qalias = type !quant.uniform<u8:f32, 2.0e+2>
!qalias = !quant.uniform<u8:f32, 2.0e+2>
func.func @parse() -> !qalias {
%0 = "foo"() : () -> !qalias
return %0 : !qalias
@ -50,7 +50,7 @@ func.func @parse() -> !qalias {
// -----
// Storage type: i16
// CHECK: !quant.uniform<i16:f32, 2.000000e+02>
!qalias = type !quant.uniform<i16:f32, 2.0e+2>
!qalias = !quant.uniform<i16:f32, 2.0e+2>
func.func @parse() -> !qalias {
%0 = "foo"() : () -> !qalias
return %0 : !qalias
@ -59,7 +59,7 @@ func.func @parse() -> !qalias {
// -----
// Storage type: u16
// CHECK: !quant.uniform<u16:f32, 2.000000e+02>
!qalias = type !quant.uniform<u16:f32, 2.0e+2>
!qalias = !quant.uniform<u16:f32, 2.0e+2>
func.func @parse() -> !qalias {
%0 = "foo"() : () -> !qalias
return %0 : !qalias
@ -68,7 +68,7 @@ func.func @parse() -> !qalias {
// -----
// Storage type: i32
// CHECK: !quant.uniform<i32:f32, 2.000000e+02>
!qalias = type !quant.uniform<i32:f32, 2.0e+2>
!qalias = !quant.uniform<i32:f32, 2.0e+2>
func.func @parse() -> !qalias {
%0 = "foo"() : () -> !qalias
return %0 : !qalias
@ -77,7 +77,7 @@ func.func @parse() -> !qalias {
// -----
// Storage type: u32
// CHECK: !quant.uniform<u32:f32, 2.000000e+02>
!qalias = type !quant.uniform<u32:f32, 2.0e+2>
!qalias = !quant.uniform<u32:f32, 2.0e+2>
func.func @parse() -> !qalias {
%0 = "foo"() : () -> !qalias
return %0 : !qalias
@ -86,7 +86,7 @@ func.func @parse() -> !qalias {
// -----
// Expressed type: f32
// CHECK: !quant.uniform<u8:f32, 2.000000e+02>
!qalias = type !quant.uniform<u8:f32, 2.0e+2>
!qalias = !quant.uniform<u8:f32, 2.0e+2>
func.func @parse() -> !qalias {
%0 = "foo"() : () -> !qalias
return %0 : !qalias
@ -95,7 +95,7 @@ func.func @parse() -> !qalias {
// -----
// Expressed type: f32
// CHECK: !quant.uniform<u8:f32, 0x41646ABBA0000000:128>
!qalias = type !quant.uniform<u8:f32, 0x41646ABBA0000000:128>
!qalias = !quant.uniform<u8:f32, 0x41646ABBA0000000:128>
func.func @parse() -> !qalias {
%0 = "foo"() : () -> !qalias
return %0 : !qalias
@ -104,7 +104,7 @@ func.func @parse() -> !qalias {
// -----
// Expressed type: f16
// CHECK: !quant.uniform<u8:f16, 2.000000e+02>
!qalias = type !quant.uniform<u8:f16, 2.0e+2>
!qalias = !quant.uniform<u8:f16, 2.0e+2>
func.func @parse() -> !qalias {
%0 = "foo"() : () -> !qalias
return %0 : !qalias
@ -113,7 +113,7 @@ func.func @parse() -> !qalias {
// -----
// Expressed type: f64
// CHECK: !quant.uniform<u8:f64, 2.000000e+02>
!qalias = type !quant.uniform<u8:f64, 2.0e+2>
!qalias = !quant.uniform<u8:f64, 2.0e+2>
func.func @parse() -> !qalias {
%0 = "foo"() : () -> !qalias
return %0 : !qalias
@ -122,7 +122,7 @@ func.func @parse() -> !qalias {
// -----
// Expressed type: bf16
// CHECK: !quant.uniform<u8:bf16, 2.000000e+02>
!qalias = type !quant.uniform<u8:bf16, 2.0e+2>
!qalias = !quant.uniform<u8:bf16, 2.0e+2>
func.func @parse() -> !qalias {
%0 = "foo"() : () -> !qalias
return %0 : !qalias
@ -131,7 +131,7 @@ func.func @parse() -> !qalias {
// -----
// Per-axis scales and zero points (affine)
// CHECK: !quant.uniform<u8:f32:1, {2.000000e+02:-120,9.987200e-01:127}>
!qalias = type !quant.uniform<u8:f32:1, {2.0e+2:-120,0.99872:127}>
!qalias = !quant.uniform<u8:f32:1, {2.0e+2:-120,0.99872:127}>
func.func @parse() -> !qalias {
%0 = "foo"() : () -> !qalias
return %0 : !qalias
@ -140,7 +140,7 @@ func.func @parse() -> !qalias {
// -----
// Per-axis scales and no zero points (fixedpoint)
// CHECK: !quant.uniform<i8:f32:1, {2.000000e+02,9.987200e-01}>
!qalias = type !quant.uniform<i8:f32:1, {2.0e+2,0.99872}>
!qalias = !quant.uniform<i8:f32:1, {2.0e+2,0.99872}>
func.func @parse() -> !qalias {
%0 = "foo"() : () -> !qalias
return %0 : !qalias
@ -149,7 +149,7 @@ func.func @parse() -> !qalias {
// -----
// Per-axis scales and zero points (mixed affine and fixedpoint)
// CHECK: !quant.uniform<i8:f32:1, {2.000000e+02,9.987200e-01:120}>
!qalias = type !quant.uniform<i8:f32:1, {2.0e+2,0.99872:120}>
!qalias = !quant.uniform<i8:f32:1, {2.0e+2,0.99872:120}>
func.func @parse() -> !qalias {
%0 = "foo"() : () -> !qalias
return %0 : !qalias

View File

@ -11,4 +11,4 @@
// -----
// expected-error @below {{type created with unregistered dialect}}
!type = type !unregistered_dialect.type
!type = !unregistered_dialect.type

View File

@ -881,20 +881,16 @@ func.func @type_alias_unknown(!unknown_alias) -> () { // expected-error {{undefi
// -----
!missing_eq_alias type i32 // expected-error {{expected '=' in type alias definition}}
!missing_eq_alias i32 // expected-error {{expected '=' in type alias definition}}
// -----
!missing_kw_type_alias = i32 // expected-error {{expected 'type' in type alias definition}}
!missing_type_alias = // expected-error {{expected non-function type}}
// -----
!missing_type_alias = type // expected-error {{expected non-function type}}
// -----
!redef_alias = type i32
!redef_alias = type i32 // expected-error {{redefinition of type alias id 'redef_alias'}}
!redef_alias = i32
!redef_alias = i32 // expected-error {{redefinition of type alias id 'redef_alias'}}
// -----

View File

@ -832,7 +832,7 @@ func.func @unknown_dialect_type() -> !bar<""> {
}
// CHECK-LABEL: func @type_alias() -> i32 {
!i32_type_alias = type i32
!i32_type_alias = i32
func.func @type_alias() -> !i32_type_alias {
// Return a non-aliased i32 type.

View File

@ -15,16 +15,16 @@
// CHECK-DAG: #test_alias_conflict0_1 = "alias_test:sanitize_conflict_b"
"test.op"() {alias_test = ["alias_test:sanitize_conflict_a", "alias_test:sanitize_conflict_b"]} : () -> ()
// CHECK-DAG: !tuple = type tuple<i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32>
// CHECK-DAG: !tuple = tuple<i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32>
"test.op"() {alias_test = "alias_test:large_tuple"} : () -> (tuple<i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32>)
// CHECK-DAG: !test_tuple = type tuple<!test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla>
// CHECK-DAG: !test_tuple = tuple<!test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla>
"test.op"() {alias_test = "alias_test:large_tuple"} : () -> (tuple<!test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla, !test.smpla>)
// CHECK-DAG: #test_encoding = "alias_test:tensor_encoding"
// CHECK-DAG: tensor<32xf32, #test_encoding>
"test.op"() : () -> tensor<32xf32, "alias_test:tensor_encoding">
// CHECK-DAG: !test_ui8_ = type !test.int<unsigned, 8>
// CHECK-DAG: !test_ui8_ = !test.int<unsigned, 8>
// CHECK-DAG: tensor<32x!test_ui8_>
"test.op"() : () -> tensor<32x!test.int<unsigned, 8>>

View File

@ -15,12 +15,12 @@
// RUN: tee -a /dev/stderr | FileCheck %s
!elem_type_a = type f32
!elem_type_b = type f32
!elem_type_c = type f32
!row_major_A = type memref<${M}x${K}x!elem_type_a>
!row_major_B = type memref<${K}x${N}x!elem_type_b>
!row_major_C = type memref<${M}x${N}x!elem_type_c>
!elem_type_a = f32
!elem_type_b = f32
!elem_type_c = f32
!row_major_A = memref<${M}x${K}x!elem_type_a>
!row_major_B = memref<${K}x${N}x!elem_type_b>
!row_major_C = memref<${M}x${N}x!elem_type_c>
func.func @matmul(%a: !row_major_A, %b: !row_major_B, %c: !row_major_C)
// TODO: activate manually for now.

View File

@ -5,7 +5,7 @@
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_c_runner_utils%shlibext | \
// RUN: FileCheck %s
!Filename = type !llvm.ptr<i8>
!Filename = !llvm.ptr<i8>
#DenseMatrix = #sparse_tensor.encoding<{
dimLevelType = [ "dense", "dense" ],

View File

@ -14,7 +14,7 @@
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_c_runner_utils%shlibext | \
// RUN: FileCheck %s
!Filename = type !llvm.ptr<i8>
!Filename = !llvm.ptr<i8>
#SparseTensor = #sparse_tensor.encoding<{
dimLevelType = [ "compressed", "compressed", "compressed", "compressed",

View File

@ -15,7 +15,7 @@
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_c_runner_utils%shlibext | \
// RUN: FileCheck %s
!Filename = type !llvm.ptr<i8>
!Filename = !llvm.ptr<i8>
#SparseMatrix = #sparse_tensor.encoding<{
dimLevelType = [ "dense", "compressed" ],

View File

@ -14,7 +14,7 @@
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_c_runner_utils%shlibext | \
// RUN: FileCheck %s
!Filename = type !llvm.ptr<i8>
!Filename = !llvm.ptr<i8>
#SparseTensor = #sparse_tensor.encoding<{
dimLevelType = [ "compressed", "compressed", "compressed" ]

View File

@ -14,7 +14,7 @@
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_c_runner_utils%shlibext | \
// RUN: FileCheck %s
!Filename = type !llvm.ptr<i8>
!Filename = !llvm.ptr<i8>
#DCSR = #sparse_tensor.encoding<{
dimLevelType = [ "compressed", "compressed" ],

View File

@ -16,7 +16,7 @@
// RUN: FileCheck %s
//
!Filename = type !llvm.ptr<i8>
!Filename = !llvm.ptr<i8>
#SparseMatrix = #sparse_tensor.encoding<{
dimLevelType = [ "compressed", "compressed" ],

View File

@ -14,7 +14,7 @@
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_c_runner_utils%shlibext | \
// RUN: FileCheck %s
!Filename = type !llvm.ptr<i8>
!Filename = !llvm.ptr<i8>
#SparseMatrix = #sparse_tensor.encoding<{
dimLevelType = [ "dense", "compressed" ]

View File

@ -14,7 +14,7 @@
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_c_runner_utils%shlibext | \
// RUN: FileCheck %s
!Filename = type !llvm.ptr<i8>
!Filename = !llvm.ptr<i8>
#SparseMatrix = #sparse_tensor.encoding<{
dimLevelType = [ "compressed", "compressed" ]

View File

@ -247,7 +247,7 @@ def _get_create_sparse_tensor_kernel(
# Return the MLIR text kernel.
return f"""
!Ptr = type !llvm.ptr<i8>
!Ptr = !llvm.ptr<i8>
#enc = #sparse_tensor.encoding<{{
dimLevelType = [ {sparsity} ]
}}>
@ -323,7 +323,7 @@ def _get_output_sparse_tensor_kernel(
# Return the MLIR text kernel.
return f"""
!Ptr = type !llvm.ptr<i8>
!Ptr = !llvm.ptr<i8>
#enc = #sparse_tensor.encoding<{{
dimLevelType = [ {sparsity} ]
}}>

View File

@ -3,15 +3,15 @@
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_c_runner_utils%shlibext | \
// RUN: FileCheck %s
!vector_type_A = type vector<8xf32>
!vector_type_B = type vector<8xf32>
!vector_type_C = type vector<8x8xf32>
!vector_type_A = vector<8xf32>
!vector_type_B = vector<8xf32>
!vector_type_C = vector<8x8xf32>
!vector_type_X = type vector<2xf32>
!vector_type_Y = type vector<3xf32>
!vector_type_Z = type vector<2x3xf32>
!vector_type_X = vector<2xf32>
!vector_type_Y = vector<3xf32>
!vector_type_Z = vector<2x3xf32>
!vector_type_R = type vector<7xf32>
!vector_type_R = vector<7xf32>
func.func @vector_outerproduct_splat_8x8(%fa: f32, %fb: f32, %fc: f32) -> !vector_type_C {
%a = vector.splat %fa: !vector_type_A

View File

@ -3,15 +3,15 @@
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_c_runner_utils%shlibext | \
// RUN: FileCheck %s
!vector_type_A = type vector<8xi64>
!vector_type_B = type vector<8xi64>
!vector_type_C = type vector<8x8xi64>
!vector_type_A = vector<8xi64>
!vector_type_B = vector<8xi64>
!vector_type_C = vector<8x8xi64>
!vector_type_X = type vector<2xi64>
!vector_type_Y = type vector<3xi64>
!vector_type_Z = type vector<2x3xi64>
!vector_type_X = vector<2xi64>
!vector_type_Y = vector<3xi64>
!vector_type_Z = vector<2x3xi64>
!vector_type_R = type vector<7xi64>
!vector_type_R = vector<7xi64>
func.func @vector_outerproduct_splat_8x8(%ia: i64, %ib: i64, %ic: i64) -> !vector_type_C {
%a = vector.splat %ia: !vector_type_A

View File

@ -51,8 +51,8 @@ func.func @print_3d() {
func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }
!vector_type_C = type vector<4x4xf32>
!matrix_type_CC = type memref<1x1x!vector_type_C>
!vector_type_C = vector<4x4xf32>
!matrix_type_CC = memref<1x1x!vector_type_C>
func.func @vector_splat_2d() {
%c0 = arith.constant 0 : index
%f10 = arith.constant 10.0 : f32

View File

@ -161,9 +161,9 @@ module.exports = grammar({
choice($.type, $.type_list_parens)),
// Type aliases
// type-alias-def ::= '!' alias-name '=' 'type' type
// type-alias-def ::= '!' alias-name '=' type
// type-alias ::= '!' alias-name
type_alias_def : $ => seq('!', $.alias_name, '=', 'type', $.type),
type_alias_def : $ => seq('!', $.alias_name, '=', $.type),
type_alias : $ => seq('!', $.alias_name),
// Dialect Types