Skip to content

Commit 8f5f891

Browse files
author
Peiming Liu
committed
update operation name.
1 parent 43e9638 commit 8f5f891

File tree

4 files changed

+23
-15
lines changed

4 files changed

+23
-15
lines changed

mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td

+1-1
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,7 @@ def SparseTensor_ForeachOp : SparseTensor_Op<"foreach",
14341434
// Sparse Tensor Iteration Operations.
14351435
//===----------------------------------------------------------------------===//
14361436

1437-
def ExtractIterSpaceOp : SparseTensor_Op<"iteration.extract_space",
1437+
def ExtractIterSpaceOp : SparseTensor_Op<"extract_iteration_space",
14381438
[Pure, DeclareOpInterfaceMethods<InferTypeOpInterface>]> {
14391439

14401440
let arguments = (ins AnySparseTensor:$tensor,

mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -1974,6 +1974,8 @@ IteratorType IterSpaceType::getIteratorType() const {
19741974
return IteratorType::get(getContext(), getEncoding(), getLoLvl(), getHiLvl());
19751975
}
19761976

1977+
/// Parses a level range in the form "$lo `to` $hi"
1978+
/// or simply "$lo" if $hi - $lo = 1
19771979
static ParseResult parseLevelRange(AsmParser &parser, Level &lvlLo,
19781980
Level &lvlHi) {
19791981
if (parser.parseInteger(lvlLo))
@@ -1993,6 +1995,8 @@ static ParseResult parseLevelRange(AsmParser &parser, Level &lvlLo,
19931995
return success();
19941996
}
19951997

1998+
/// Parses a level range in the form "$lo `to` $hi"
1999+
/// or simply "$lo" if $hi - $lo = 1
19962000
static ParseResult parseLevelRange(OpAsmParser &parser, IntegerAttr &lvlLoAttr,
19972001
IntegerAttr &lvlHiAttr) {
19982002
Level lvlLo, lvlHi;
@@ -2004,6 +2008,8 @@ static ParseResult parseLevelRange(OpAsmParser &parser, IntegerAttr &lvlLoAttr,
20042008
return success();
20052009
}
20062010

2011+
/// Prints a level range in the form "$lo `to` $hi"
2012+
/// or simply "$lo" if $hi - $lo = 1
20072013
static void printLevelRange(AsmPrinter &p, Level lo, Level hi) {
20082014

20092015
if (lo + 1 == hi)
@@ -2012,6 +2018,8 @@ static void printLevelRange(AsmPrinter &p, Level lo, Level hi) {
20122018
p << lo << " to " << hi;
20132019
}
20142020

2021+
/// Prints a level range in the form "$lo `to` $hi"
2022+
/// or simply "$lo" if $hi - $lo = 1
20152023
static void printLevelRange(OpAsmPrinter &p, Operation *, IntegerAttr lvlLo,
20162024
IntegerAttr lvlHi) {
20172025
unsigned lo = lvlLo.getValue().getZExtValue();

mlir/test/Dialect/SparseTensor/invalid.mlir

+10-10
Original file line numberDiff line numberDiff line change
@@ -1023,8 +1023,8 @@ func.func @sparse_print(%arg0: tensor<10x10xf64>) {
10231023
}>
10241024

10251025
func.func @sparse_extract_iter_space(%sp : tensor<4x8xf32, #COO>, %it1 : !sparse_tensor.iterator<#COO, lvls = 2>) {
1026-
// expected-error@+1 {{'sparse_tensor.iteration.extract_space' expect larger level upper bound than lower bound}}
1027-
%l1 = sparse_tensor.iteration.extract_space %sp at %it1 lvls = 2 to 0 : tensor<4x8xf32, #COO>, !sparse_tensor.iterator<#COO, lvls = 2>
1026+
// expected-error@+1 {{'sparse_tensor.extract_iteration_space' expect larger level upper bound than lower bound}}
1027+
%l1 = sparse_tensor.extract_iteration_space %sp at %it1 lvls = 2 to 0 : tensor<4x8xf32, #COO>, !sparse_tensor.iterator<#COO, lvls = 2>
10281028
return
10291029
}
10301030

@@ -1038,8 +1038,8 @@ func.func @sparse_extract_iter_space(%sp : tensor<4x8xf32, #COO>, %it1 : !sparse
10381038
}>
10391039

10401040
func.func @sparse_extract_iter_space(%sp : tensor<4x8xf32, #COO>, %it1 : !sparse_tensor.iterator<#COO, lvls = 0>) {
1041-
// expected-error@+1 {{'sparse_tensor.iteration.extract_space' op parent iterator should be specified iff level lower bound equals 0}}
1042-
%l1 = sparse_tensor.iteration.extract_space %sp at %it1 lvls = 0 : tensor<4x8xf32, #COO>, !sparse_tensor.iterator<#COO, lvls = 0>
1041+
// expected-error@+1 {{'sparse_tensor.extract_iteration_space' op parent iterator should be specified iff level lower bound equals 0}}
1042+
%l1 = sparse_tensor.extract_iteration_space %sp at %it1 lvls = 0 : tensor<4x8xf32, #COO>, !sparse_tensor.iterator<#COO, lvls = 0>
10431043
return
10441044
}
10451045

@@ -1053,8 +1053,8 @@ func.func @sparse_extract_iter_space(%sp : tensor<4x8xf32, #COO>, %it1 : !sparse
10531053
}>
10541054

10551055
func.func @sparse_extract_iter_space(%sp : tensor<4x8xf32, #COO>) {
1056-
// expected-error@+1 {{'sparse_tensor.iteration.extract_space' op parent iterator should be specified iff level lower bound equals 0}}
1057-
%l1 = sparse_tensor.iteration.extract_space %sp lvls = 1 : tensor<4x8xf32, #COO>
1056+
// expected-error@+1 {{'sparse_tensor.extract_iteration_space' op parent iterator should be specified iff level lower bound equals 0}}
1057+
%l1 = sparse_tensor.extract_iteration_space %sp lvls = 1 : tensor<4x8xf32, #COO>
10581058
return
10591059
}
10601060

@@ -1075,8 +1075,8 @@ func.func @sparse_extract_iter_space(%sp : tensor<4x8xf32, #COO>) {
10751075
}>
10761076

10771077
func.func @sparse_extract_iter_space(%sp : tensor<4x8xf32, #COO>, %it1 : !sparse_tensor.iterator<#CSR, lvls = 0>) {
1078-
// expected-error@+1 {{'sparse_tensor.iteration.extract_space' op mismatch in parent iterator encoding and iteration space encoding.}}
1079-
%l1 = sparse_tensor.iteration.extract_space %sp at %it1 lvls = 1 : tensor<4x8xf32, #COO>, !sparse_tensor.iterator<#CSR, lvls = 0>
1078+
// expected-error@+1 {{'sparse_tensor.extract_iteration_space' op mismatch in parent iterator encoding and iteration space encoding.}}
1079+
%l1 = sparse_tensor.extract_iteration_space %sp at %it1 lvls = 1 : tensor<4x8xf32, #COO>, !sparse_tensor.iterator<#CSR, lvls = 0>
10801080
return
10811081
}
10821082

@@ -1090,7 +1090,7 @@ func.func @sparse_extract_iter_space(%sp : tensor<4x8xf32, #COO>, %it1 : !sparse
10901090
}>
10911091

10921092
func.func @sparse_extract_iter_space(%sp : tensor<4x8xf32, #COO>, %it1 : !sparse_tensor.iterator<#COO, lvls = 0>) {
1093-
// expected-error@+1 {{'sparse_tensor.iteration.extract_space' op parent iterator should be used to extract an iteration space from a consecutive level.}}
1094-
%l1 = sparse_tensor.iteration.extract_space %sp at %it1 lvls = 2 : tensor<4x8xf32, #COO>, !sparse_tensor.iterator<#COO, lvls = 0>
1093+
// expected-error@+1 {{'sparse_tensor.extract_iteration_space' op parent iterator should be used to extract an iteration space from a consecutive level.}}
1094+
%l1 = sparse_tensor.extract_iteration_space %sp at %it1 lvls = 2 : tensor<4x8xf32, #COO>, !sparse_tensor.iterator<#COO, lvls = 0>
10951095
return
10961096
}

mlir/test/Dialect/SparseTensor/roundtrip.mlir

+4-4
Original file line numberDiff line numberDiff line change
@@ -751,15 +751,15 @@ func.func @sparse_has_runtime() -> i1 {
751751
// CHECK-LABEL: func.func @sparse_extract_iter_space(
752752
// CHECK-SAME: %[[VAL_0:.*]]: tensor<4x8xf32, #sparse{{[0-9]*}}>,
753753
// CHECK-SAME: %[[VAL_1:.*]]: !sparse_tensor.iterator<#sparse{{[0-9]*}}, lvls = 0>)
754-
// CHECK: %[[VAL_2:.*]] = sparse_tensor.iteration.extract_space %[[VAL_0]] lvls = 0
755-
// CHECK: %[[VAL_3:.*]] = sparse_tensor.iteration.extract_space %[[VAL_0]] at %[[VAL_1]] lvls = 1
754+
// CHECK: %[[VAL_2:.*]] = sparse_tensor.extract_iteration_space %[[VAL_0]] lvls = 0
755+
// CHECK: %[[VAL_3:.*]] = sparse_tensor.extract_iteration_space %[[VAL_0]] at %[[VAL_1]] lvls = 1
756756
// CHECK: return %[[VAL_2]], %[[VAL_3]] : !sparse_tensor.iter_space<#sparse{{[0-9]*}}, lvls = 0>, !sparse_tensor.iter_space<#sparse{{[0-9]*}}, lvls = 1>
757757
// CHECK: }
758758
func.func @sparse_extract_iter_space(%sp : tensor<4x8xf32, #COO>, %it1 : !sparse_tensor.iterator<#COO, lvls = 0>)
759759
-> (!sparse_tensor.iter_space<#COO, lvls = 0>, !sparse_tensor.iter_space<#COO, lvls = 1>) {
760760
// Extracting the iteration space for the first level needs no parent iterator.
761-
%l1 = sparse_tensor.iteration.extract_space %sp lvls = 0 : tensor<4x8xf32, #COO>
761+
%l1 = sparse_tensor.extract_iteration_space %sp lvls = 0 : tensor<4x8xf32, #COO>
762762
// Extracting the iteration space for the second level needs a parent iterator.
763-
%l2 = sparse_tensor.iteration.extract_space %sp at %it1 lvls = 1 : tensor<4x8xf32, #COO>, !sparse_tensor.iterator<#COO, lvls = 0>
763+
%l2 = sparse_tensor.extract_iteration_space %sp at %it1 lvls = 1 : tensor<4x8xf32, #COO>, !sparse_tensor.iterator<#COO, lvls = 0>
764764
return %l1, %l2 : !sparse_tensor.iter_space<#COO, lvls = 0>, !sparse_tensor.iter_space<#COO, lvls = 1>
765765
}

0 commit comments

Comments
 (0)