feat(compiler): Add HLFHELinalg.zero operation

Add a new operation `HLFHELinalg.zero`, broadcasting an encrypted,
zero-valued integer into a tensor of encrypted integers with static
shape.

Example creating a one-dimensional tensor with five elements all
initialized to an encrypted zero:

  %tensor = "HLFHELinalg.zero"() : () -> tensor<5x!HLFHE.eint<4>>
This commit is contained in:
Andi Drebes
2021-11-23 11:03:48 +01:00
parent 0b151724b8
commit 4883eebfa3
2 changed files with 17 additions and 0 deletions

View File

@@ -444,5 +444,21 @@ def MatMulIntEintOp : HLFHELinalg_Op<"matmul_int_eint", [TensorBinaryIntEint]> {
}];
}
def ZeroOp : HLFHELinalg_Op<"zero", []> {
let summary = "Creates a new tensor with all elements initialized to an encrypted zero.";
let description = [{
Creates a new tensor with the shape specified in the result type and initializes its elements with an encrypted zero.
Example:
```mlir
%tensor = "HLFHELinalg.zero"() : () -> tensor<5x!HLFHE.eint<4>>
```
}];
let arguments = (ins);
let results = (outs Type<And<[TensorOf<[EncryptedIntegerType]>.predicate, HasStaticShapePred]>>:$aggregate);
}
#endif