Commit Graph

90 Commits

Author SHA1 Message Date
Benoit Chevallier-Mames
150d33ba48 feat: make get_printable_graph give correct info for np.dot
closes #204
2021-09-06 11:57:45 +02:00
youben11
0fde0ae836 fix(tests): wasn't expecting bits to be update to max 2021-09-03 08:57:07 +01:00
youben11
31c1787af2 feat(mlir): conversion of dot node into MLIR 2021-09-03 08:57:07 +01:00
youben11
f686ca535a feat(mlir): convert TensorValue inputs to MLIR
factorized the input type conversion of scalar values
2021-09-03 08:57:07 +01:00
Benoit Chevallier-Mames
cfe48cca15 test: add correctness tests for all supported ufunc's
closes #263
2021-09-02 16:00:33 +02:00
Arthur Meyre
9ffe9b667a refacto: fix missed renaming after bad merge 2021-09-02 14:27:19 +02:00
Arthur Meyre
bf2585ba0a refacto: rename hnumpy to numpy as requested for the package imports 2021-09-02 12:20:01 +02:00
Benoit Chevallier-Mames
e9c5ce27bb feat: factorize the ufunc management and add lot of ufunc's
refs #126
2021-09-02 10:46:31 +02:00
Umut
1e8debfb57 refactor: rename ClearValue/EncryptedValue to ClearScalar/EncryptedScalar 2021-09-01 15:33:19 +03:00
Benoit Chevallier-Mames
2badcecd0d feat: append \n instead of prepending it in get_printable_graph
closes #222
2021-09-01 10:23:14 +02:00
Umut
1fa049d914 feat: dump compilation artifacts automatically on compilation failures 2021-08-31 18:40:40 +03:00
Umut
02fbbfeaf7 test(drawing): crate test for saving the drawing 2021-08-31 18:40:40 +03:00
Benoit Chevallier-Mames
0d84f8c5f5 feat: adding exp functions in the managed operators
refs #126
closes #260
2021-08-31 17:24:30 +02:00
Benoit Chevallier-Mames
e90df9c0b7 feat: adding arcsin, arccos, arctan in the managed operators
refs #126
closes #257
2021-08-31 16:39:17 +02:00
Benoit Chevallier-Mames
4c77f08854 feat: adding tan in the managed operators
refs #126
closes #255
2021-08-31 16:39:17 +02:00
Benoit Chevallier-Mames
802f7943b1 feat: adding cos in the managed operators
refs #126
closes #235
2021-08-31 12:25:24 +02:00
youben11
784158741e feat(mlir): TLU conversion 2021-08-31 09:04:24 +01:00
Arthur Meyre
dbda93639b dev(ir): add get_table function to ArbitraryFunction node 2021-08-31 09:04:24 +01:00
Benoit Chevallier-Mames
809ce28b38 feat: an option to show MLIR
closes #224
2021-08-27 18:48:59 +02:00
Arthur Meyre
1b489b281c refactor: move is_equivalent to conftest.py for tests 2021-08-26 14:15:30 +02:00
Arthur Meyre
31259e556c refactor: remove the content= when adding nodes to a graph
- required by tests but can be done by the testing function itself
2021-08-26 11:25:55 +02:00
Benoit Chevallier-Mames
9a3e15e89a test: add tests of np.dot with compile_numpy_function_into_op_graph
closes #201
2021-08-26 09:37:31 +02:00
Arthur Meyre
ff260b2cd2 feat(nptracer): add dot tracing abilities
- remove no cover from Dot.label
- small refactor of BaseTracer to make _sanitize a class method
- small refactor of get_ufunc_numpy_output_dtype to manage funcs and ufuncs
- add function routing to NPTracer
- add dot tracing to NPTracer
- small refactor to get tracing functions for numpy funcs and ufuncs
2021-08-25 11:00:36 +02:00
Arthur Meyre
6d663ef63d dev(ir): add Dot IntermediateNode 2021-08-25 10:51:03 +02:00
Umut
b41029d9c0 refactor(drawing): start using graphviz for visualization 2021-08-25 10:01:20 +03:00
youben11
2585eb7ed8 tests: result correctness of the compiled function 2021-08-24 16:12:44 +01:00
Arthur Meyre
66d0c8dd62 feat(tracing): update hnumpy to manage tensor types
- binary ops and constants support
2021-08-24 16:00:42 +02:00
Arthur Meyre
96b04b45e1 refacto: rename check functions for values
- indicate the checks are for ScalarValues as we now have TensorValues
coming
2021-08-24 16:00:42 +02:00
Arthur Meyre
fc3ae6461c refacto: change the way mixing values is handled
- use an intermediate function that checks which mix function to use
- update function used in hnumpy tracing
2021-08-24 16:00:42 +02:00
Umut
1d5be5a1e7 refactor: re-organize data types and values 2021-08-24 16:13:36 +03:00
Umut
2b5f7f3118 refactor: rename ConstantInput to Constant to reduce confusion 2021-08-24 10:48:57 +03:00
Arthur Meyre
4e658c15cb feat: add TensorValue 2021-08-24 09:31:17 +02:00
Arthur Meyre
e41f77349f refactor: make BaseDataType __eq__ abstract
- update test files with dummy dtypes
2021-08-24 09:31:17 +02:00
Arthur Meyre
9a0c108d4b refactor: refactor ConstantInput to be flexible
- refactor to take a function to generate the propore BaseValue to store in
its output
- refactor BaseTracer to force inheriting tracers to indicate how to build
a ConstantInput tracer
- remove "as import" for intermediate in hnumpy/tracing.py
- update compile to manage python dtypes
2021-08-23 14:10:41 +02:00
Arthur Meyre
5048992707 refactor: properly manage unhandled operands in BaseTracer and NPTracer
- use the pythonic way of signaling unhandled operands
- change typing hint in NPTracer
2021-08-23 14:10:41 +02:00
Arthur Meyre
a4181afe4d refactor: refactor np_dtype_helpers.py
- rename convert_numpy_dtype_to_common_dtype to
convert_numpy_dtype_to_base_data_type
- change names of constants to be clearer
2021-08-23 14:10:41 +02:00
Arthur Meyre
60daf31981 refactor: refactor make_integer_to_hold_ints
- rename make_integer_to_hold_ints to make_integer_to_hold
- accept any values as input as we don't know which type this function will
be called with
- rename get_bits_to_represent_int to
get_bits_to_represent_value_as_integer
2021-08-23 14:10:41 +02:00
Arthur Meyre
0ff3ae4795 refactor: refactor BaseValue and mix_values_determine_holding_dtype
- add _is_encrypted to BaseValue
- remove EncryptedValue and ClearValue classes
- add a ScalarValue class
- add two helpers EncryptedValue and ClearValue which create a ScalarValue
either encrypted or not when passed a data_type
- rename to mix_scalar_values_determine_holding_dtype
- change typing
2021-08-23 14:10:41 +02:00
Arthur Meyre
371ecae801 tests: do not test BaseValue __repr__ anymore 2021-08-23 14:10:41 +02:00
Umut
94fef5e202 feat(debugging): provide a way to export the drawn graph as a png file 2021-08-18 17:33:19 +03:00
Umut
a367d68c6e feat(compilation-configuration): make compilation customizable 2021-08-18 15:10:58 +03:00
Arthur Meyre
5038502327 chore(test): make printable graph tests less verbose but keep debug info 2021-08-18 11:03:14 +02:00
youben11
788e94bfa3 feat: end to end compilation and execution 2021-08-18 08:08:19 +01:00
Arthur Meyre
4e40982f5a feat(float-fusing): fuse float parts of an OPGraph during compilation
- this allows to be compatible with the current compiler and squash float
domains into a single int to int ArbitraryFunction
2021-08-17 18:27:31 +02:00
Arthur Meyre
d48c4dba32 dev(NPTracer): add support for sin
- re-organize numpy tracing tests

