Closed paul-tqh-nguyen closed 3 years ago
The code below is incorrect because it expects a tensor result from a vector-vector multiply. It results in a confusing error message that's not always helpful.
(mlirgraphblas) pnguyen@CONDA-0584:/Users/pnguyen/code/mlir-graphblas/mlir_graphblas/src$ cat /tmp/example.mlir #CSR64 = #sparse_tensor.encoding<{ dimLevelType = [ "dense", "compressed" ], dimOrdering = affine_map<(i,j) -> (i,j)>, pointerBitWidth = 64, indexBitWidth = 64 }> #CSC64 = #sparse_tensor.encoding<{ dimLevelType = [ "dense", "compressed" ], dimOrdering = affine_map<(i,j) -> (j,i)>, pointerBitWidth = 64, indexBitWidth = 64 }> #CV64 = #sparse_tensor.encoding<{ dimLevelType = [ "compressed" ], pointerBitWidth = 64, indexBitWidth = 64 }> func @matrix_multiply_plus_times(%vecA: tensor<?xf64, #CV64>, %vecB: tensor<?xf64, #CV64>, %mask: tensor<?xf64, #CV64>) -> tensor<?xf64, #CV64> { %answer = graphblas.matrix_multiply %vecA, %vecB, %mask { semiring = "any_pair" } : (tensor<?xf64, #CV64>, tensor<?xf64, #CV64>, tensor<?xf64, #CV64>) to tensor<?xf64, #CV64> return %answer : tensor<?xf64, #CV64> } (mlirgraphblas) pnguyen@CONDA-0584:/Users/pnguyen/code/mlir-graphblas/mlir_graphblas/src$ cat /tmp/example.mlir | ./build/bin/graphblas-opt <stdin>:23:15: error: Result element type differs from the input element types. %answer = graphblas.matrix_multiply %vecA, %vecB, %mask { semiring = "any_pair" } : (tensor<?xf64, #CV64>, tensor<?xf64, #CV64>, tensor<?xf64, #CV64>) to tensor<?xf64, #CV64> ^ <stdin>:23:15: note: see current operation: %0 = "graphblas.matrix_multiply"(%arg0, %arg1, %arg2) {semiring = "any_pair"} : (tensor<?xf64, #sparse_tensor.encoding<{ dimLevelType = [ "compressed" ], pointerBitWidth = 64, indexBitWidth = 64 }>>, tensor<?xf64, #sparse_tensor.encoding<{ dimLevelType = [ "compressed" ], pointerBitWidth = 64, indexBitWidth = 64 }>>, tensor<?xf64, #sparse_tensor.encoding<{ dimLevelType = [ "compressed" ], pointerBitWidth = 64, indexBitWidth = 64 }>>) -> tensor<?xf64, #sparse_tensor.encoding<{ dimLevelType = [ "compressed" ], pointerBitWidth = 64, indexBitWidth = 64 }>> (mlirgraphblas) pnguyen@CONDA-0584:/Users/pnguyen/code/mlir-graphblas/mlir_graphblas/src$
We should make sure there's a FileCheck test for whatever better error message we come up with.
FileCheck
https://github.com/metagraph-dev/mlir-graphblas/pull/210 resolves this issue.
The code below is incorrect because it expects a tensor result from a vector-vector multiply. It results in a confusing error message that's not always helpful.
We should make sure there's a
FileCheck
test for whatever better error message we come up with.