1// RUN: mlir-opt %s -split-input-file -verify-diagnostics
2
3#a = #sparse_tensor.encoding<{dimLevelType = []}>
4func.func private @scalar(%arg0: tensor<f64, #a>) -> () // expected-error {{expected non-scalar sparse tensor}}
5
6// -----
7
8#a = #sparse_tensor.encoding<{dimLevelType = ["dense", "compressed"]}>
9func.func private @tensor_size_mismatch(%arg0: tensor<8xi32, #a>) -> () // expected-error {{expected an array of size 1 for dimension level types}}
10
11// -----
12
13#a = #sparse_tensor.encoding<{dimLevelType = ["dense", "compressed"], dimOrdering = affine_map<(i) -> (i)>}> // expected-error {{unexpected mismatch in ordering and dimension level types size}}
14func.func private @tensor_sizes_mismatch(%arg0: tensor<8xi32, #a>) -> ()
15
16// -----
17
18#a = #sparse_tensor.encoding<{dimLevelType = [1]}> // expected-error {{expected a string value in dimension level types}}
19func.func private @tensor_type_mismatch(%arg0: tensor<8xi32, #a>) -> ()
20
21// -----
22
23#a = #sparse_tensor.encoding<{dimLevelType = ["strange"]}> // expected-error {{unexpected dimension level type: strange}}
24func.func private @tensor_value_mismatch(%arg0: tensor<8xi32, #a>) -> ()
25
26// -----
27
28#a = #sparse_tensor.encoding<{dimOrdering = "wrong"}> // expected-error {{expected an affine map for dimension ordering}}
29func.func private @tensor_order_mismatch(%arg0: tensor<8xi32, #a>) -> ()
30
31// -----
32
33#a = #sparse_tensor.encoding<{dimOrdering = affine_map<(i,j) -> (i,i)>}> // expected-error {{expected a permutation affine map for dimension ordering}}
34func.func private @tensor_no_permutation(%arg0: tensor<16x32xf32, #a>) -> ()
35
36// -----
37
38#a = #sparse_tensor.encoding<{pointerBitWidth = "x"}> // expected-error {{expected an integral pointer bitwidth}}
39func.func private @tensor_no_int_ptr(%arg0: tensor<16x32xf32, #a>) -> ()
40
41// -----
42
43#a = #sparse_tensor.encoding<{pointerBitWidth = 42}> // expected-error {{unexpected pointer bitwidth: 42}}
44func.func private @tensor_invalid_int_ptr(%arg0: tensor<16x32xf32, #a>) -> ()
45
46// -----
47
48#a = #sparse_tensor.encoding<{indexBitWidth = "not really"}> // expected-error {{expected an integral index bitwidth}}
49func.func private @tensor_no_int_index(%arg0: tensor<16x32xf32, #a>) -> ()
50
51// -----
52
53#a = #sparse_tensor.encoding<{indexBitWidth = 128}> // expected-error {{unexpected index bitwidth: 128}}
54func.func private @tensor_invalid_int_index(%arg0: tensor<16x32xf32, #a>) -> ()
55
56// -----
57
58#a = #sparse_tensor.encoding<{key = 1}> // expected-error {{unexpected key: key}}
59func.func private @tensor_invalid_key(%arg0: tensor<16x32xf32, #a>) -> ()
60