Commit Graph

42 Commits

Author SHA1 Message Date
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
Arthur Meyre
6d663ef63d dev(ir): add Dot IntermediateNode 2021-08-25 10:51:03 +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
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
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
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
Umut
fe9ab2d21d feat(compilation): create compilation artifacts and provide a way to export them in a textual format 2021-08-11 10:26:54 +03:00
Umut
56556a85e9 feat(representation): create lookup table wrapper to be used during tracing direct table lookups 2021-08-10 12:42:38 +03:00
Arthur Meyre
371cdd5e66 fix(ir): make is_equivalent_to abstract
- this allows to make sure each node has a proper implementation
- move op_args and op_kwargs in ArbitraryFunction only
- update BaseTracer accordingly
2021-08-09 13:42:55 +02:00
Arthur Meyre
5d9259c000 dev(ir): add the ArbitraryFunction ir node 2021-08-06 18:35:25 +02:00
Arthur Meyre
789a976661 dev(floats): add the possibility to have constant floats in a program
- update ConstantInput to manage floats
- update OPGraph update_values_with_bounds to manage floats
- update test code to manage cases where output could be a float
- add test cases with float inputs
2021-08-06 17:38:13 +02:00
Benoit Chevallier-Mames
ee832079ba fix: remove the use of map in the code base
closes #90
2021-08-06 16:51:19 +02:00
Arthur Meyre
c9c7acf616 dev(floats): update function to mix types to support floats 2021-08-05 18:15:45 +02:00
Arthur Meyre
0c275c5f43 dev(floats): add Float class to represent a floating point value 2021-08-05 15:49:01 +02:00
Benoit Chevallier-Mames
6a80b065fc test: testing eval_op_graph_bounds_on_dataset with multiple outputs
refs #74
2021-08-04 16:22:46 +02:00
Arthur Meyre
73f21c79a6 dev: add a function to check that a program is an actual integer program 2021-08-03 18:53:09 +02:00
Benoit Chevallier-Mames
6157e4680b feat: adding constant management
refs #49
2021-08-03 16:49:46 +02:00
Arthur Meyre
a158b09f44 feat(bounds): add function to update OPGraph IR nodes in and output values
- this allows to have tighter data types by sticking to the smallest types
able to represent the ranges passed as argument
- update test_dataset_eval to check the output Value's data_type is updated
2021-08-03 11:33:13 +02:00
Arthur Meyre
b1a3b28a20 dev(dtypes): add a function to make Integers able to hold a set of values 2021-08-03 11:33:13 +02:00
Arthur Meyre
e55284b3ea feat(bounds): add a way to evaluate an operator graph on a dataset 2021-08-02 13:01:52 +02:00
Arthur Meyre
be391ca388 chore: remove reference to package name and file paths
- avoids desync with the package name and file paths (which are unstable)
2021-08-02 13:01:52 +02:00
Arthur Meyre
8925fbd2db dev(ir): add evalute to simulate the computation represented by IR nodes 2021-07-29 10:59:37 +02:00
Arthur Meyre
d739e6672d dev(ordered-inputs): update code to keep the input index in Input IR nodes
- this input index will be useful for MLIR/lower level conversions
- it represents the input index of an Input node when considering the
traced function signature
- update code preparing function parameters to keep signature order
2021-07-29 10:59:37 +02:00
Arthur Meyre
d7c1f42363 dev(dtypes): add functions to mix values and find dtype to hold two inputs
- allows to have a generic way of propagating types instead of deepcopying
input values and types in IR nodes
- supports only Integers for now
- opset checks will not be performed in those functions to keep knowledge
required on the opset to the MLIR conversion step or extra check steps
- use the mix_values_determine_holding_dtype in intermediate nodes where
appropriate
2021-07-28 11:48:44 +02:00
Arthur Meyre
deb7631a3a chore(tools): add mypy_test and mypy_ci target
- update tests that were failing with new mypy check
- mypy_test runs mypy on all .py source files in tests
- mypy_ci runs mypy and mypy_test, mypy is for source i.e. hdk/ only
2021-07-26 18:28:39 +02:00
Arthur Meyre
a060aaae99 feat(tracing): add tracing facilities
- add BaseTracer which will hold most of the boilerplate code
- add hnumpy with a bare NPTracer and tracing function
- update IR to be compatible with tracing helpers
- update test helper to properly check that graphs are equivalent
- add test tracing a simple addition
- rename common/data_types/helpers.py to .../dtypes_helpers.py to avoid
having too many files with the same name
- ignore missing type stubs in the default mypy command
- add a comfort Makefile target to get errors about missing mypy stubs
2021-07-26 17:05:53 +02:00
Arthur Meyre
1a54bc1f22 dev(data-types): create Value classes which represent values in a program
- value classes have a data_type member to know what they hold
- add __repr__ to a few classes to ease readability for debug/print
- add helper functions to perform value checks that will be used for
tracing to ease readability
- add unit tests to get 100% coverage
2021-07-26 17:05:53 +02:00
Arthur Meyre
063b2db9db feat(data-types): add skeleton of data types, add an Integer type
- add convenience functions to instantiate Integer
- add tests for the basic functions of integers
2021-07-26 17:05:53 +02:00