google / google/heir

feat: use MLIR resources to capture large constants in the IR

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

Description

https://github.com/google/heir/pull/1501 adds short-term support for serializing large constants at code emission time for the openfhe backend. But to support this in a more agnostic way and throughout the compilation process, it would be a good idea to use MLIR dialect resource blobs to handle large constants that slow compilation times.

@ZenithalHourlyRate laid out a good way to support this earlier in the pipeline (rather than just at one backend's code emission)

- [ ] A pass to transform arith.constant dense into arith.constant dense_resource and a trailing resource section in the file. And optionally split the IR and resource into two file, because MLIR allows a dense_resource without the referenced value in the IR.
- [ ] linalg-to-tensor-ext is provided with the resource file to operate. Some passes may also fold or canonicalize tensor operations (e.g. loop unroll?)
- [ ] Code emission to a particular backend on the split resource file should be done by other tools, saying `mlirResourceToCereal`/`mlirResourceToMlirByteCode`
- [ ] We can support importing constants in a `OnnxToMlirResource`-ish way.

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.