refs #126
2021-08-17 18:27:31 +02:00
Arthur Meyre
8dfed58829 chore(tools): add flake8 linter, flake8-bugbear plugin and fix issues
- remove detected `from hdk imports` (use relative imports instead) we ARE
the package
- change the way Float32 and Float64 are defined
2021-08-17 09:22:39 +02:00
youben11
3922bfe9b4 feat(mlir): support constant inputs in mlir conversion 2021-08-16 14:58:56 +01:00
youben11
8fbe5dab4d fix(mlir): unsigned are considered signless in compiler
+ changed the name of compiled func to main, as it's the default name to
  be executed later
2021-08-16 14:58:56 +01:00
Benoit Chevallier
3245d3e673 Feat/user friendly arbitrary function name 144 (#149)
* feat: let the dev give a useful name for ArbitraryFunction

might be useful to debug or understand what happens
closes #144

* feat: let the dev give a useful name for ArbitraryFunction

might be useful to debug or understand what happens
closes #144

* feat: let the dev give a useful name for ArbitraryFunction

might be useful to debug or understand what happens
closes #144

* feat: let the dev give a useful name for ArbitraryFunction

might be useful to debug or understand what happens
closes #144

* feat: let the dev give a useful name for ArbitraryFunction

might be useful to debug or understand what happens
closes #144

* feat: let the dev give a useful name for ArbitraryFunction

might be useful to debug or understand what happens
closes #144

* feat: let the dev give a useful name for ArbitraryFunction

might be useful to debug or understand what happens
closes #144

Co-authored-by: Benoit Chevallier-Mames <benoitchevalliermames@zama.ai>
2021-08-13 18:10:35 +02:00
Ayoub Benaissa
f6c9618b5a feat(mlir): MLIR Conversion (#103)
* feat(mlir): conversion from HDKIR to MLIR

* feat(mlir): support ir.Sub and ir.Mul

- better type conversion from HDK to MLIR
- Context management inside the converter class
- better handling of input type in conversion functions

* refactor(mlir): use input and output from OPGraph

Co-authored-by: Arthur Meyre <arthur.meyre@zama.ai>

* feat(mlir): eint-int subtractions

* feat(mlir): adhere to spec for supported ops

* feat(OPGraph): getters for ordered inputs/outputs

+ formatting

* tests(mlir): test converion via compiler roundtrip

* fix(mlir): flip operands on int_eint sym ops

* feat(mlir): check that the outputs are unsigned

* feat(mlir): set bit_width of all nodes to the max

This is currently required as the compiler is already assuming this.
Could be removed from HDK when the compiler can do it on its own

* feat: value_is_integer + CRs

disable some linting errors

* tests: update compile tests + coverage

* refactor: reorganize mlir package + better doc

* doc: conformance with pydocstyle

Co-authored-by: Arthur Meyre <arthur.meyre@zama.ai>
2021-08-13 12:50:31 +01:00