google / google/heir

Make SchemeParameters accept IntegerAttrs for moduli

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

Description

Currently, there's a lot of duplication of integer values in tests, like this excerpt from `tests/Dialect/CKKS/Transforms/decompose_relinearize.mlir`:
```
#q0 = 1095233372161 : i64
#q1 = 1032955396097 : i64
#p0 = 261405424692085787 : i64

!Zq0 = !mod_arith.int<#q0>
!Zq1 = !mod_arith.int<#q1>
!Zp0 = !mod_arith.int<#p0>

// Input's type
#ring_L1x1024 = #polynomial.ring, polynomialModulus = <1 + x**1024>>
...
module attributes {
ckks.schemeParam = #ckks.scheme_param<
logN = 10,
// TODO: make a ticket to convert these to integerAttrs
Q = [1095233372161, 1032955396097],
P = [261405424692085787],
logDefaultScale = 45
>
}
```

I can't write `Q = [#q0, #q1]`, and instead have to write out `Q = [1095233372161, 1032955396097]`. This is error-prone and will quickly get tedious for tests involving large parameters.

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.