@@ -1025,6 +1025,7 @@ func.func @sparse_print(%arg0: tensor<10x10xf64>) {
1025
1025
func.func @sparse_extract_iter_space (%sp : tensor <4 x8 xf32 , #COO >, %it1 : !sparse_tensor.iterator <#COO , lvls = 2 >) {
1026
1026
// expected-error@+1 {{'sparse_tensor.extract_iteration_space' expect larger level upper bound than lower bound}}
1027
1027
%l1 = sparse_tensor.extract_iteration_space %sp at %it1 lvls = 2 to 0 : tensor <4 x8 xf32 , #COO >, !sparse_tensor.iterator <#COO , lvls = 2 >
1028
+ -> !sparse_tensor.iter_space <#COO , lvls = 0 to 2 >
1028
1029
return
1029
1030
}
1030
1031
@@ -1040,6 +1041,7 @@ func.func @sparse_extract_iter_space(%sp : tensor<4x8xf32, #COO>, %it1 : !sparse
1040
1041
func.func @sparse_extract_iter_space (%sp : tensor <4 x8 xf32 , #COO >, %it1 : !sparse_tensor.iterator <#COO , lvls = 0 >) {
1041
1042
// expected-error@+1 {{'sparse_tensor.extract_iteration_space' op parent iterator should be specified iff level lower bound equals 0}}
1042
1043
%l1 = sparse_tensor.extract_iteration_space %sp at %it1 lvls = 0 : tensor <4 x8 xf32 , #COO >, !sparse_tensor.iterator <#COO , lvls = 0 >
1044
+ -> !sparse_tensor.iter_space <#COO , lvls = 1 >
1043
1045
return
1044
1046
}
1045
1047
@@ -1054,7 +1056,7 @@ func.func @sparse_extract_iter_space(%sp : tensor<4x8xf32, #COO>, %it1 : !sparse
1054
1056
1055
1057
func.func @sparse_extract_iter_space (%sp : tensor <4 x8 xf32 , #COO >) {
1056
1058
// 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 <4 x8 xf32 , #COO >
1059
+ %l1 = sparse_tensor.extract_iteration_space %sp lvls = 1 : tensor <4 x8 xf32 , #COO > -> !sparse_tensor.iter_space < #COO , lvls = 1 >
1058
1060
return
1059
1061
}
1060
1062
@@ -1077,6 +1079,7 @@ func.func @sparse_extract_iter_space(%sp : tensor<4x8xf32, #COO>) {
1077
1079
func.func @sparse_extract_iter_space (%sp : tensor <4 x8 xf32 , #COO >, %it1 : !sparse_tensor.iterator <#CSR , lvls = 0 >) {
1078
1080
// expected-error@+1 {{'sparse_tensor.extract_iteration_space' op mismatch in parent iterator encoding and iteration space encoding.}}
1079
1081
%l1 = sparse_tensor.extract_iteration_space %sp at %it1 lvls = 1 : tensor <4 x8 xf32 , #COO >, !sparse_tensor.iterator <#CSR , lvls = 0 >
1082
+ -> !sparse_tensor.iter_space <#COO , lvls = 1 >
1080
1083
return
1081
1084
}
1082
1085
@@ -1092,6 +1095,7 @@ func.func @sparse_extract_iter_space(%sp : tensor<4x8xf32, #COO>, %it1 : !sparse
1092
1095
func.func @sparse_extract_iter_space (%sp : tensor <4 x8 xf32 , #COO >, %it1 : !sparse_tensor.iterator <#COO , lvls = 0 >) {
1093
1096
// expected-error@+1 {{'sparse_tensor.extract_iteration_space' op parent iterator should be used to extract an iteration space from a consecutive level.}}
1094
1097
%l1 = sparse_tensor.extract_iteration_space %sp at %it1 lvls = 2 : tensor <4 x8 xf32 , #COO >, !sparse_tensor.iterator <#COO , lvls = 0 >
1098
+ -> !sparse_tensor.iter_space <#COO , lvls = 2 >
1095
1099
return
1096
1100
}
1097
1101
@@ -1106,7 +1110,7 @@ func.func @sparse_extract_iter_space(%sp : tensor<4x8xf32, #COO>, %it1 : !sparse
1106
1110
}>
1107
1111
1108
1112
func.func @sparse_iterate (%sp : tensor <4 x8 xf32 , #COO >, %i : index , %j : index ) -> index {
1109
- %l1 = sparse_tensor.extract_iteration_space %sp lvls = 0 : tensor <4 x8 xf32 , #COO >
1113
+ %l1 = sparse_tensor.extract_iteration_space %sp lvls = 0 : tensor <4 x8 xf32 , #COO > -> !sparse_tensor.iter_space < #COO , lvls = 0 >
1110
1114
// expected-error @+1 {{'sparse_tensor.iterate' op different number of region iter_args and yielded values: 2 != 1}}
1111
1115
%r1 , %r2 = sparse_tensor.iterate %it1 in %l1 at (%crd ) iter_args (%si = %i , %sj = %j ): !sparse_tensor.iter_space <#COO , lvls = 0 > -> (index , index ) {
1112
1116
sparse_tensor.yield %si : index
@@ -1125,7 +1129,7 @@ func.func @sparse_iterate(%sp : tensor<4x8xf32, #COO>, %i : index, %j : index) -
1125
1129
1126
1130
// expected-note@+1 {{prior use here}}
1127
1131
func.func @sparse_iterate (%sp : tensor <4 x8 xf32 , #COO >, %i : index ) -> f32 {
1128
- %l1 = sparse_tensor.extract_iteration_space %sp lvls = 0 : tensor <4 x8 xf32 , #COO >
1132
+ %l1 = sparse_tensor.extract_iteration_space %sp lvls = 0 : tensor <4 x8 xf32 , #COO > -> !sparse_tensor.iter_space < #COO , lvls = 0 >
1129
1133
// expected-error @+1 {{use of value '%i' expects different type than prior uses: 'f32' vs 'index'}}
1130
1134
%r1 = sparse_tensor.iterate %it1 in %l1 at (%crd ) iter_args (%outer = %i ): !sparse_tensor.iter_space <#COO , lvls = 0 > -> f32 {
1131
1135
sparse_tensor.yield %outer : f32
@@ -1143,7 +1147,7 @@ func.func @sparse_iterate(%sp : tensor<4x8xf32, #COO>, %i : index) -> f32 {
1143
1147
}>
1144
1148
1145
1149
func.func @sparse_iterate (%sp : tensor <4 x8 xf32 , #COO >, %i : index , %j : index ) -> index {
1146
- %l1 = sparse_tensor.extract_iteration_space %sp lvls = 0 : tensor <4 x8 xf32 , #COO >
1150
+ %l1 = sparse_tensor.extract_iteration_space %sp lvls = 0 : tensor <4 x8 xf32 , #COO > -> !sparse_tensor.iter_space < #COO , lvls = 0 >
1147
1151
// expected-error @+1 {{'sparse_tensor.iterate' op 0-th region iter_arg and 0-th yielded value have different type: 'index' != 'f32'}}
1148
1152
%r1 = sparse_tensor.iterate %it1 in %l1 at (%crd ) iter_args (%si = %i ): !sparse_tensor.iter_space <#COO , lvls = 0 > -> index {
1149
1153
%y = arith.constant 1.0 : f32
0 commit comments