Skip to content

Commit 9296cfd

Browse files
address comment
1 parent 105f4a3 commit 9296cfd

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

mlir/lib/Dialect/SparseTensor/IR/Detail/LvlTypeParser.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,19 @@ FailureOr<uint64_t> LvlTypeParser::parseLvlType(AsmParser &parser) const {
3535
ERROR_IF(failed(parser.parseOptionalKeyword(&base)),
3636
"expected valid level format (e.g. dense, compressed or singleton)")
3737
uint64_t properties = 0;
38-
SmallVector<unsigned> structure;
38+
SmallVector<unsigned> structured;
3939

4040
if (base.compare("structured") == 0) {
4141
ParseResult res = parser.parseCommaSeparatedList(
4242
mlir::OpAsmParser::Delimiter::OptionalSquare,
43-
[&]() -> ParseResult { return parseStructure(parser, &structure); },
44-
" in structure n out of m");
43+
[&]() -> ParseResult { return parseStructured(parser, &structured); },
44+
" in structured n out of m");
4545
FAILURE_IF_FAILED(res)
46-
if (structure.size() != 2) {
47-
parser.emitError(loc, "expected exactly 2 structure sizes");
46+
if (structured.size() != 2) {
47+
parser.emitError(loc, "expected exactly 2 structured sizes");
4848
return failure();
4949
}
50-
if (structure[0] > structure[1]) {
50+
if (structured[0] > structured[1]) {
5151
parser.emitError(loc, "expected n <= m in n_out_of_m");
5252
return failure();
5353
}
@@ -66,7 +66,7 @@ FailureOr<uint64_t> LvlTypeParser::parseLvlType(AsmParser &parser) const {
6666
properties |= static_cast<uint64_t>(LevelFormat::Compressed);
6767
} else if (base.compare("structured") == 0) {
6868
properties |= static_cast<uint64_t>(LevelFormat::NOutOfM);
69-
properties |= nToBits(structure[0]) | mToBits(structure[1]);
69+
properties |= nToBits(structured[0]) | mToBits(structured[1]);
7070
} else if (base.compare("loose_compressed") == 0) {
7171
properties |= static_cast<uint64_t>(LevelFormat::LooseCompressed);
7272
} else if (base.compare("singleton") == 0) {
@@ -99,24 +99,24 @@ ParseResult LvlTypeParser::parseProperty(AsmParser &parser,
9999
}
100100

101101
ParseResult
102-
LvlTypeParser::parseStructure(AsmParser &parser,
103-
SmallVector<unsigned> *structure) const {
102+
LvlTypeParser::parseStructured(AsmParser &parser,
103+
SmallVector<unsigned> *structured) const {
104104
int intVal;
105105
auto loc = parser.getCurrentLocation();
106106
OptionalParseResult intValParseResult = parser.parseOptionalInteger(intVal);
107107
if (intValParseResult.has_value()) {
108108
if (failed(*intValParseResult)) {
109-
parser.emitError(loc, "failed to parse structure size");
109+
parser.emitError(loc, "failed to parse structured size");
110110
return failure();
111111
}
112112
if (intVal < 0) {
113-
parser.emitError(loc, "expected structure size to be >= 0");
113+
parser.emitError(loc, "expected structured size to be >= 0");
114114
return failure();
115115
}
116-
structure->push_back(intVal);
116+
structured->push_back(intVal);
117117
return success();
118118
}
119-
parser.emitError(loc, "expected valid integer for structure size");
119+
parser.emitError(loc, "expected valid integer for structured size");
120120
return failure();
121121
}
122122

mlir/lib/Dialect/SparseTensor/IR/Detail/LvlTypeParser.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ class LvlTypeParser {
2222

2323
private:
2424
ParseResult parseProperty(AsmParser &parser, uint64_t *properties) const;
25-
ParseResult parseStructure(AsmParser &parser,
26-
SmallVector<unsigned> *structure) const;
25+
ParseResult parseStructured(AsmParser &parser,
26+
SmallVector<unsigned> *structured) const;
2727
};
2828

2929
} // namespace ir_detail

mlir/test/Dialect/SparseTensor/invalid_encoding.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ func.func private @BSR_explicit(%arg0: tensor<?x?xf64, #BSR_explicit>) {
318318

319319
// -----
320320

321-
// expected-error@+6 {{expected structure size to be >= 0}}
321+
// expected-error@+6 {{expected structured size to be >= 0}}
322322
#NOutOfM = #sparse_tensor.encoding<{
323323
map = ( i, j, k ) ->
324324
( i : dense,

0 commit comments

Comments
 (0)