platform/upstream/tvm.git
5 years agoUpdate tflite tutorial to use TFLite r1.13 schema (#3271)
Alexander Pivovarov [Sat, 1 Jun 2019 18:16:16 +0000 (11:16 -0700)]
Update tflite tutorial to use TFLite r1.13 schema (#3271)

5 years ago[relay][heterogeneous] annotate using visitor (#3261)
Zhi [Sat, 1 Jun 2019 07:53:18 +0000 (00:53 -0700)]
[relay][heterogeneous] annotate using visitor (#3261)

* annotate using visitor

* retrigger CI

5 years ago[Bugfix][VTA] PkgConfig cause crash in PYNQ board due to link library (#3257)
Hua [Sat, 1 Jun 2019 02:42:15 +0000 (19:42 -0700)]
[Bugfix][VTA] PkgConfig cause crash in PYNQ board due to link library (#3257)

* [Bugfix][VTA] PkgConfig cause crash in PYNQ board due to link library
not exist.

Symptom:
When run vta_get_started.py with pynq board, host crash and
complain "cannot find -lsds_lib" and "cannot find -l:libdma.so"

Reproduce:
At pynq board, delete the ./build/vta_config.json, then run rpc
server.
In host machine run vta_get_started.py, issue would reproduce.

Analysis:
This issue caused by 'PkgConfig' function  still using pynq2.1
library which not exist in pynq2.4 anymore, when a "reconfig_runtime"
logic of rpc_server.py get triggered , the compile would failed due to
link library not exist.

Solution:
change the link library to libcma.so.

* [Document Change][VTA] Change pynq version from 2.3 into 2.4.

Issue:
pynq 2.3 image not available anymore from pynq download page and pynq
2.4 is the current latest image which available in the said website, after
verification, currently VTA work good with pynq 2.4 image, hence update
related document from pynq 2.3 to 2.4.

5 years agoEnable uTVM in Jenkinsfile (#3269)
Logan Weber [Fri, 31 May 2019 19:21:36 +0000 (12:21 -0700)]
Enable uTVM in Jenkinsfile (#3269)

5 years ago[Relay][Hashing] Structural hash - incorporate the var type into its hash (#3267)
Animesh Jain [Fri, 31 May 2019 08:29:54 +0000 (01:29 -0700)]
[Relay][Hashing] Structural hash - incorporate the var type into its hash (#3267)

Currently, the BindVar function does not take Var type into account. This causes
two same graph structures with different var shapes to have same hash.
Structural hash is used for keeping track of which operators we have
already compiled. Because of this, two operators with different shapes end up
pointing to same compiled code. The failure is encountered at runtime, where the
expected input shape asserts are not met.

5 years agoJekyll (#3262)
Tianqi Chen [Fri, 31 May 2019 04:32:33 +0000 (21:32 -0700)]
Jekyll (#3262)

5 years ago[Bugfix] Fix a memory leak in OpManager (#3263)
hlu1 [Fri, 31 May 2019 04:11:25 +0000 (21:11 -0700)]
[Bugfix] Fix a memory leak in OpManager (#3263)

5 years ago[Relay] Handle float16 constants & fix BatchNorm (#3260)
Balint Cristian [Fri, 31 May 2019 02:12:56 +0000 (05:12 +0300)]
[Relay] Handle float16 constants & fix BatchNorm (#3260)

5 years ago[AutoTVM]Core functionality for Graph tuner (#2184)
Yao Wang [Wed, 29 May 2019 23:36:05 +0000 (16:36 -0700)]
[AutoTVM]Core functionality for Graph tuner (#2184)

* Add graph tuning

* Add tests

* Fix tests

* Fix pylint

* Small fix for docstring

* Minor fix

* Support fetching workload from relay expr

* Simplify benchmark layout transformation

* Add relay support

* Fix infer layout func name

* Refactor internal data representation

* Fix issues

* Add PBQP solver

* Fix layout transform check

* Add PBQPTuner test

* Fix lint

* Update tutorial

* Fix tutorial

* Fix lint

* Add relay test

* Remove nnvm since nnvm graph can be converted to relay function

* Modify benchmark layout wrt new layout_transform api

* Fix lint

* Update docstring for DP tuner

* Refactor traverse graph

* Support graph tuning for multiple target operators

* Fix fetching workloads

* Add x86 depthwise_conv2d infer_layout

* Fix x86 depthwise_conv2d autotvm

* Fix PBQP tuner

* Fix DP tuner

* Generate dummy layout transform record

* Update tutorial

* Modify layout records name

* Add ASF header

* Add ASF header for testing files

* Fix test

* Fix topi fetching

* Some refactors

* Fix lint

* Fix tutorial

* Rename test files

* Fix doc typo

* Add test case note link

5 years ago[BugFix][VTA] Fix vta_conv2d crash issue after change vta_config.json configuration...
Hua [Wed, 29 May 2019 17:32:47 +0000 (10:32 -0700)]
[BugFix][VTA] Fix vta_conv2d crash issue after change vta_config.json configuration. (#3213)

Issue:
Once change LOG_BLOCK_IN or LOG_BLOCK_OUT into > 4 value, when run vta
“Simple Matrix Multiply” or load vta, vta would crash at vta_conv2d.py.

Analysis:
This issue caused by resnet18 logic of vta_conv2d.py which have
in_filter minmum size that is 16. > 4 value would cause such in_filter
check failed then make xfer_size be empty and find_schedules function
return a empty list finally cause crash.

Solution:
add the empty list check.

5 years ago[C++] Cleanup transform API nits (#3253)
Tianqi Chen [Wed, 29 May 2019 01:12:17 +0000 (18:12 -0700)]
[C++] Cleanup transform API nits (#3253)

5 years ago[TOPI] Fix resize nearest with fractional scaling (#3244)
masahi [Tue, 28 May 2019 22:20:58 +0000 (07:20 +0900)]
[TOPI] Fix resize nearest with fractional scaling (#3244)

5 years ago[RUST] Rust DSO module (#2976)
Nick Hynes [Tue, 28 May 2019 22:20:18 +0000 (15:20 -0700)]
[RUST] Rust DSO module (#2976)

5 years agoTypo: Tensorflow --> TensorFlow (#3249)
Gus Smith [Tue, 28 May 2019 20:35:25 +0000 (13:35 -0700)]
Typo: Tensorflow --> TensorFlow (#3249)

5 years agokCustomBegin overlapped with kExtEnd; incr by 1 (#3250)
Gus Smith [Tue, 28 May 2019 20:35:09 +0000 (13:35 -0700)]
kCustomBegin overlapped with kExtEnd; incr by 1 (#3250)

This was a typo in the original custom datatypes PR.

5 years agoMove CombineParallelConv2D to opt level 4 (#3248)
Wuwei Lin [Tue, 28 May 2019 18:02:48 +0000 (02:02 +0800)]
Move CombineParallelConv2D to opt level 4 (#3248)

5 years ago[VTA][TSIM] Use Module instead of RawModule for testbench by creating an empty bundle...
Luis Vega [Tue, 28 May 2019 04:29:55 +0000 (21:29 -0700)]
[VTA][TSIM] Use Module instead of RawModule for testbench by creating an empty bundle for the IO (#3242)

* use Module instead of RawModule for testbench by creating an empty bundle for the IO

* change default back to verilog

5 years ago[Doc][Relay] Add VM doc (#3188)
Wei Chen [Mon, 27 May 2019 22:24:54 +0000 (06:24 +0800)]
[Doc][Relay] Add VM doc (#3188)

* [Doc][Relay] Add VM doc

* Add Apache header

* Apply suggestions from code review

Co-Authored-By: Steven S. Lyubomirsky <slyubomirsky@gmail.com>
Co-Authored-By: 雾雨魔理沙 <lolisa@marisa.moe>
Co-Authored-By: Logan Weber <36520469+weberlo@users.noreply.github.com>
Co-Authored-By: Zhi <5145158+zhiics@users.noreply.github.com>
* Junru's comment

* More fix

* More fix

* More fix

* last fix

* Apply suggestions from code review

Co-Authored-By: 雾雨魔理沙 <lolisa@marisa.moe>
* Apply suggestions from code review

Co-Authored-By: Logan Weber <36520469+weberlo@users.noreply.github.com>
* Add code links

* Remove unused bp

* Update docs/dev/virtual_machine.rst

Co-Authored-By: Logan Weber <36520469+weberlo@users.noreply.github.com>
* Explain TODO

* Yong's comment

Co-Authored-By: Yong Wu <55wuyong@163.com>
* Comment

5 years ago[ARITH] Improve div/mod in rewrite simplifier (#3149)
Sergei Grechanik [Mon, 27 May 2019 16:33:13 +0000 (19:33 +0300)]
[ARITH] Improve div/mod in rewrite simplifier (#3149)

* [ARITH] Improve div/mod in rewrite simplifier

* Fix lint error

* Fuller file name in src/arithmetic/modular_set.h

Co-Authored-By: Wei Chen <ipondering.weic@gmail.com>
* Generalize some rules

* Replace gcd factoring with specialized rules

* Mark rules that don't work for non-truncated division

* More tests

5 years ago[Relay][Frontend] Add Crop op converter (#3241)
Haichen Shen [Sun, 26 May 2019 00:40:02 +0000 (17:40 -0700)]
[Relay][Frontend] Add Crop op converter (#3241)

* Add Crop op converter

* lint

* x

5 years agoFixed a typo (#3218)
Gemfield [Sat, 25 May 2019 00:48:58 +0000 (08:48 +0800)]
Fixed a typo (#3218)

* Fixed a typo

* Remove outdated url link.

5 years ago[Relay] Start porting pass to the pass manager (#3191)
雾雨魔理沙 [Fri, 24 May 2019 23:43:03 +0000 (16:43 -0700)]
[Relay] Start porting pass to the pass manager (#3191)

5 years ago[Relay] remove unneeded VisitExpr (#3239)
雾雨魔理沙 [Fri, 24 May 2019 23:42:29 +0000 (16:42 -0700)]
[Relay] remove unneeded VisitExpr (#3239)

5 years ago[RELAY]Frontend darknet (#2773)
Siju [Fri, 24 May 2019 21:38:08 +0000 (03:08 +0530)]
[RELAY]Frontend darknet (#2773)

* [RELAY]Frontend darknet

* CI test file updated & CI error fixed

* avg_pool pad fix

* Changed repo_url and doc formatting

5 years ago[Relay][Transform] merge PassContext and BuildConfig (#3234)
Zhi [Fri, 24 May 2019 19:05:00 +0000 (12:05 -0700)]
[Relay][Transform] merge PassContext and BuildConfig (#3234)

5 years ago[C++][API] Consistent RAII scoping API. (#3231)
Tianqi Chen [Fri, 24 May 2019 16:29:14 +0000 (09:29 -0700)]
[C++][API] Consistent RAII scoping API. (#3231)

5 years ago[LINT] handle more file types in ASF header (#3235)
eqy [Fri, 24 May 2019 00:52:44 +0000 (17:52 -0700)]
[LINT] handle more file types in ASF header (#3235)

* Update add_asf_header.py

* Update add_asf_header.py

5 years agoModified pick best to accumulate the best configurations from both the input and...
Josh Fromm [Thu, 23 May 2019 17:23:12 +0000 (10:23 -0700)]
Modified pick best to accumulate the best configurations from both the input and output file. (#3225)

5 years ago[NODE] Macro to define NodeRef methods, constructor style example (#3224)
Tianqi Chen [Thu, 23 May 2019 17:17:03 +0000 (10:17 -0700)]
[NODE] Macro to define NodeRef methods, constructor style example (#3224)

5 years ago[GraphRuntime] Debug graph runtime (#3232)
hlu1 [Thu, 23 May 2019 17:13:11 +0000 (10:13 -0700)]
[GraphRuntime] Debug graph runtime (#3232)

5 years ago[3rdparty] sync submodules (#3229)
Bing Xu [Wed, 22 May 2019 23:22:13 +0000 (16:22 -0700)]
[3rdparty] sync submodules (#3229)

5 years agoRegister SkipVectorize (#3228)
Gus Smith [Wed, 22 May 2019 22:41:02 +0000 (15:41 -0700)]
Register SkipVectorize (#3228)

5 years ago[Relay][Prelude] Remove Peano nats from the prelude (#3045)
Steven S. Lyubomirsky [Wed, 22 May 2019 20:57:53 +0000 (13:57 -0700)]
[Relay][Prelude] Remove Peano nats from the prelude (#3045)

5 years ago[relay][pass manager] Open transform namespace (#3226)
Zhi [Wed, 22 May 2019 20:52:52 +0000 (13:52 -0700)]
[relay][pass manager] Open transform namespace (#3226)

5 years ago[WIP] [Relay] [NNVM] [Frontend] implement MaxPool-8 and MaxPool-10 (#3114)
Yuta Hinokuma [Wed, 22 May 2019 18:48:39 +0000 (03:48 +0900)]
[WIP] [Relay] [NNVM] [Frontend] implement MaxPool-8 and MaxPool-10 (#3114)

5 years ago[Bugfix] Fix sort changing original input data issue (#3212)
Leyuan Wang [Wed, 22 May 2019 18:09:01 +0000 (11:09 -0700)]
[Bugfix] Fix sort changing original input data issue (#3212)

* sort bugfix for not rearranging input data

* separate sort schedule

* fix lint

* use identity op instead

* fix lint

* remove redundent code

5 years agoAdd packing for int8 1x1 convolution and support the int8 group convolution on X86...
llyfacebook [Wed, 22 May 2019 16:11:17 +0000 (09:11 -0700)]
Add packing for int8 1x1 convolution and support the int8 group convolution on X86 (#2991)

* Support the 1x1 int8 conv with NHWC layout and weight packing

fix linter

* fix the memoize issue

* fix the failed nhwc test

* add the schedule for pack to unbreak other tests

* skip avx512 compile

* Support the 1x1 int8 conv with NHWC layout and weight packing

fix linter

* fix the memoize issue

* fix the failed nhwc test

* add the schedule for pack to unbreak other tests

* skip avx512 compile

* Unify the data_layout and kernel_layout relation

* add asf header

* fix the comment

* retrigger the build/test

5 years ago[Team] Eddie -> PMC (#3220)
Yizhi Liu [Wed, 22 May 2019 05:28:49 +0000 (22:28 -0700)]
[Team] Eddie -> PMC (#3220)

5 years ago[TFLite] Convert TFLite NCHW to NHWC (#3141)
Zhao Wu [Wed, 22 May 2019 02:44:47 +0000 (10:44 +0800)]
[TFLite] Convert TFLite NCHW to NHWC (#3141)

* Convert TFLite NCHW to NHWC

* Minor comment fix

5 years agoAdd `SkipVectorize` pass (#3222)
Logan Weber [Tue, 21 May 2019 23:34:35 +0000 (16:34 -0700)]
Add `SkipVectorize` pass (#3222)

5 years ago[Contrib] cblas batch_matmul (#3210)
hlu1 [Tue, 21 May 2019 23:05:28 +0000 (16:05 -0700)]
[Contrib] cblas batch_matmul (#3210)

5 years ago[Relay][heterogeneous pass] remove on_device op after annotation (#3204)
Zhi [Tue, 21 May 2019 19:53:58 +0000 (12:53 -0700)]
[Relay][heterogeneous pass] remove on_device op after annotation (#3204)

* remove on_device op after annotation

* Update src/relay/pass/device_annotation.cc

Co-Authored-By: MORINAGA <34588258+imorinaga@users.noreply.github.com>
5 years ago[relay][vm] remove throw in destructor (#3215)
Zhi [Tue, 21 May 2019 19:53:03 +0000 (12:53 -0700)]
[relay][vm] remove throw in destructor (#3215)

5 years agoAdd bing to reviewer (#3214)
Haichen Shen [Tue, 21 May 2019 08:03:34 +0000 (01:03 -0700)]
Add bing to reviewer (#3214)

5 years ago[Relay][TOPI] operator All (#3124)
Yong Wu [Mon, 20 May 2019 18:56:22 +0000 (11:56 -0700)]
[Relay][TOPI] operator All (#3124)

* [Relay][TOPI] operator All

* Update tests/python/frontend/tensorflow/test_forward.py

Co-Authored-By: yongwww <55wuyong@163.com>
* fix comments

* change to level 4

5 years ago[Relay][ONNX] fix #3134 converter where initializers were not registered as nodes...
Joshua Z. Zhang [Mon, 20 May 2019 17:07:32 +0000 (10:07 -0700)]
[Relay][ONNX] fix #3134 converter where initializers were not registered as nodes (#3143)

5 years ago[BugFix] Fix bug in cast to bool (#3207)
Haichen Shen [Mon, 20 May 2019 17:07:01 +0000 (10:07 -0700)]
[BugFix] Fix bug in cast to bool (#3207)

5 years ago[VTA] [TSIM] Improve tsim example (#3206)
Luis Vega [Mon, 20 May 2019 17:05:36 +0000 (10:05 -0700)]
[VTA] [TSIM] Improve tsim example (#3206)

5 years ago[BugFix][VTA] Fix bug in vta runtime DepPop function. (#3208)
Hua [Mon, 20 May 2019 17:01:49 +0000 (10:01 -0700)]
[BugFix][VTA] Fix bug in vta runtime DepPop function. (#3208)

Issue:
    One of existing illegal dependency check's condition always true,
    the correct logic actually should be such check for store and load.

Solution:
    Fix the said logic issue.

5 years ago[ARM] Fix concat (#3061)
hlu1 [Fri, 17 May 2019 17:29:07 +0000 (10:29 -0700)]
[ARM] Fix concat (#3061)

5 years ago[CODEGEN][CUDA][OPENCL] Handle INF and NAN (#3194)
lixiaoquan [Fri, 17 May 2019 17:13:17 +0000 (01:13 +0800)]
[CODEGEN][CUDA][OPENCL] Handle INF and NAN (#3194)

5 years ago[Relay] Better shape inference in TensorFlow Frontend. (#3176)
Josh Fromm [Fri, 17 May 2019 10:41:50 +0000 (03:41 -0700)]
[Relay] Better shape inference in TensorFlow Frontend. (#3176)

* Some bug fixes in tensorflow graph converter and added DepthToSpace operator.

* Made DepthToSpace better comply with other function syntax.

* Added better shape inference for unusual situations.

* Lint fixes.

* Added depthtospace test.

* Added test cases for value inference and depthtospace.

* Added fill testing.

* Made comment changes and added BroadcastTo op and tests.

* Fixed underlining and unneeded opt_level forcing.

* Added _infer_value assertion that all values to infer are available in passed parameters.

5 years ago[RELAY] Hotfix build_module creation (#3198)
Tianqi Chen [Thu, 16 May 2019 20:22:31 +0000 (13:22 -0700)]
[RELAY] Hotfix build_module creation (#3198)

5 years agoUpdate .gitignore (#3199)
雾雨魔理沙 [Thu, 16 May 2019 18:54:43 +0000 (11:54 -0700)]
Update .gitignore (#3199)

5 years agoQuick fix of VTA FPGA Toolchain Installation documentation (#3196)
Philipp Krones [Thu, 16 May 2019 18:00:38 +0000 (20:00 +0200)]
Quick fix of VTA FPGA Toolchain Installation documentation (#3196)

5 years ago[TOPI] Raise exception group_conv2d_nchw not supported (#3195)
Wuwei Lin [Thu, 16 May 2019 15:39:13 +0000 (23:39 +0800)]
[TOPI] Raise exception group_conv2d_nchw not supported (#3195)

5 years ago[TENSORLFOW] PlaceholderWithDefault (limited) implementation. (#3184)
Siva [Thu, 16 May 2019 03:55:38 +0000 (09:25 +0530)]
[TENSORLFOW] PlaceholderWithDefault (limited) implementation. (#3184)

5 years agoGet list of unsupported ONNX operators (#2995)
Mark Rogers [Thu, 16 May 2019 03:26:24 +0000 (20:26 -0700)]
Get list of unsupported ONNX operators (#2995)

5 years agoAdd the acc16 intrinsic support (#3081)
llyfacebook [Thu, 16 May 2019 03:21:35 +0000 (20:21 -0700)]
Add the acc16 intrinsic support (#3081)

5 years ago[Relay] Option to select which convolution layers are quantized. (#3173)
Josh Fromm [Thu, 16 May 2019 02:03:40 +0000 (19:03 -0700)]
[Relay] Option to select which convolution layers are quantized. (#3173)

* Stashing for later maybe.

* Added new option to leave specific layers unquantized.

* Better error checking.

* remove unneeded import

* tab to spaces

* pylint fixes

* more pylint fixes

5 years ago[Relay][Compilation] replace relay.build_module with C++ BuildModule (#3174)
Zhi [Thu, 16 May 2019 00:28:18 +0000 (17:28 -0700)]
[Relay][Compilation] replace relay.build_module with C++ BuildModule (#3174)

5 years ago[Datatypes] Custom datatypes (#2900)
Gus Smith [Wed, 15 May 2019 20:34:30 +0000 (13:34 -0700)]
[Datatypes] Custom datatypes (#2900)

* Register and use custom datatypes in TVM

This patch adds the ability to register and use a custom datatype from Python,
using the `register_datatype` call. The datatype can then be passed as the
`dtype` parameter using the syntax `dtype="custom[<type_name>]bitsxlanes"`.

* Removes extra file

* Register custom datatypes with TVM; specify Cast and Add lowering

This commit adds functionality for registering custom datatypes with TVM, and
furthermore adding custom lowering functions to lower those custom datatypes.
This commit only adds lowering for the Cast and Add ops; more ops will be added
soon.

Check out some custom datatype samples in my repository of samples:
https://github.com/gussmith23/tvm-custom-datatype-samples

* Register and lower casts from Python

* Formatting

* Fix include; was including too much

* Add comment

* Add DatatypeRegistered

* Add storage size field to custom datatypes

This field indicates the bitwidth of the opaque block of data into which
instances of the datatype will be stored, when TVM compiles. For example, if I
create a datatype with a storage size of 16, then
- Constants of that datatype will be created as unsigned 16-bit ints
- Calls to external functions taking that datatype will pass the data as
  unsigned 16-bit ints
- External functions returning that datatype will be assumed to return unsigned
  16-bit ints.

* Change how lowering funcs (Cast and other ops) are named in registry

tvm.datatypes.lower.<target>.cast.<dst-type>.<src-type>
becomes
tvm.datatypes.lower.<target>.Cast.<dst-type>.<src-type>

And fixes some sloppy code around how the other ops were being formatted.

* Update Python register_datatype to accept storage size

* Oops, left out one cast->Cast change

* Look up storage size when parsing `custom[typename]`

When we encounter this type string in Python, it will be parsed into a Halide
type object in C++. Some of my original code supported this parsing, but we now
have to attach the storage type to the type (by setting the bits field).

* Change how external calls for casting/other ops are done

Firstly, we now use the storage size of the custom type when determining
input/output types; e.g. a cast to a custom type with storage size 16 is seen as
a call to an external function returning an opaque uint of size 16.

Secondly, write a macro to handle the other ops. Originally I thought I could
handle these at runtime, with a single `_register_op` global. I transitioned
instead to using individual `_register_Add` etc. calls generated with a macro,
but I don't remember why.

* When encountering a custom type immediate, generate UIntImm

* Translate custom types to LLVM type

* Generate correct return type in Casts

Originally I was assuming that the result type from casts was always a custom
datatype, and so I was making the Call return a UInt type.

* Use TVM-idiomatic recursion style in DatatypesLowerer

This was actually a bug, I'm pretty sure; we wouldn't have recursed deep on any
complex programs. As a result of making this change, I also uncovered another
potential bug, where the datatypes lowering pass would attempt to lower a Load
of a custom type. By commenting out the `Mutate_` for Load, I was able to stop
the error from cropping up, but frankly, I'm not satisfied with the solution;
how is it that we are able to run codegen when Loads of custom datatypes are
present in the IR? I have not written any code, to my knowledge, that will
support this. Perhaps Load does not care about the underlying datatype?

* Use CHECK

* Add comment about which Mutate_s are needed

* Add comments

* Add GetCustomDatatypeRegistered as an extern C function

* Formatting, comments, casting

* Change how datatype string is formatted

* Use bits() instead of GetStorageSize

Use bits() instead of GetStorageSize

* Change comment

* Add datatype.py

* Change registered function name (datatypes->datatype)

* Remove GetStorageSize

* Format custom datatypes like any other datatype

Specifically, we now print the bits and lanes after the `custom[...]` string.

* Correctly implement datatype lowering in Python

* Remove unneeded include

* Make function naming consistent

* Use CHECK instead of internal_assert

* Rename macro

* Formatting

* Rename functions

* Implement Cast lowering

`_datatype_register_op` is now able to lower both binary ops and Casts.

* Formatting

* Formatting

* Clang format, google style

* Fix std::string/extern "C" warnings

* Formatting

* Formatting

* Lower Allocates and Loads during datatype lowering

This should ensure that there are no custom datatypes remaining once datatype
lowering is done. This will allow us to remove the code in the LLVM codegen
which deals with custom datatypes.

* Revert additions to codegen_llvm.cc which are now unneeded

* Pass cpplint on lower_datatypes.cc

* Add clarifying comment

* Remove datatype lowering registration funcs from C++

* Add CHECKs

* Remove TODO

* Remove all references to storage size

* Move and rename function

* Rename function

* Remove done TODOs and other handled comments

* Remove irrelevant Load code and comments

* Comment out the IR node types I'm not sure about yet

* Add bfloat16 datatype unittest

* Fix MakeConstScalar

MakeConstScalar for a custom datatype will now call out to a function which can
be registered on a per-datatype basis. The function will take a double and
return the equivalent value in the custom datatype format.

Note that these code paths are not actually used or tested at the moment. I have
not yet written an example which uses const scalars of a custom datatype.

* Formatting

* Change pass name

* Allow users to register whatever lowering function they want

Tianqi pointed out that users should be able to register whatever lowering
function they want, and should not be constrained to registering lowering
functions which just call out to external libraries.

I still provide a function for making lowering functions which call out to
external libraries, for convenience.

* Add clarifying comment

* Remove unneeded comment

* Remove unneeded function

* Rename file

* Undo unnecessary change

* Undo unnecessary change

* Make naming consistent

Rename "datatypes" to "custom datatypes" in most contexts.

* Revert an artifact of old code

* Fix build warnings, add TODO

* Lint

* Remove unnecessary use of extern C by separating decl and impl

* Error checking

* Remove TODO

* Missed a name change

* Lint

* Python lint

* Correctly format datatype

* Move bfloat16 to 3rdparty

* "custom_datatypes" --> "datatype" in most places

I left the pass as "LowerCustomDatatypes" to indicate that we're not lowering
anything other than custom datatypes. Otherwise, everything else has been
changed.

* Upgrade datatype unittest

I used a float calculator to generate some real testcases for the unittest.

* Separate public includes and private implementation

Specifically, create cleaner decoupling between datatypes stuff in packed_func
and the datatype registry implementation.

* Formatting

* Limit custom datatype codes to >128

* Add TODOs

* Fix comment

* Formatting

* Clean up datatype unittest

* Remove un-exported functions in public headers; UIntImm->FloatImm

More places where I accidentally was using implementation-only functions in
public headers.

Additionally, store custom datatype immediates as FloatImms. A later change will
add new lowering logic to lower these FloatImms to UIntImms.

Plus formatting change.

* Lint

* Use FloatImm (not UIntImm) to hold immediates of custom datatypes

This change switches from using UIntImm to FloatImm for storing immediates of
custom datatypes. The value of the number is stored in a double, which should be
enough precision for now, for most custom types we will explore in the immediate
future.

In line with this change, we change the datatype lowering so that FloatImms are
lowered to UInts of the appropriate size. Originally, this was going to be done
by allowing the user to register a double->uint_<storage size>_t conversion
which would be called at compile time to convert the value from the FloatImm to
a UInt and store it in a UIntImm. After discussions with Tianqi, we decided to
take the simpler route, and lower FloatImms just as we lower all other ops: by
replacing them with Call nodes. In this case, presumably the user will Call out
to a conversion function in their datatype library.

The justification for this decision is due to the functionality added in #1486.
This pull request adds the ability to load LLVM bytecode in at compile time.
This applies in our case as follows:
 1. The user writes their custom datatype programs and registers their lowering
    functions in the same way we've been doing it so far. All operations over
    custom datatypes are lowered to Calls to the datatype library.
 2. The user compiles their datatype library to LLVM bytecode.
 3. At TVM compile time, the user loads the LLVM bytecode. Depending on how the
    datatype library is written, Clang should be able to perform constant
    folding over the custom datatype immediates, even if their conversions are
    done with calls to the library.

Additionally adds test to test the FloatImm codepath.

* Re-add a change I removed accidentally during rebase

* Cleanup

* Remove unnecessary TVM_DLLs

* Add custom datatype utilities source file to Go runtime pack

* Revert "Remove unnecessary TVM_DLLs"

This reverts commit 4b742b99557fd3bf0ce6617f033c8b444b74eda4.

* Mark bfloat code as TVM_DLL

* Moves custom datatype runtime utilities to c_runtime_api.cc

* Revert "Add custom datatype utilities source file to Go runtime pack"

This reverts commit aecbcde0b2cc09a2693955b77037fe20f93b5bfd.

* Move datatype parsing to its own function

* Change comments

* Remove unneeded function

* Formatting

* Formatting

* Documentation

* Add kCustomBegin, use it for checking for custom types

* Documentation

* Formatting

* Move static definition to implementation

* Remove comment

* Decide toBeLowered before lowering arguments of Expr

In the past, e.g. when lowering custom datatypes for an Add, we would lower a
and b first, and then decide whether the resulting new Add needed to be lowered
based on the (new) types of a and b. Now, instead, we need to check the types of
a and b first (to see if they're custom types), and then lower them (so they'll
become non-custom types), and then lower the new Add.

* Revert "Move datatype parsing to its own function"

This reverts commit d554a5881afcf69af1c070d882a7651022703a09.

This broke parsing. Will figure this out later. There isn't a really clean way
to separate this out given how the rest of the function is written.

* Replace comment

* Documentation

* Remove comment and TVM_DLL

* Better error messages

* Remove artifact of rebase

* Separate datatypes parsing to its own function

* Add \returns

* Comment changes; add TODO

* Refactor tests

5 years ago[Relay][TensorFlow Frontend] SoftPlus Sqrt (#3187)
Yong Wu [Wed, 15 May 2019 05:42:34 +0000 (22:42 -0700)]
[Relay][TensorFlow Frontend] SoftPlus Sqrt (#3187)

5 years agoAvoid using heavy API to query single attribution (#3179)
ghostplant [Tue, 14 May 2019 17:22:33 +0000 (01:22 +0800)]
Avoid using heavy API to query single attribution (#3179)

5 years ago[RELAY][PASS] detect depthwise conv2d in mac_count pass (#3083)
eqy [Tue, 14 May 2019 12:34:16 +0000 (05:34 -0700)]
[RELAY][PASS] detect depthwise conv2d in mac_count pass (#3083)

* check in

* use groups

* CHECK_EQ

* trigger CI

* Update mac_count.cc

* trigger CI

* trigger CI

5 years agoadd onnx elemwise greater/less (#3186)
Joshua Z. Zhang [Mon, 13 May 2019 21:17:11 +0000 (14:17 -0700)]
add onnx elemwise greater/less (#3186)

5 years agocleanup: removed a piece of code that is redundant now given updates to HalideIR...
Salem Derisavi [Mon, 13 May 2019 19:48:00 +0000 (15:48 -0400)]
cleanup: removed a piece of code that is redundant now given updates to HalideIR submodule (#3169)

5 years agoFix a bug of flatten in ONNX to Relay converter (#3180)
Oldpan [Mon, 13 May 2019 18:03:41 +0000 (02:03 +0800)]
Fix a bug of flatten in ONNX to Relay converter (#3180)

* fix onnx frontend flatten bug

* Update onnx.py

* Update onnx.py

* Update onnx.py

5 years ago[GOLANG] Some fixes for golang latest version compiler. #3119 (#3182)
Siva [Mon, 13 May 2019 17:03:32 +0000 (22:33 +0530)]
[GOLANG] Some fixes for golang latest version compiler. #3119 (#3182)

5 years ago[Relay][Runtime] Add VM compiler. (#3139)
Jared Roesch [Sat, 11 May 2019 22:08:13 +0000 (18:08 -0400)]
[Relay][Runtime] Add VM compiler.  (#3139)

* Implement the VM compiler

* Fix issues

* Fix ASF headers

* Fix test issue

* Apply typo fixes.

* Update src/relay/backend/vm/compiler.cc

Co-Authored-By: 雾雨魔理沙 <lolisa@marisa.moe>
* Refactor compiler

* Fix

* Fix

* Fix in benchmark

* Fix

* Address comments

5 years ago[Bugfix] Check file exists before removing it (#3178)
hlu1 [Sat, 11 May 2019 05:55:11 +0000 (22:55 -0700)]
[Bugfix] Check file exists before removing it (#3178)

5 years ago[Relay][TensorFlow] Support tf.math.reduce_prod (#3166)
lixiaoquan [Sat, 11 May 2019 04:56:01 +0000 (12:56 +0800)]
[Relay][TensorFlow] Support tf.math.reduce_prod (#3166)

5 years agoRegister all operators' Python attributes in Python so they can be easily accessed...
Steven S. Lyubomirsky [Sat, 11 May 2019 00:25:54 +0000 (17:25 -0700)]
Register all operators' Python attributes in Python so they can be easily accessed from Python code (#3175)

5 years ago[HybridScript] Capture constant external python variables (#3157)
Lianmin Zheng [Fri, 10 May 2019 23:36:54 +0000 (07:36 +0800)]
[HybridScript] Capture constant external python variables (#3157)

5 years agoFix a tensorflow test bug. (#3165)
lixiaoquan [Fri, 10 May 2019 17:14:39 +0000 (01:14 +0800)]
Fix a tensorflow test bug. (#3165)

Length of input_shape isn't always 4.

5 years ago[codegen] heterogeneous build for c++ (#3144)
Zhi [Fri, 10 May 2019 04:29:16 +0000 (21:29 -0700)]
[codegen] heterogeneous build for c++ (#3144)

* heterogeneous build for c++

* merge relay buildmodule to codegen build

* use module split

* use target_host

* remove sse3

* retrigger ci

5 years agoFix a multithreaded bug in llvm LazyInitJIT (#3158)
Yinghai Lu [Thu, 9 May 2019 15:46:10 +0000 (08:46 -0700)]
Fix a multithreaded bug in llvm LazyInitJIT (#3158)

5 years agoadd more syncs (#3151)
Leyuan Wang [Thu, 9 May 2019 15:44:47 +0000 (08:44 -0700)]
add more syncs (#3151)

5 years ago[Relay][Runtime] Implementation of Relay VM (#2889)
Jared Roesch [Thu, 9 May 2019 06:09:15 +0000 (02:09 -0400)]
[Relay][Runtime] Implementation of Relay VM (#2889)

* Implement the virtual machine

Co-Authored-By: wweic <ipondering.weic@gmail.com>
* Fix rebase build issues

* Reorganize vm.py and fix allocator bug

* Remove compiler

* Remove tests

* Remove backend/vm/vm.cc too

* Fix docs

* Fix doc

* Fix doc

* Add vm docs

* Remove change to dead_code.cc

* Remove Relay logging

* Remove reduce

* Update include/tvm/runtime/vm.h

Co-Authored-By: jroesch <roeschinc@gmail.com>
* Reformat

* Update include/tvm/runtime/vm.h

Co-Authored-By: jroesch <roeschinc@gmail.com>
* Address feedback

* Update include/tvm/runtime/vm.h

Co-Authored-By: jroesch <roeschinc@gmail.com>
* Apply suggestions from code review

Co-Authored-By: jroesch <roeschinc@gmail.com>
* Fix a couple outstanding comments

* Last couple comments

* Update include/tvm/runtime/vm.h

Co-Authored-By: jroesch <roeschinc@gmail.com>
* Address code review feedback

* Fix final comment

* Address comments

* Error reporting and example

* add Const

* Explicitly delete copy assignment operator

* Fix rebase

* Pass 3rd arg to fusion

5 years ago[BuildModule] Fix AlterLayout Pass (#3155)
Bing Xu [Thu, 9 May 2019 04:06:33 +0000 (21:06 -0700)]
[BuildModule] Fix AlterLayout Pass (#3155)

5 years ago[Relay][Op] Adaptive pooling (#3085)
Yao Wang [Thu, 9 May 2019 00:21:41 +0000 (17:21 -0700)]
[Relay][Op] Adaptive pooling (#3085)

* Add topi adaptive_pool

* Use adaptive_pool to compute global_pool

* Add relay adaptive pool2d

* Fix lint

* Fix typo

* Minor change

* Change support level to 10

* Add contrib

* Remove global pool schedule

* Add contrib module

* Fix lint

* Update doc

* Update doc

5 years ago[RFC] [VTA] [TSIM] Enabling Cycle-Accurate Hardware Simulation for VTA #3009 (#3010)
Luis Vega [Wed, 8 May 2019 16:59:00 +0000 (09:59 -0700)]
[RFC] [VTA] [TSIM] Enabling Cycle-Accurate Hardware Simulation for VTA #3009 (#3010)

* merge files

* move verilator to the right place

* change name to tsim

* add default rule to be build and run

* add README for tsim

* Update README.md

* add some structural feedback

* change name of VTASim to VTADPISim

* more renaming

* update comment

* add license

* fix indentation

* add switch for vta-tsim

* add more licenses

* update readme

* address some of the new feedback

* add some feedback from cpplint

* add one more whitespace

* pass pointer so linter is happy

* pass pointer so linter is happy

* README moved to vta documentation

* create types for dpi functions, so they can be handle easily

* fix pointer style

* add feedback from docs

* parametrize width data and pointers

* fix comments

* fix comment

* add comment to class

* add missing parameters

* move README back to tsim example

* add feedback

* add more comments and remove un-necessary argument in finish

* update comments

* fix cpplint

* fix doc

5 years agofix python lint warnings (#3145)
Zhi [Wed, 8 May 2019 15:23:10 +0000 (08:23 -0700)]
fix python lint warnings (#3145)

5 years ago[CI] Always run cpptest during build to ensure library correctness (#3147)
Tianqi Chen [Wed, 8 May 2019 15:14:08 +0000 (08:14 -0700)]
[CI] Always run cpptest during build to ensure library correctness (#3147)

5 years agoRelay C++ Build Module (#3082)
Bing Xu [Wed, 8 May 2019 07:16:15 +0000 (00:16 -0700)]
Relay C++ Build Module (#3082)

* [Relay] C++ Build module

* asdf

5 years ago[Bugfix][TOPI] conv2d_transpose bugfix (#3138)
Leyuan Wang [Wed, 8 May 2019 04:51:00 +0000 (21:51 -0700)]
[Bugfix][TOPI] conv2d_transpose bugfix (#3138)

* deconv tests

* deconv bug fixed for certain cases tests added

5 years ago[DOC] fix :code: markup syntax (#3140)
Marcus Shawcroft [Wed, 8 May 2019 04:50:44 +0000 (05:50 +0100)]
[DOC] fix :code: markup syntax (#3140)

5 years agoHandle vectorize for LE statement (#3137)
Wei Chen [Wed, 8 May 2019 03:52:24 +0000 (20:52 -0700)]
Handle vectorize for LE statement (#3137)

* Handle vectorize for LE statement

Fix a new cases introduced by commit 7afbca5691fdb599cd90b043d5a5036e55cae2d6

* Add test

5 years ago[ROCm] Fix dense autotvm template registration (#3136)
masahi [Sun, 5 May 2019 12:17:29 +0000 (21:17 +0900)]
[ROCm] Fix dense autotvm template registration (#3136)

* Fix rocm dense autotvm template

* suppres lint warning

5 years ago[Relay][Frontend] add log op in tf frontend (#3111)
Yong Wu [Sun, 5 May 2019 08:08:10 +0000 (01:08 -0700)]
[Relay][Frontend] add log op in tf frontend (#3111)

* [Relay][Frontend] add log op in tf frontend

* address comment

5 years ago[TOPI] Fix mali conv2d performance regression (#3131)
Lianmin Zheng [Sun, 5 May 2019 08:05:18 +0000 (16:05 +0800)]
[TOPI] Fix mali conv2d performance regression (#3131)

* [TOPI] fix mali conv

* fix typo

* address comments

5 years ago[ARITH] Constraint-aware ConstIntBound, Enhance CanonicalSimplify (#3132)
Tianqi Chen [Sat, 4 May 2019 01:07:14 +0000 (21:07 -0400)]
[ARITH] Constraint-aware ConstIntBound, Enhance CanonicalSimplify (#3132)

5 years ago[DOC] Developer documentation for InferBound pass. (#3126)
Jessica Davies [Fri, 3 May 2019 09:48:18 +0000 (11:48 +0200)]
[DOC] Developer documentation for InferBound pass. (#3126)

* Developer documentation for InferBound pass.

5 years ago[DOC] Various documentation improvements (#3133)
Marcus Shawcroft [Thu, 2 May 2019 16:11:37 +0000 (17:11 +0100)]
[DOC] Various documentation improvements (#3133)

5 years ago[Relay][Runtime] Add memory manager for NDArray (#3121)
Jared Roesch [Thu, 2 May 2019 16:10:34 +0000 (12:10 -0400)]
[Relay][Runtime] Add memory manager for NDArray (#3121)

* Add support for custom NDArray memory management

Credit to @icemelon9 and @wweic

* Fix copy-paste issue

* Fix naive allocator.h

* Remove buffer field

* Apply Wei's suggestions.

Co-Authored-By: jroesch <roeschinc@gmail.com>
* Fix Wei's suggestion

* Fix go rts

* Break MM dependency

* Add docs and clean up diff

* Add more docs

* Move to VM folder

* Fix lint

* Remove Go dep.

* Rename to Empty

* Address Haichen's comments

5 years agoAdd MXNet converter for RNN layer ops (#3125)
Haichen Shen [Thu, 2 May 2019 15:59:22 +0000 (08:59 -0700)]
Add MXNet converter for RNN layer ops (#3125)

5 years ago[LINT] Add more allowed file type
Tianqi Chen [Thu, 2 May 2019 15:52:13 +0000 (11:52 -0400)]
[LINT] Add more allowed file type

5 years ago[Relay][Runtime] Add support for virtual machine Objects (#3120)
Jared Roesch [Thu, 2 May 2019 13:54:52 +0000 (09:54 -0400)]
[Relay][Runtime] Add support for virtual machine Objects (#3120)

5 years agoUpdate CONTRIBUTORS.md (#3130)
Lianmin Zheng [Thu, 2 May 2019 04:30:28 +0000 (12:30 +0800)]
Update CONTRIBUTORS.md (#3130)

5 years ago[DOC] Add missing targets to target_name documentation. (#3128)
Marcus Shawcroft [Wed, 1 May 2019 21:13:36 +0000 (22:13 +0100)]
[DOC] Add missing targets to target_name documentation. (#3128)