google / google/heir

LingalToTensorExt: Support diagonalization of any plaintext matrix, not just "constant" ones.

Open
#1,117 0 comments 0 reactions 0 assignees View on GitHub
dialect: tensor_ext
Dominant language
MLIR
Stars
906
Forks
171
Avg merge
4d 12h
Merged PRs (30d)
32

Description

Currently, the Halevi-Shoup diagonalization lowering for `linalg.matul` only applies if the plaintext matrix is created from an `arith.constant`. (See [LinalgToTensorExt.cpp#L289-L295](https://github.com/google/heir/blob/1e5cd7e281a53102af38f782cd7681fb765c9488/lib/Dialect/LinAlg/Conversions/LinalgToTensorExt/LinalgToTensorExt.cpp#L289-L295)) This is likely because the `diagonalizeMatrix` helper function operates directly on a dense elements attr.

Instead, this should be done via either generating a series of `tensor.extract`/etc ops or a `lingalg.generic` (though what would the iteration pattern be?) so that it can be applied to any plaintext matrix.

Note: the current behavior should be maintained as an optimization for `constant` matrices if generic MLIR canonicalization/constant folding does not recognize the optimization opportunity already.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.