/
BGVTypes.td
47 lines (35 loc) · 1.51 KB
/
BGVTypes.td
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef HEIR_INCLUDE_DIALECT_BGV_IR_BGVTYPES_TD_
#define HEIR_INCLUDE_DIALECT_BGV_IR_BGVTYPES_TD_
include "BGVDialect.td"
include "BGVAttributes.td"
include "mlir/IR/AttrTypeBase.td"
include "mlir/Interfaces/InferTypeOpInterface.td"
include "mlir/IR/DialectBase.td"
include "mlir/IR/OpBase.td"
// TODO(#100): Add a plaintext type.
// A base class for all types in this dialect
class BGV_Type<string name, string typeMnemonic>
: TypeDef<BGV_Dialect, name> {
let mnemonic = typeMnemonic;
}
def Ciphertext : BGV_Type<"Ciphertext", "ciphertext"> {
let summary = "a BGV ciphertext";
let description = [{
This type tracks the BGV ciphertext parameters, including the ciphertext
dimension (number of polynomials) and the set of rings that were used for
the particular BGV scheme instance. The default dimension is 2, representing
a ciphertext that is canonically encrypted against the key basis $(1, s)$.
The type also includes a ring parameter specification.
For example, `bgv.ciphertext<rings=#rings, dim=3>` is a ciphertext with 3
polynomials $(c_0, c_1, c_2)$.
The optional attribute `level` specifies the "current ring".
}];
// TODO(#99): Add # of plaintext bits.
let parameters = (ins
BGVRingArrayAttr:$rings,
DefaultValuedParameter<"unsigned", "2">:$dim,
OptionalParameter<"std::optional<uint64_t>">:$level
);
let assemblyFormat = "`<` `rings` `=` $rings (`,` `dim` `=` $dim^ )? (`,` `level` `=` $level^ )? `>`";
}
#endif // HEIR_INCLUDE_DIALECT_BGV_IR_BGVTYPES_TD_