Commit Graph

31 Commits

Author SHA1 Message Date
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
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
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
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
2c3c080923 test(direct-tlu): create debugging and compilation tests for direct table lookup 2021-08-12 17:41:06 +03:00
Benoit Chevallier-Mames
4f6103d1d1 fix: fixing issue in the graph generation
closes #130
2021-08-12 15:17:35 +02:00
Arthur Meyre
7bdcfabbfe feat(hnp-tracing): add support for ufunc routing to NPTracer
- start tracing numpy.rint and manage dtypes
- update BaseTracer to accept iterables as inputs, because NPTracer does
not get list givent the way numpy sends arguments to the functions
2021-08-11 14:20:42 +02:00
Arthur Meyre
19e68589d1 dev(numpy-dtypes): add some additional numpy dtype helper functions
- add function to convert a type from the project to a numpy dtype
- add function to manage numpy ufunc output dtypes
- add a check for integers to have positive bit_width
- add a check for floats to only accept 32 and 64 bits
2021-08-11 14:20:42 +02:00
Arthur Meyre
c51c4bd17a feat(tracing-astype): add astype method on NPTracer 2021-08-10 10:13:00 +02:00
Arthur Meyre
9ef2154d51 dev(numpy-dtype): add a function to translate numpy types to frontend types 2021-08-10 09:07:30 +02:00
Benoit Chevallier-Mames
6491e47178 feat: adding a compilation api
also, showing data_types in get_printable_graph
refs #86, #87
2021-08-06 17:04:30 +02:00
Benoit Chevallier-Mames
1771bc6e52 fix: fix #80
closes #80
2021-08-05 11:30:45 +02:00
Benoit Chevallier-Mames
1ee8195af0 feat: supporting several outputs in print and draw of graphs
refs #76
2021-08-05 10:59:24 +02:00
Benoit Chevallier-Mames
6157e4680b feat: adding constant management
refs #49
2021-08-03 16:49:46 +02:00
Arthur Meyre
9b52ea94fb dev(opgraph): add a class to ease manipulating an operator graph 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
Benoit Chevallier-Mames
c91ee858c5 feat: adding a function to print a graph
refs #38
2021-07-30 14:44:22 +02:00
Benoit Chevallier-Mames
1196b00c6b feat(debugging): implementing draw_graph
draw_graph is the function to show on a plot the traced function-to-compile
add edge numbers
refs #38
2021-07-30 11:00:35 +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
5e5d0477b1 test: add argument annotation in parameter id for clear pytest logs
- sometimes arguments are re-ordered in the id written by pytest to sdtout
which makes identifying the failing case hard, this solves the issue for
one test function
2021-07-28 11:48:44 +02:00
Arthur Meyre
a56a0dbf0c dev(ir): make Input ir node accept a name 2021-07-28 11:48:44 +02:00
Benoit Chevallier-Mames
f2140423b7 feat: adding management of Sub and Mul
tests: add the possibility to test more binary operations
avoid copy-paste for binary ops, with just an option if the operation is commutative or not

refs #41, #42
2021-07-27 12:10:30 +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