linalg.matmul E2E
- Dominant language
- MLIR
- Stars
- 906
- Forks
- 171
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 32
Description
## Context
Suppose I have the following code (essentially [this test file](https://github.com/google/heir/blob/main/tests/Dialect/LinAlg/Conversions/linalg_to_tensor_ext/float_vector_square_matrix_matmul_op.mlir) pre-secretization):
```
module {
func.func @main(%vec : tensor<1x4xf16>) -> tensor<1x4xf16> {
%matrix = arith.constant dense<[[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0], [9.0, 10.0, 11.0, 12.0], [13.0, 14.0, 15.0, 16.0]]> : tensor<4x4xf16>
%bias = arith.constant dense<[[17.0, 18.0, 19.0, 20.0]]> : tensor<1x4xf16>
%0 = linalg.matmul ins(%vec, %matrix : tensor<1x4xf16>, tensor<4x4xf16>) outs(%bias : tensor<1x4xf16>) -> tensor<1x4xf16>
return %0 : tensor<1x4xf16>
}
}
```
I'm trying to run the following:
```
bazel run --action_env=CC=$(which gcc) //tools:heir-opt -- --mlir-to-openfhe-ckks handwritten_linalg_matmul.mlir
```
Here's the output I get:
```
/home/ubuntu/simplemlir/handwritten_linalg_matmul.mlir:1:1: warning: expected secret types to be tensors with dimension matching ring parameter, pass will not pack tensors into ciphertext SIMD slots
module {
^
handwritten_linalg_matmul.mlir:2:3: error: failed to legalize operation 'secret.generic' that was explicitly marked illegal
func.func @main(%vec : tensor<1x4xf16>) -> tensor<1x4xf16> {
^
handwritten_linalg_matmul.mlir:2:3: note: see current operation:
%10 = "secret.generic"(<>) ({
^bb0(%arg14: tensor<1x4xf16>):
%31 = "arith.mulf"(%arg14, %7) <{fastmath = #arith.fastmath}> : (tensor<1x4xf16>, tensor<1x4xf16>) -> tensor<1x4xf16>
"secret.yield"(%31) : (tensor<1x4xf16>) -> ()
}) : (!secret.secret>) -> !secret.secret>
```
## Question
Is there something I should be doing regarding cipher text dimension or flattening tensors before running this pipeline?
Contributor guide
Assessment
This issue has not been assessed yet.