fix(frontend-python): add missing error messages on high bit-width encrypted dot and matmul

This commit is contained in:
Umut
2023-05-16 14:09:58 +02:00
parent 52cc0c108a
commit 6d16d34b22
2 changed files with 112 additions and 3 deletions

View File

@@ -615,6 +615,64 @@ Function you are trying to compile cannot be compiled
(note that it's assigned 21-bits during compilation because of its relation with other operations)
%2 = multiply(%0, %1) # EncryptedScalar<uint21> ∈ [2000000, 2000000]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ but only up to 16-bit encrypted multiplications are supported
return %2
""", # noqa: E501
),
pytest.param(
lambda x, y: np.dot(x, y),
{"x": "encrypted", "y": "encrypted"},
[
(
[100_000, 200_000],
[200_000, 100_000],
)
],
RuntimeError,
"""
Function you are trying to compile cannot be compiled
%0 = x # EncryptedTensor<uint18, shape=(2,)> ∈ [100000, 200000]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this 36-bit value is used as an operand to an encrypted dot products
(note that it's assigned 36-bits during compilation because of its relation with other operations)
%1 = y # EncryptedTensor<uint18, shape=(2,)> ∈ [100000, 200000]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this 36-bit value is used as an operand to an encrypted dot products
(note that it's assigned 36-bits during compilation because of its relation with other operations)
%2 = dot(%0, %1) # EncryptedScalar<uint36> ∈ [40000000000, 40000000000]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ but only up to 16-bit encrypted dot products are supported
return %2
""", # noqa: E501
),
pytest.param(
lambda x, y: x @ y,
{"x": "encrypted", "y": "encrypted"},
[
(
[
[100_000, 200_000],
[200_000, 100_000],
],
[
[100_000, 200_000],
[200_000, 100_000],
],
)
],
RuntimeError,
"""
Function you are trying to compile cannot be compiled
%0 = x # EncryptedTensor<uint18, shape=(2, 2)> ∈ [100000, 200000]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this 36-bit value is used as an operand to an encrypted matrix multiplication
(note that it's assigned 36-bits during compilation because of its relation with other operations)
%1 = y # EncryptedTensor<uint18, shape=(2, 2)> ∈ [100000, 200000]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this 36-bit value is used as an operand to an encrypted matrix multiplication
(note that it's assigned 36-bits during compilation because of its relation with other operations)
%2 = matmul(%0, %1) # EncryptedTensor<uint36, shape=(2, 2)> ∈ [40000000000, 50000000000]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ but only up to 16-bit encrypted matrix multiplications are supported
return %2
""", # noqa: E501