Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bring Your Own Datatypes (apache#5812)
* Add ChangeDatatype pass and unittest * [WIP] Jared's work on Fri This was work that Jared did on my computer, trying to get Inception v3 running. * Fix simplify inference to work over different data types. * Formatting * Copy setup code from other test file * Logging in Relay * Remove duplicate TVM_DLL * Add Sub, Mul, Div, Max to bfloat lib * Fix previous broken rebased commit * Remove line * Add LowerCustomDatatypes to build passes * Upcast ints to custom datatypes too, as well as to floats * Add and use convert_ndarray * Lower Call * Relay: create constant scalars of custom dtypes We use the same method we use in TVM: store the value in a double. * Custom datatype formatting in Relay * Update unittests * Add simpler example that's not working yet * Add Python unittests to Makefile * Fix bug * Fix function name in GetPackedFunc call * convert_ndarray makes its own executor * Add simple test case * Move setup() calls * Use convert_ndarray * Change import to make it more specific * Fix another Registry::Get call * Allow users to register minimum functions for custom datatypes This commit allows users to register global functions named `tvm.datatype.min.<type name>` which take the number of bits in the custom type and return the corresponding minimum value (as a double). A similar commit will need to be created for max, whenever that ends up being needed! * Remove check for float * Add test * Fix inception test * Add MobileNet * Lower custom datatypes before intrinsics * Add exp and sqrt bfloat functions * [buggy commit] Lower intrinsics like sqrt, exp This commit has bugs in it, I'm fairly certain. * Formatting * Fix bug * Add lowering for new ops in test * Add int to bfloat * Remove print * Add all tests * Correct image size * Add TODO * Add "notbfloat" type This type is for testing purposes. It just stores a float in a uint32. It was used to confirm the fact that my bfloat "implementation" is very numerically unstable and was causing issues when running the model. * Convert arguments Not sure how necessary this actually is. * Rewrite custom datatype constants in Relay * Add test_ops * Print constants in Relay * Use topi.testing * Test conv2d * Add test_model * Comment out model tests * Register notbfloat This could be unregistered at some point later * Add commented code Remove later * Add posit tests * test_ops_same_function * [temporary] move incomplete commit to macbook * Add more to tests * Formatting * Uncomment add * Remove bad tests * Change comments * Change function name and docstring * Change main function * Restructure tests * Fix visibility of posit functions * YAPF * Switching keywords around to resolve build errors on some systems * Improve test by running smaller mobilenet * Add test_cast * Change datatype name; add simple test * Rename to posit32 * Merge 3 posit types into one file * Add a nop type * Remove bfloat * Refactor test comments * Refactor conv2d test * Add optional tolerance arguments * Add posit8 and posit16 * Add comment about posit8 * Whoops -- actually add noptype to CMakeLists * Add rtol, atol to run_workload * Add noptype to tests * Run noptype over other models, too * Pass correct arguments to calls * Fix line length errors * Raise tolerances (again) to avoid flaky test * fix style * add test for tanh, log, sigmoid * Remove references to bfloat, notbfloat * Change comments * Remove old test file * fix min func * refactoring unit test file * use posits es2 * cleanup * comment * coment if_then_else * support different bit widths * use random seed to create stable tests * update documentation * removed nop-type and code consistency * add batchnorm test * rebase and update * fix tests and format * pylint * change order of include * include order * fix style * remove posit c linkage * update universal * fix style * fix test * fix overflow error with minfunc and posits * style * use change_dtype to convert params * update universal * fix fatal error * fix constant repr * minor update to posites2 * update universal * fix rst * fix invalid import and sqrt * update universal * comments * comments and expand testing * increase atol/rtol for custom[posites2]32 * Re-add newline * Remove comment * Remove opt level and comment * Change docstring * Add TODO * Add file header and newline * Update docstring * Update file docstring * Update docstrings * Delete todos * create_min_lower_func * add better debugging message * docs * add BYODT tutorial * add todo * Reformat some of tutorial to RST, plus code fixes * tutorial notebook runs now * fix hyperlink * rebase * add to tutorial * fix mobilenet model * add skip tag * black lint * add compiler flag and add dummy float * myfloat and posites2 test * remove universal * lint * lint * add setup * build with USE_POSIT for CI/CD * fix posit cmake * add cd / * undo docker changes * change tutorial to use myfloat * move files * lint * fix * remove filter * fix lint * fix suggestions Co-authored-by: Jared Roesch <roeschinc@gmail.com> Co-authored-by: Andrew Liu <andrewlliu@gmail.com>
- Loading branch information