Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mlir][sparse] Migrate tests to use new syntax #66146

Merged
merged 3 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def SparseTensorEncodingAttr : SparseTensor_Attr<"SparseTensorEncoding",
```mlir
// Sparse vector.
#SparseVector = #sparse_tensor.encoding<{
lvlTypes = [ "compressed" ]
map = (d0) -> (d0 : compressed)
}>
... tensor<?xf32, #SparseVector> ...

Expand Down
4 changes: 2 additions & 2 deletions mlir/test/Dialect/SparseTensor/codegen.mlir
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// RUN: mlir-opt %s --sparse-tensor-codegen --canonicalize -cse | FileCheck %s

#SV = #sparse_tensor.encoding<{ lvlTypes = [ "compressed" ] }>
#SV = #sparse_tensor.encoding<{ map = (d0) -> (d0 : compressed) }>

#SparseVector = #sparse_tensor.encoding<{
lvlTypes = [ "compressed" ],
map = (d0) -> (d0 : compressed),
crdWidth = 64,
posWidth = 32
}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: mlir-opt %s --sparse-tensor-codegen=enable-buffer-initialization=true --canonicalize --cse | FileCheck %s

#SV = #sparse_tensor.encoding<{ lvlTypes = [ "compressed" ] }>
#SV = #sparse_tensor.encoding<{ map = (d0) -> (d0 : compressed) }>

// CHECK-LABEL: func.func @sparse_alloc_sparse_vector(
// CHECK-SAME: %[[VAL_0:.*]]: index) -> (memref<?xindex>, memref<?xindex>, memref<?xf64>, !sparse_tensor.storage_specifier
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/Dialect/SparseTensor/codegen_to_llvm.mlir
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: mlir-opt %s --sparse-tensor-codegen --sparse-storage-specifier-to-llvm | FileCheck %s

#SparseVector = #sparse_tensor.encoding<{ lvlTypes = ["compressed"] }>
#SparseVector = #sparse_tensor.encoding<{ map = (d0) -> (d0 : compressed) }>

// CHECK-LABEL: func @sparse_nop(
// CHECK-SAME: %[[A0:.*0]]: memref<?xindex>,
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/Dialect/SparseTensor/constant_index_map.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#map1 = affine_map<(d0) -> (0, d0)>
#map2 = affine_map<(d0) -> (d0)>

#SpVec = #sparse_tensor.encoding<{ lvlTypes = [ "compressed" ] }>
#SpVec = #sparse_tensor.encoding<{ map = (d0) -> (d0 : compressed) }>

// CHECK-LABEL: func.func @main(
// CHECK-SAME: %[[VAL_0:.*0]]: tensor<1x77xi1>,
Expand Down
6 changes: 3 additions & 3 deletions mlir/test/Dialect/SparseTensor/conversion.mlir
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// RUN: mlir-opt %s --sparse-tensor-conversion --canonicalize --cse | FileCheck %s

#SparseVector = #sparse_tensor.encoding<{
lvlTypes = ["compressed"]
map = (d0) -> (d0 : compressed)
}>

#SparseVector64 = #sparse_tensor.encoding<{
lvlTypes = ["compressed"],
map = (d0) -> (d0 : compressed),
posWidth = 64,
crdWidth = 64
}>

#SparseVector32 = #sparse_tensor.encoding<{
lvlTypes = ["compressed"],
map = (d0) -> (d0 : compressed),
posWidth = 32,
crdWidth = 32
}>
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/Dialect/SparseTensor/convert_dense2sparse.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// RUN: --canonicalize --cse | FileCheck %s --check-prefix=CHECK-RWT

#SparseVector = #sparse_tensor.encoding<{
lvlTypes = ["compressed"]
map = (d0) -> (d0 : compressed)
}>

#CSR = #sparse_tensor.encoding<{
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/Dialect/SparseTensor/convert_sparse2dense.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// RUN: --canonicalize --cse | FileCheck %s --check-prefix=CHECK-RWT

#SparseVector = #sparse_tensor.encoding<{
lvlTypes = ["compressed"]
map = (d0) -> (d0 : compressed)
}>

#SparseMatrix = #sparse_tensor.encoding<{
Expand Down
6 changes: 3 additions & 3 deletions mlir/test/Dialect/SparseTensor/convert_sparse2sparse.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@
// RUN: --canonicalize --cse | FileCheck %s --check-prefix=CHECK-RWT

#SparseVector64 = #sparse_tensor.encoding<{
lvlTypes = ["compressed"],
map = (d0) -> (d0 : compressed),
posWidth = 64,
crdWidth = 64
}>

#SparseVector32 = #sparse_tensor.encoding<{
lvlTypes = ["compressed"],
map = (d0) -> (d0 : compressed),
posWidth = 32,
crdWidth = 32
}>

#SparseVector = #sparse_tensor.encoding<{
lvlTypes = ["compressed"]
map = (d0) -> (d0 : compressed)
}>

#SortedCOO2D = #sparse_tensor.encoding<{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// RUN: mlir-opt %s --sparse-tensor-codegen --canonicalize --cse | FileCheck %s

#SparseVector64 = #sparse_tensor.encoding<{
lvlTypes = ["compressed"],
map = (d0) -> (d0 : compressed),
posWidth = 64,
crdWidth = 64
}>

#SparseVector32 = #sparse_tensor.encoding<{
lvlTypes = ["compressed"],
map = (d0) -> (d0 : compressed),
posWidth = 32,
crdWidth = 32
}>
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/Dialect/SparseTensor/fold.mlir
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: mlir-opt %s --canonicalize --cse | FileCheck %s

#SparseVector = #sparse_tensor.encoding<{lvlTypes = ["compressed"]}>
#SparseVector = #sparse_tensor.encoding<{map = (d0) -> (d0 : compressed)}>

// CHECK-LABEL: func @sparse_nop_dense2dense_convert(
// CHECK-SAME: %[[A:.*]]: tensor<64xf32>)
Expand Down
28 changes: 14 additions & 14 deletions mlir/test/Dialect/SparseTensor/invalid.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ func.func @invalid_new_dense(%arg0: !llvm.ptr<i8>) -> tensor<32xf32> {

// -----

#SparseVector = #sparse_tensor.encoding<{lvlTypes = ["compressed"], posWidth=32, crdWidth=32}>
#SparseVector = #sparse_tensor.encoding<{map = (d0) -> (d0 : compressed), posWidth=32, crdWidth=32}>

func.func @non_static_pack_ret(%values: tensor<6xf64>, %pos: tensor<2xi32>, %coordinates: tensor<6x1xi32>)
-> tensor<?xf64, #SparseVector> {
Expand All @@ -20,7 +20,7 @@ func.func @non_static_pack_ret(%values: tensor<6xf64>, %pos: tensor<2xi32>, %coo

// -----

#SparseVector = #sparse_tensor.encoding<{lvlTypes = ["compressed"], posWidth=32, crdWidth=32}>
#SparseVector = #sparse_tensor.encoding<{map = (d0) -> (d0 : compressed), posWidth=32, crdWidth=32}>

func.func @invalid_pack_type(%values: tensor<6xf64>, %pos: tensor<2xi32>, %coordinates: tensor<6x1xi32>)
-> tensor<100xf32, #SparseVector> {
Expand Down Expand Up @@ -56,7 +56,7 @@ func.func @invalid_pack_mis_position(%values: tensor<6xf64>, %coordinates: tenso

// -----

#SparseVector = #sparse_tensor.encoding<{lvlTypes = ["compressed"], posWidth=32, crdWidth=32}>
#SparseVector = #sparse_tensor.encoding<{map = (d0) -> (d0 : compressed), posWidth=32, crdWidth=32}>

func.func @invalid_unpack_type(%sp: tensor<100xf32, #SparseVector>, %values: tensor<6xf64>, %pos: tensor<2xi32>, %coordinates: tensor<6x1xi32>) {
// expected-error@+1 {{input/output element-types don't match}}
Expand Down Expand Up @@ -108,7 +108,7 @@ func.func @invalid_positions_unranked(%arg0: tensor<*xf64>) -> memref<?xindex> {

// -----

#SparseVector = #sparse_tensor.encoding<{lvlTypes = ["compressed"], posWidth=32}>
#SparseVector = #sparse_tensor.encoding<{map = (d0) -> (d0 : compressed), posWidth=32}>

func.func @mismatch_positions_types(%arg0: tensor<128xf64, #SparseVector>) -> memref<?xindex> {
// expected-error@+1 {{unexpected type for positions}}
Expand All @@ -118,7 +118,7 @@ func.func @mismatch_positions_types(%arg0: tensor<128xf64, #SparseVector>) -> me

// -----

#SparseVector = #sparse_tensor.encoding<{lvlTypes = ["compressed"]}>
#SparseVector = #sparse_tensor.encoding<{map = (d0) -> (d0 : compressed)}>

func.func @positions_oob(%arg0: tensor<128xf64, #SparseVector>) -> memref<?xindex> {
// expected-error@+1 {{requested level is out of bounds}}
Expand All @@ -144,7 +144,7 @@ func.func @invalid_indices_unranked(%arg0: tensor<*xf64>) -> memref<?xindex> {

// -----

#SparseVector = #sparse_tensor.encoding<{lvlTypes = ["compressed"]}>
#SparseVector = #sparse_tensor.encoding<{map = (d0) -> (d0 : compressed)}>

func.func @mismatch_indices_types(%arg0: tensor<?xf64, #SparseVector>) -> memref<?xi32> {
// expected-error@+1 {{unexpected type for coordinates}}
Expand All @@ -154,7 +154,7 @@ func.func @mismatch_indices_types(%arg0: tensor<?xf64, #SparseVector>) -> memref

// -----

#SparseVector = #sparse_tensor.encoding<{lvlTypes = ["compressed"]}>
#SparseVector = #sparse_tensor.encoding<{map = (d0) -> (d0 : compressed)}>

func.func @indices_oob(%arg0: tensor<128xf64, #SparseVector>) -> memref<?xindex> {
// expected-error@+1 {{requested level is out of bounds}}
Expand All @@ -172,7 +172,7 @@ func.func @invalid_values_dense(%arg0: tensor<1024xf32>) -> memref<?xf32> {

// -----

#SparseVector = #sparse_tensor.encoding<{lvlTypes = ["compressed"]}>
#SparseVector = #sparse_tensor.encoding<{map = (d0) -> (d0 : compressed)}>

func.func @indices_buffer_noncoo(%arg0: tensor<128xf64, #SparseVector>) -> memref<?xindex> {
// expected-error@+1 {{expected sparse tensor with a COO region}}
Expand All @@ -190,7 +190,7 @@ func.func @indices_buffer_dense(%arg0: tensor<1024xf32>) -> memref<?xindex> {

// -----

#SparseVector = #sparse_tensor.encoding<{lvlTypes = ["compressed"]}>
#SparseVector = #sparse_tensor.encoding<{map = (d0) -> (d0 : compressed)}>

func.func @mismatch_values_types(%arg0: tensor<?xf64, #SparseVector>) -> memref<?xf32> {
// expected-error@+1 {{unexpected mismatch in element types}}
Expand Down Expand Up @@ -226,7 +226,7 @@ func.func @sparse_slice_stride(%arg0: tensor<2x8xf64, #CSR_SLICE>) -> index {

// -----

#SparseVector = #sparse_tensor.encoding<{lvlTypes = ["compressed"]}>
#SparseVector = #sparse_tensor.encoding<{map = (d0) -> (d0 : compressed)}>

func.func @sparse_get_md(%arg0: !sparse_tensor.storage_specifier<#SparseVector>) -> index {
// expected-error@+1 {{redundant level argument for querying value memory size}}
Expand All @@ -237,7 +237,7 @@ func.func @sparse_get_md(%arg0: !sparse_tensor.storage_specifier<#SparseVector>)

// -----

#SparseVector = #sparse_tensor.encoding<{lvlTypes = ["compressed"]}>
#SparseVector = #sparse_tensor.encoding<{map = (d0) -> (d0 : compressed)}>

func.func @sparse_get_md(%arg0: !sparse_tensor.storage_specifier<#SparseVector>) -> i64 {
// expected-error@+1 {{requested slice data on non-slice tensor}}
Expand All @@ -248,7 +248,7 @@ func.func @sparse_get_md(%arg0: !sparse_tensor.storage_specifier<#SparseVector>)

// -----

#SparseVector = #sparse_tensor.encoding<{lvlTypes = ["compressed"]}>
#SparseVector = #sparse_tensor.encoding<{map = (d0) -> (d0 : compressed)}>

func.func @sparse_get_md(%arg0: !sparse_tensor.storage_specifier<#SparseVector>) -> index {
// expected-error@+1 {{missing level argument}}
Expand All @@ -259,7 +259,7 @@ func.func @sparse_get_md(%arg0: !sparse_tensor.storage_specifier<#SparseVector>)

// -----

#SparseVector = #sparse_tensor.encoding<{lvlTypes = ["compressed"]}>
#SparseVector = #sparse_tensor.encoding<{map = (d0) -> (d0 : compressed)}>

func.func @sparse_get_md(%arg0: !sparse_tensor.storage_specifier<#SparseVector>) -> index {
// expected-error@+1 {{requested level is out of bounds}}
Expand Down Expand Up @@ -656,7 +656,7 @@ func.func @invalid_concat_dim(%arg0: tensor<2x4xf64, #DC>,

// -----

#C = #sparse_tensor.encoding<{lvlTypes = ["compressed"]}>
#C = #sparse_tensor.encoding<{map = (d0) -> (d0 : compressed)}>
#DC = #sparse_tensor.encoding<{lvlTypes = ["dense", "compressed"]}>
#DCC = #sparse_tensor.encoding<{lvlTypes = ["dense", "compressed", "compressed"]}>
func.func @invalid_concat_rank_mismatch(%arg0: tensor<2xf64, #C>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: mlir-opt %s -one-shot-bufferize -verify-diagnostics

#SparseVector = #sparse_tensor.encoding<{
lvlTypes = ["compressed"]
map = (d0) -> (d0 : compressed)
}>

func.func @sparse_tensor_op(%arg0: tensor<64xf32, #SparseVector>) -> tensor<64xf32, #SparseVector> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func.func @sparse_tensor_convert() -> tensor<20x40xf32> {
return %2 : tensor<20x40xf32>
}

#SV = #sparse_tensor.encoding<{ lvlTypes = [ "compressed" ] }>
#SV = #sparse_tensor.encoding<{ map = (d0) -> (d0 : compressed) }>

#trait = {
indexing_maps = [
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/Dialect/SparseTensor/post_rewriting.mlir
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: mlir-opt %s -post-sparsification-rewrite | FileCheck %s

#SparseVector = #sparse_tensor.encoding<{
lvlTypes = ["compressed"]
map = (d0) -> (d0 : compressed)
}>

#SparseMatrix = #sparse_tensor.encoding<{
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/Dialect/SparseTensor/pre_rewriting.mlir
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: mlir-opt %s -pre-sparsification-rewrite | FileCheck %s

#SparseVector = #sparse_tensor.encoding<{
lvlTypes = ["compressed"]
map = (d0) -> (d0 : compressed)
}>

#SortedCOO = #sparse_tensor.encoding<{
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/Dialect/SparseTensor/rejected.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// The file contains examples that will be rejected by sparse compiler
// (we expect the linalg.generic unchanged).
#SparseVector = #sparse_tensor.encoding<{lvlTypes = ["compressed"]}>
#SparseVector = #sparse_tensor.encoding<{map = (d0) -> (d0 : compressed)}>

#trait = {
indexing_maps = [
Expand Down
Loading