is `!fir.tdesc<T>`.
```mlir
- !T = type !fir.type<T{...}>
+ !T = !fir.type<T{...}>
%t = fir.gentypedesc !T // returns value of !fir.tdesc<!T>
```
}];
// 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) {
// -----
-!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) {
// 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>
// 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>)
// 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]]">>)>
### Type Aliases
```
-type-alias-def ::= '!' alias-name '=' 'type' type
+type-alias-def ::= '!' alias-name '=' type
type-alias ::= '!' alias-name
```
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> -> ()
// 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.
// 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
// 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>,
// 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>,
// 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,
}
for (const auto &it : llvm::make_filter_range(typeToAlias, filterFn)) {
it.second.print(os << '!');
- os << " = type " << it.first << newLine;
+ os << " = " << it.first << newLine;
}
}
/// 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));
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.
// -----
-!base_type = type memref<64xi32, 201>
+!base_type = memref<64xi32, 201>
// CHECK-LABEL: func @loop_carried
// BAREPTR-LABEL: func @loop_carried
// 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() {
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
// -----
// 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>
// -----
// 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
// -----
// 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
// -----
// 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
// 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>>
// -----
// 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
// -----
// 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}>
// 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
// -----
// 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
// 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
// -----
// 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
// -----
// 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
// -----
// 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
// -----
// 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
// -----
// 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
// -----
// 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
// -----
// 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
// -----
// 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
// -----
// 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
// -----
// 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
// -----
// 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
// -----
// 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
// -----
// 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
// -----
// 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
// -----
// expected-error @below {{type created with unregistered dialect}}
-!type = type !unregistered_dialect.type
+!type = !unregistered_dialect.type
// -----
-!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'}}
// -----
}
// 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.
// 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>>
// 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.
// 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" ],
// 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",
// 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" ],
// 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" ]
// 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" ],
// RUN: FileCheck %s
//
-!Filename = type !llvm.ptr<i8>
+!Filename = !llvm.ptr<i8>
#SparseMatrix = #sparse_tensor.encoding<{
dimLevelType = [ "compressed", "compressed" ],
// 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" ]
// 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" ]
# Return the MLIR text kernel.
return f"""
-!Ptr = type !llvm.ptr<i8>
+!Ptr = !llvm.ptr<i8>
#enc = #sparse_tensor.encoding<{{
dimLevelType = [ {sparsity} ]
}}>
# Return the MLIR text kernel.
return f"""
-!Ptr = type !llvm.ptr<i8>
+!Ptr = !llvm.ptr<i8>
#enc = #sparse_tensor.encoding<{{
dimLevelType = [ {sparsity} ]
}}>
// 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
// 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
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
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