diff --git a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp --- a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp +++ b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp @@ -260,16 +260,15 @@ Attribute attr; RETURN_ON_FAIL(parser.parseAttribute(attr)); auto arrayAttr = llvm::dyn_cast(attr); - ERROR_IF(!arrayAttr, "expected an array for dimension level types") + ERROR_IF(!arrayAttr, "expected an array for lvlTypes") for (auto i : arrayAttr) { auto strAttr = llvm::dyn_cast(i); - ERROR_IF(!strAttr, "expected a string value in dimension level types") + ERROR_IF(!strAttr, "expected a string value in lvlTypes") auto strVal = strAttr.getValue(); if (auto optDLT = parseDLT(strVal)) { lvlTypes.push_back(optDLT.value()); } else { - parser.emitError(parser.getNameLoc(), - "unexpected dimension level type: ") + parser.emitError(parser.getNameLoc(), "unexpected level-type: ") << strVal; return {}; } @@ -378,14 +377,14 @@ // use that same source-of-truth here. const Level lvlRank = lvlTypes.size(); if (lvlRank == 0) - return emitError() << "expected a non-empty array for level types"; + return emitError() << "expected a non-empty array for lvlTypes"; if (dimOrdering) { if (!dimOrdering.isPermutation()) return emitError() << "expected a permutation affine map for dimension ordering"; if (dimOrdering.getNumResults() != lvlRank) - return emitError() << "unexpected mismatch in ordering and dimension " - "level types size"; + return emitError() + << "level-rank mismatch between dimOrdering and lvlTypes"; } if (higherOrdering) { if (higherOrdering.getNumDims() >= higherOrdering.getNumResults()) @@ -393,12 +392,11 @@ << higherOrdering.getNumDims() << " to " << higherOrdering.getNumResults(); if (higherOrdering.getNumResults() != lvlRank) - return emitError() << "unexpected mismatch in higher ordering and " - "dimension level types size"; + return emitError() + << "level-rank mismatch between higherOrdering and lvlTypes"; } if (!dimSlices.empty() && dimSlices.size() != lvlRank) { - return emitError() << "unexpected mismatch in dimension slices and " - "dimension level type size"; + return emitError() << "level-rank mismatch between dimSlices and lvlTypes"; } return success(); } @@ -429,7 +427,7 @@ // TODO: verification of higher ordering contents } else if (dimRank != getLvlRank()) { return emitError() << "expected an array of size " << dimRank - << " for dimension level types"; + << " for lvlTypes"; } return success(); } diff --git a/mlir/test/Dialect/SparseTensor/GPU/gpu_matvec_lib.mlir b/mlir/test/Dialect/SparseTensor/GPU/gpu_matvec_lib.mlir --- a/mlir/test/Dialect/SparseTensor/GPU/gpu_matvec_lib.mlir +++ b/mlir/test/Dialect/SparseTensor/GPU/gpu_matvec_lib.mlir @@ -2,7 +2,7 @@ // RUN: --sparsification="enable-gpu-libgen" | FileCheck %s #SortedCOO = #sparse_tensor.encoding<{ - dimLevelType = [ "compressed-nu", "singleton" ] + lvlTypes = [ "compressed-nu", "singleton" ] }> module { diff --git a/mlir/test/Dialect/SparseTensor/invalid_encoding.mlir b/mlir/test/Dialect/SparseTensor/invalid_encoding.mlir --- a/mlir/test/Dialect/SparseTensor/invalid_encoding.mlir +++ b/mlir/test/Dialect/SparseTensor/invalid_encoding.mlir @@ -1,27 +1,27 @@ // RUN: mlir-opt %s -split-input-file -verify-diagnostics -// expected-error@+1 {{expected a non-empty array for level types}} +// expected-error@+1 {{expected a non-empty array for lvlTypes}} #a = #sparse_tensor.encoding<{lvlTypes = []}> func.func private @scalar(%arg0: tensor) -> () // ----- #a = #sparse_tensor.encoding<{lvlTypes = ["dense", "compressed"]}> -func.func private @tensor_dimlevel_size_mismatch(%arg0: tensor<8xi32, #a>) -> () // expected-error {{expected an array of size 1 for dimension level types}} +func.func private @tensor_dimlevel_size_mismatch(%arg0: tensor<8xi32, #a>) -> () // expected-error {{expected an array of size 1 for lvlTypes}} // ----- -#a = #sparse_tensor.encoding<{lvlTypes = ["dense", "compressed"], dimOrdering = affine_map<(i) -> (i)>}> // expected-error {{unexpected mismatch in ordering and dimension level types size}} +#a = #sparse_tensor.encoding<{lvlTypes = ["dense", "compressed"], dimOrdering = affine_map<(i) -> (i)>}> // expected-error {{level-rank mismatch between dimOrdering and lvlTypes}} func.func private @tensor_sizes_mismatch(%arg0: tensor<8xi32, #a>) -> () // ----- -#a = #sparse_tensor.encoding<{lvlTypes = [1]}> // expected-error {{expected a string value in dimension level types}} +#a = #sparse_tensor.encoding<{lvlTypes = [1]}> // expected-error {{expected a string value in lvlTypes}} func.func private @tensor_type_mismatch(%arg0: tensor<8xi32, #a>) -> () // ----- -#a = #sparse_tensor.encoding<{lvlTypes = ["strange"]}> // expected-error {{unexpected dimension level type: strange}} +#a = #sparse_tensor.encoding<{lvlTypes = ["strange"]}> // expected-error {{unexpected level-type: strange}} func.func private @tensor_value_mismatch(%arg0: tensor<8xi32, #a>) -> () // -----