Files
clang-p2996/mlir/test/Dialect/SparseTensor/invalid_encoding.mlir
Aart Bik 96a23911f6 [mlir][sparse] complete migration to sparse tensor type
A very elaborate, but also very fun revision because all
puzzle pieces are finally "falling in place".

1. replaces lingalg annotations + flags with proper sparse tensor types
2. add rigorous verification on sparse tensor type and sparse primitives
3. removes glue and clutter on opaque pointers in favor of sparse tensor types
4. migrates all tests to use sparse tensor types

NOTE: next CL will remove *all* obsoleted sparse code in Linalg

Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D102095
2021-05-10 12:55:22 -07:00

57 lines
2.3 KiB
MLIR

// RUN: mlir-opt %s -split-input-file -verify-diagnostics
// -----
#a = #sparse_tensor.encoding<{dimLevelType = ["dense", "compressed"]}>
func private @tensor_size_mismatch(%arg0: tensor<8xi32, #a>) -> () // expected-error {{expected an array of size 1 for dimension level types}}
// -----
#a = #sparse_tensor.encoding<{dimLevelType = ["dense", "compressed"], dimOrdering = affine_map<(i) -> (i)>}> // expected-error {{unexpected mismatch in ordering and dimension level types size}}
func private @tensor_sizes_mismatch(%arg0: tensor<8xi32, #a>) -> ()
// -----
#a = #sparse_tensor.encoding<{dimLevelType = [1]}> // expected-error {{expected a string value in dimension level types}}
func private @tensor_type_mismatch(%arg0: tensor<8xi32, #a>) -> ()
// -----
#a = #sparse_tensor.encoding<{dimLevelType = ["strange"]}> // expected-error {{unexpected dimension level type: strange}}
func private @tensor_value_mismatch(%arg0: tensor<8xi32, #a>) -> ()
// -----
#a = #sparse_tensor.encoding<{dimOrdering = "wrong"}> // expected-error {{expected an affine map for dimension ordering}}
func private @tensor_order_mismatch(%arg0: tensor<8xi32, #a>) -> ()
// -----
#a = #sparse_tensor.encoding<{dimOrdering = affine_map<(i,j) -> (i,i)>}> // expected-error {{expected a permutation affine map for dimension ordering}}
func private @tensor_no_permutation(%arg0: tensor<16x32xf32, #a>) -> ()
// -----
#a = #sparse_tensor.encoding<{pointerBitWidth = "x"}> // expected-error {{expected an integral pointer bitwidth}}
func private @tensor_no_int_ptr(%arg0: tensor<16x32xf32, #a>) -> ()
// -----
#a = #sparse_tensor.encoding<{pointerBitWidth = 42}> // expected-error {{unexpected pointer bitwidth: 42}}
func private @tensor_invalid_int_ptr(%arg0: tensor<16x32xf32, #a>) -> ()
// -----
#a = #sparse_tensor.encoding<{indexBitWidth = "not really"}> // expected-error {{expected an integral index bitwidth}}
func private @tensor_no_int_index(%arg0: tensor<16x32xf32, #a>) -> ()
// -----
#a = #sparse_tensor.encoding<{indexBitWidth = 128}> // expected-error {{unexpected index bitwidth: 128}}
func private @tensor_invalid_int_index(%arg0: tensor<16x32xf32, #a>) -> ()
// -----
#a = #sparse_tensor.encoding<{key = 1}> // expected-error {{unexpected key: key}}
func private @tensor_invalid_key(%arg0: tensor<16x32xf32, #a>) -> ()