Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge #3

Merged
merged 357 commits into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
357 commits
Select commit Hold shift + click to select a range
e6d5318
[AutoScheduler] Separate shapes from DAG hash and enable schedule sha…
comaniac Jan 25, 2021
f3b852d
[FIX] Infer input shape in sparse_dense_padded's alter_op if one does…
tkonolige Jan 25, 2021
da446af
Fix warning showed with GCC10 (#7336)
ggardet Jan 25, 2021
6f75cff
[Relay][Training] Add more gradients (#7323)
altanh Jan 25, 2021
3d13809
fix tanh gradient and update tests to use downstream gradient (#7340)
altanh Jan 26, 2021
c53030f
[CMake] use wrong flag name (#7341)
windclarion Jan 26, 2021
ab8bc0a
Add resource_handle to TVM_DLL_EXPORT_TYPED_FUNC. (#7338)
areusch Jan 26, 2021
1e0d356
[Relay, TOPI] Add numpy style cumsum op (#7334)
masahi Jan 26, 2021
eeec538
Add resource_handle to both TVM_DLL_EXPORT_TYPED_FUNC and TVM_DLL_EXP…
jinchenglee Jan 27, 2021
38fa420
[FIX] Don't add $TVM_HOME/.. to the include path when compiling code.…
tkonolige Jan 27, 2021
eae21b0
[PRNG] Add check to PRNG to make sure that unsigned integer arithmeti…
tkonolige Jan 27, 2021
59e0a4a
[Torch] Various updates for PyTorch frontend (#7348)
masahi Jan 27, 2021
fd39122
[AutoScheduler] Enable schedule sharing in dispatch context (#7344)
comaniac Jan 27, 2021
4006bde
[Torch] More graph rewrites for Faster RCNN / MaskRCNN (#7346)
masahi Jan 27, 2021
00257f3
[Autodiff] Deterministic gradient compute (#7321)
hzfan Jan 28, 2021
d8efe70
[COMMUNITY] @trevor-m -> reviewer (#7352)
tqchen Jan 28, 2021
913abe0
[Relay][Frontend][Onnx] Robustify Loop Importer (#7353)
jwfromm Jan 28, 2021
02fefbc
If an expression has two branches, and the pattern ignores one with a…
Jan 28, 2021
8b84e33
Fold If when the condition is Constant (#7354)
Jan 28, 2021
cbc035f
Update uTVM code to work with the nRF5340DK dev board. (#7331)
mdw-octoml Jan 28, 2021
dda8f5d
[Frontend][Tensorflow] Sparse dense matmul adjoint option added (#7267)
Jan 28, 2021
67acad3
[Relay][PatternLang] Bug fix of rewrite func attr (#7358)
manupak Jan 28, 2021
f17cba7
[RUNTIME] Improve error messages for TypedPackedFunc (#7152)
tkonolige Jan 28, 2021
b8ad146
[Relay] Type Relation Fixes (#7362)
Jan 28, 2021
ef032b3
Remove MemoryPlan from VM passes (#7361)
Jan 29, 2021
f7275f9
Some docstring fixes. (#7367)
mdw-octoml Jan 29, 2021
f7862e7
[Relay][Frontend[Onnx] Add testing for output datatypes and fix relat…
jwfromm Jan 29, 2021
4f414fd
fix grad for zeros and ones (#7357)
altanh Jan 29, 2021
4142128
[BYOC][Verilator] change runtime registry function name (#7351)
vegaluisjose Jan 29, 2021
02c764c
disable one of rewrite in torch detection test (#7365)
masahi Jan 29, 2021
44a071a
[Refactor][VM] Port memory_alloc to c++ (#7369)
zhiics Jan 29, 2021
3734d5f
[CUDA][PASS]Legalize tensorcore (#7147)
Meteorix Jan 29, 2021
e892619
swap pytorch and tvm import order (#7380)
masahi Jan 31, 2021
96b0981
disable other rewrite to test CI (#7371)
masahi Feb 1, 2021
2365c7e
fix duplicated symbol bug in external codegen (#7383)
yhj050806 Feb 1, 2021
0d303b4
[Parser] Fix tokenizing inf (#7370)
masahi Feb 1, 2021
f7e05c3
Improve op_type missing message (#7384)
comaniac Feb 1, 2021
0bd259a
[COMMUNITY] @hzfan -> reviewer (#7360)
tqchen Feb 1, 2021
3635945
Refactor Dynamic to Static (#7368)
Feb 1, 2021
0ab9c95
[Relay][Passes] Iterative A-normal Traversals (#7374)
Feb 2, 2021
de0ab4c
Fix missing round(), floor(), ceil() for target C lowering (#7382)
cbalint13 Feb 2, 2021
da42924
[FFI] Improve error messages when array/map types do not match in fun…
tkonolige Feb 2, 2021
618ef9e
[TOPI] Add einsum operator (#6370)
hanke580 Feb 3, 2021
2e8133d
[TFLite] Added check for dynamic range quantization (#7114)
d-smirnov Feb 4, 2021
1de98be
Generate requirements.txt from Python spec (#7289)
areusch Feb 4, 2021
30c110c
[Bugfix][AutoScheduler] Fail to register ComputeDAG when deserializin…
comaniac Feb 4, 2021
9aec474
[CI] Temporary increase ci timeout (#7403)
tqchen Feb 4, 2021
f1b9663
[RPC] Replace timestamp with counter (#7389)
comaniac Feb 5, 2021
c118b08
Support negative pad values (#7375)
codeislife99 Feb 5, 2021
38c9eb1
Fix Bug in Bilinear Interpolation and Add Deform Conv to PT FrontEnd …
codeislife99 Feb 5, 2021
d8313d0
[AutoScheduler] Support early_stopping per task (#7377)
comaniac Feb 5, 2021
132cf6b
[CI] Add back the tests after timeout adjusted (#7408)
tqchen Feb 5, 2021
91e07e1
[Relay][Frontend][Onnx] Refactor where importer to support dynamic sh…
jwfromm Feb 5, 2021
4df530d
Add cuda tags and unit test (#7410)
zxybazh Feb 5, 2021
fc08430
check for dynamic rank before accessing value (#7414)
Feb 6, 2021
1f846f0
[VM] Minor refactor for C++ memory alloc (#7413)
masahi Feb 6, 2021
9daf3fe
Fix AutoScheduler for anaconda python (#7387)
dlexplorer Feb 7, 2021
33f30af
Fix compilation when Arm FP16 extensions are enabled (#7386)
MatthewARM Feb 7, 2021
5103bb6
Jenkinsfile changes for #7333. (#7388)
areusch Feb 8, 2021
0e7e2dc
[µTVM] Add VMWare to Reference VM instructions (#7221)
areusch Feb 8, 2021
c789a29
Generate JUnitXML from pytest (#7407)
areusch Feb 8, 2021
79b6ef7
[FIX,CMAKE] Only compile runtime files once (#7417)
tkonolige Feb 9, 2021
2b8d113
[TVMC] Allow manual shape specification in tvmc (#7366)
CircleSpin Feb 9, 2021
0716c2a
[AutoScheduler] Add sampling to dispatcher (#7376)
comaniac Feb 9, 2021
2999d03
[ONNX] Add CumSum operator to ONNX frontend (#7391)
echuraev Feb 9, 2021
68b7e71
[Relay][Topi][CPU] Dense with weight transform (#7404)
kevinthesun Feb 9, 2021
3863e09
[FIX,CMAKE] Only set Clang flags for C++ files (#7424)
tkonolige Feb 10, 2021
9175c6d
TRT Dynamic Reshape Fix (#7412)
codeislife99 Feb 10, 2021
12c6b70
Simplify full broadcast (#7423)
Feb 10, 2021
b7808fb
[Arith] Fix iter_affine_map with non-const extent (#7437)
vinx13 Feb 11, 2021
d05d75d
Stop running some python testsuites twice (#7430)
areusch Feb 11, 2021
6b58321
[BYOC][TRT] Fix small bug preventing TRT runtime compilation for vers…
Feb 11, 2021
8b9005f
Make the TVM targets list available in Python (#7427)
Feb 11, 2021
c52c176
Replace type punning with memcpy. (#7415)
grant-arm Feb 11, 2021
33829b3
Fix double compile of runtime sources for TRT, ACL (#7436)
Feb 11, 2021
d5851dd
[TIR][Printer] Fix SelectNode TIRTextPrinter bracket mismatch (#7405)
Beya2019 Feb 12, 2021
c7c54de
Update tags with minor fix (#7448)
zxybazh Feb 12, 2021
d769727
Add ROCm docker (#7422)
jtuyls Feb 12, 2021
e426c87
[AutoScheduler] Fix distill record (#7439)
comaniac Feb 12, 2021
b36bdf6
[Relay][Op][Bug] Fix missing return in scatter_nd cuda strategy (#7447)
altanh Feb 12, 2021
a1260cc
Make keras reshape less restrictive (#7446)
Feb 12, 2021
b8a8340
[µTVM] Use standalone_crt build tree for all µTVM builds (#7333)
areusch Feb 12, 2021
4e211a7
[ONNX] Make the ONNX Importer More Static (#7429)
Feb 13, 2021
0aa90b0
[VM] Move param bind to OptimizeModule (#7451)
masahi Feb 13, 2021
2e6e7dc
[Frontend][MXNet] Add support for MXNet GroupNorm (#7409)
Feb 13, 2021
2af3ab1
update stm32mp1 arm_cpu target configuration (#7443)
vinceab Feb 14, 2021
6187e1c
[FRONTEND][TFLITE] get input tensor information from graph (#7400)
Feb 15, 2021
32c4402
[µTVM] Print .elf statistics for a model runtime built with Zephyr (#…
gromero Feb 15, 2021
0ebc820
Add IdentityN operator for TF Frontend (#7452)
codeislife99 Feb 15, 2021
2264206
docker/bash.sh: lookup docker image in Jenkinsfile. (#7453)
areusch Feb 15, 2021
fc48514
[BYOC][Verilator] Refactor Verilator runtime (#7406)
vegaluisjose Feb 16, 2021
413692e
Make spelling of "axes" consistent (#7460)
gussmith23 Feb 16, 2021
564aae0
[Relay][Topi] Add max mode to ROI align (#7440)
electriclilies Feb 17, 2021
e57e644
[ROCM] Add Thrust support (#7458)
masahi Feb 17, 2021
173f3fc
SparseFillEmptyRows Op (#7442)
codeislife99 Feb 17, 2021
77d2fe8
[Bugfix][Relay] Crash in match_exhaustion.cc when given an empty tupl…
slyubomirsky Feb 17, 2021
fe398bf
Report JUnit test results for all TVM Python tests (#7450)
areusch Feb 17, 2021
76647ca
[ETHOSN] Add support for default Ethos-N78 configuration. (#6982)
tristan-arm Feb 17, 2021
143c88e
debug operator--() in include/tvm/node/container.h (#7461)
monchin Feb 18, 2021
b7e0cfb
[TOPI, Relay] Support roi_align NHWC layout (#7463)
masahi Feb 18, 2021
84c4b15
Set TOpPattern=kOpaque for scatter_nd (#7464)
apivovarov Feb 18, 2021
944d8d1
[RUNTIME] Fast path for single thread run to allow app level threadin…
masahi Feb 18, 2021
50e013d
[Torch] Add index_put operator (#7465)
apivovarov Feb 18, 2021
b51973f
[Relay][Bugfix] Fix off-by-one error in BiasAddRel, use new reporting…
slyubomirsky Feb 19, 2021
e204209
[AutoScheduler] Fix the type inference for conv3d (#7475)
merrymercy Feb 19, 2021
256b9cf
Get tvmc version from tvm (#7478)
NicolaLancellotti Feb 19, 2021
d16f282
[TVMC] Add composite target passes for compilation and tuning (#7304)
leandron Feb 19, 2021
5688068
[Frontend][Tensorflow] Support explicit_paddings for TF 2.x (#7445)
Feb 20, 2021
5a0573b
make test_runtime_rpc use pytest.main() (#7482)
areusch Feb 20, 2021
cfe88c1
[TIR] Specialize MutateArray in StmtFunctor. (#7486)
tqchen Feb 21, 2021
072c469
[CUDA][THRUST] Enforce -libs=thrust to allow thrust offload (#7468)
masahi Feb 22, 2021
d666b41
Fix cuda nms handling of additional per box features (#7483)
Feb 22, 2021
84359a9
Fixed minor misspelling (#7499)
mshr-h Feb 22, 2021
794f6c6
[Target] Add target host field for target specification (#7462)
zxybazh Feb 23, 2021
a111803
[RELAY][Parser] Optimize relay parser to restore calls attrs (#7347)
domin1985 Feb 23, 2021
d94cbbb
[Frontend]Make onnx gemm tensor C optional (#7489)
xutianming Feb 23, 2021
0ba3741
[CRT] Create C-runtime-style metadata module for llvm builds (#7398)
areusch Feb 23, 2021
929717a
Fix stack overflow when partially-__init__ Node raises exception. (#7…
areusch Feb 23, 2021
e67f15b
[COMMUNITY] @d-smirnov -> reviewer (#7510)
yzhliu Feb 24, 2021
d425c14
[Relay][Frontend][Onnx] Fix GEMM converter when C is not a parameter.…
jwfromm Feb 24, 2021
086dbfe
[AutoScheduler] Fix the type inference for conv2d (#7501)
tmoreau89 Feb 24, 2021
9c5333e
[TVMC] rename composite target "acl" to "compute-library" (#7508)
leandron Feb 24, 2021
88a4fdd
Support creating Bool constants in the pattern_utils (#7507)
Feb 24, 2021
7f86987
[Frontend][Tensorflow] Support range like axis in tf.raw_ops.All for …
Feb 24, 2021
1455536
[BYOC][VitisAI] Fix issue in Vitis AI codegen out tensor names matchi…
jtuyls Feb 24, 2021
9e74f90
Support CombinedNMS in TF frontend. (#7520)
Feb 25, 2021
fc6f08a
[Frontend] TF V2 sparse.todense() test added (#7473)
Feb 25, 2021
b77c019
[DOCS] Remove incubating from docs (#7525)
tqchen Feb 25, 2021
772fa6b
[PYTHON] Enable proper error message in python package (#7521)
tqchen Feb 25, 2021
b111695
Introduce module_loader to AutoTVM. (#7337)
areusch Feb 25, 2021
43b15a8
Many fixes to get unit tests passing on Windows. (#7431)
rkimball Feb 25, 2021
6274a7f
use checked_type instead of type_annotation (#7522)
Feb 25, 2021
e664b2f
[Torch] Avoid adding unnecessary slicing (#7479)
masahi Feb 26, 2021
63ea8e1
[Relay] Enforce static dim for non-concat axis if one or more tensors…
masahi Feb 26, 2021
09b0c8e
[Frontend][Tensorflow] Add unique operator (#7441)
ymwangg Feb 26, 2021
c46b187
[Torch] Pool ops, convert strides and pool_size to int (#7517)
alexwong Feb 26, 2021
56ac892
SparseReshape Op (#7477)
codeislife99 Feb 26, 2021
5c5aea6
[BUG_FIX][TOPI] Allow topi resize to accept more options (#7532)
electriclilies Feb 26, 2021
2d57470
[ONNX]fix datatype on Reciprocal op (#7519)
Feb 26, 2021
74ca8f0
[CI] Move ci-cpu to use llvm-11 (#7541)
tqchen Feb 26, 2021
0758337
Add create_local_debug_runtime to micro exports (#7528)
areusch Feb 27, 2021
f6d0fee
Don't run non-tvm_op GraphRuntime nodes in Debug Runtime over RPC. (#…
areusch Feb 27, 2021
e7f0a11
Add test_forward_index_put to __main__ (#7542)
apivovarov Feb 27, 2021
0bbc205
[torch] Add narrow operator (#7535)
apivovarov Feb 27, 2021
22ba2c4
[Torch] Simplify contiguous (#7544)
comaniac Feb 27, 2021
b1b3823
add missing equal sign (#7531)
vegaluisjose Feb 27, 2021
485dfd6
Fix typo in relay.vm.Executable (#7543)
ymwangg Feb 27, 2021
2673309
[Runtime] Special Memory Scope Support (#7488)
ZihengJiang Feb 28, 2021
51dc332
Fix foldconstant involving dropout (#7550)
masahi Mar 1, 2021
057a673
[TensorIR] introduce Block and BlockRealize (#312) (#7553)
Hzfengsy Mar 1, 2021
a1d43c1
[Autoscheduler][VM] Autoscheduler layout rewrite pass to VM (#7516)
tmoreau89 Mar 2, 2021
633ee11
fuse constant padding into conv kernels (#7515)
Mar 2, 2021
5d354e4
[Codegen][CUDA] Fix: cuda codegen vectorize cast (#7561)
kongroo Mar 2, 2021
08ea961
[Torch] Fix converting torch slice op with dynamic slice length (#7549)
masahi Mar 2, 2021
3a02e0b
[Pass] Profiling TVM compiler passes (#7500)
altanh Mar 3, 2021
cf36aa6
[TIR] Add TIR While node (#7425)
masahi Mar 3, 2021
91b6b3f
[RELAY] Modify some passes to not stack overflow on many lets. (#7558)
tkonolige Mar 3, 2021
67bba90
[torch] Add linear operator support (#7569)
apivovarov Mar 3, 2021
37053e1
[Tensorize] Support conds depend on outer loop vars inside tensorize …
leeexyz Mar 3, 2021
296700e
[CI][VitisAI] Update CI Vitis AI PyXIR version (#7575)
jtuyls Mar 3, 2021
dccc1ab
[SPIR-V] Add SPIR-V lowering for While node (#7574)
masahi Mar 3, 2021
25bf449
[Relay][Quantization] Fix Bug Which Cause Negative Left Shift Op (#7432)
Johnson9009 Mar 3, 2021
1d5f334
[Relay][bugfix][error reporting] BiasAddRel does not check for a nega…
slyubomirsky Mar 3, 2021
980cf80
compile engine dump tir and shape funcs (#7552)
wangxiang2713 Mar 3, 2021
73a0b96
[RUNTIME] Move Map into runtime (#7570)
tkonolige Mar 3, 2021
41c0591
[AutoSchedule] Fix a flaky test (#7580)
comaniac Mar 4, 2021
3f5f84d
[AutoScheduler] Querying and sampling in task extraction (#7571)
comaniac Mar 4, 2021
66f9139
[DOCKER] Fix: install script regarding get-pip.py during docker build…
brianlan Mar 4, 2021
02a6483
[ETHOSN] Add support for 20.11 Ethos-N driver stack release (#7506)
tristan-arm Mar 4, 2021
6aae48b
Fixes for using Python APIs from Rust. (#7085)
jroesch Mar 4, 2021
83ab234
Add segment sum Op to relay and 7 corresponding TF Ops , fix scatter_…
codeislife99 Mar 4, 2021
3fbb0a3
[BYOC][TensorRT] Make TRT runtime robust to empty or weird subgraphs …
Mar 4, 2021
d7f5753
[SPIRV] Support Bool buffer argument (#7591)
masahi Mar 5, 2021
d5cb3cb
[PyTorch] Guarantee data input is the first argument (#7592)
comaniac Mar 5, 2021
61e799c
[CI] Bump arm version (#7584)
zhiics Mar 5, 2021
fb06fd8
Fix for dynamic batch size conv2d nhwc (#7598)
masahi Mar 5, 2021
b9adce2
[Frontend][MXNet] Fix default value for is_ascend in topk (#7568)
Mar 5, 2021
c5f608f
[BYOC][TRT]Fix groups cannot divide output channel count error for de…
Laurawly Mar 5, 2021
5d5bbfb
Support negative axis for gather (#7600)
codeislife99 Mar 5, 2021
c0b9688
[Vulkan] Support passing 64 bit scalar (#7572)
masahi Mar 5, 2021
7344b66
Fix autotuning, broken in #7337 (#7566)
areusch Mar 5, 2021
d6c0cea
[RUNTIME] Add device specific timers (#7472)
tkonolige Mar 5, 2021
1ae4697
[Relay][Pass] Avoid stack overflow when using PostOrderRewrite (#7588)
hgt312 Mar 5, 2021
783be9d
[TOPI] disable test_shift with i8 datatype (#7597)
mesauser Mar 5, 2021
0b4f669
[AutoSchedule] Sparse dense tuning support with custom sketch rule (#…
jcf94 Mar 6, 2021
69c1c6d
Move SimplifyConvPad to a new pass and don't enable it by default (#7…
Mar 6, 2021
875f8ee
[Executor][Bugfix] Properly return and unflatten outputs from GraphEx…
altanh Mar 6, 2021
8aa2a7c
[CUDA] BF16 support (#7014)
hgt312 Mar 6, 2021
760e9b2
[Torch, QNN] Support quantized mobilenet v3 from torch 1.8 (#7606)
masahi Mar 8, 2021
cc7f8dc
[TE] Fix bug in AutoInlineElemWise and implement AutoInlineBroadcast …
leeexyz Mar 8, 2021
ca303aa
[Relay] add ShapeFunc for tanh (#6898)
monklof Mar 8, 2021
8d1f5b2
[Relay] Fix relay op strategy for cuda dense int8 (#7586)
huochaitiantang Mar 8, 2021
717c5e0
Add logging to diagnose flaky ci-qemu test (#7610)
areusch Mar 8, 2021
b827845
[Relay] add ShapeFunc for one_hot op (#7490)
monklof Mar 8, 2021
89bafd5
[RUNTIME] Unify load params interface (#7559)
tkonolige Mar 9, 2021
a8d1055
[FIX] Fix clang12 warnings (#7593)
tkonolige Mar 9, 2021
d830f2c
[Runtime][Object] Add Object::unique() (#7615)
junrushao Mar 9, 2021
dfc231c
[Bugfix][AutoScheduler] Correctly resume status (#7614)
comaniac Mar 9, 2021
8f9e5a4
Added MaybeAlign to CreateAtomicRMW calls to fix build for LLVM13 (#7…
LuukOddity Mar 9, 2021
12c3b3d
Prevent host Vulkan SDK blocking cross-compilation (#7609)
PENGUINLIONG Mar 9, 2021
a0656f5
[SPIRV] Minor update to TIR sort to make it work on VK/SPIR-V (#7607)
masahi Mar 9, 2021
92ab9e4
Allow cuDNN in non-CUDA non-system dir (#7608)
zhenhuaw-me Mar 9, 2021
85832a2
Fix RelayVM for 32-bit platforms (#7605)
apivovarov Mar 9, 2021
f3d9cc1
Fix TVM compile without LLVM (#7621)
Mar 10, 2021
3a0e3a5
[SPIR-V] Fix pushconstants offset calculation for 32 bit values (#7620)
masahi Mar 10, 2021
ee052dd
Introduce Model Library Format export format (#7533)
areusch Mar 10, 2021
8a9aebc
[Runtime][Contrib][Verilator] remove explicit destructor call (#7485)
vegaluisjose Mar 10, 2021
a877d53
fix:getcwd not work on android platform (#7390)
fantasyRqg Mar 10, 2021
6b1f180
Improve tensor mismatch ICHECK message (#7335)
ThomsonTan Mar 10, 2021
829f44c
[CUDA][TOPI] Fix CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES with NMS for cert…
Mar 10, 2021
cf2abc8
Grammar fix (#7622)
fredster33 Mar 10, 2021
dd61b04
[TIR] Add PreOrderVisit and VisitPrimFuncs (#7627)
junrushao Mar 11, 2021
c519863
[AutoScheduler] Fix incorrectly array context device and hide info at…
yuchaoli Mar 11, 2021
df6fb69
[MIPS] Fix CALL16 reloc at 0x290 not against global symbol (#7634)
apivovarov Mar 11, 2021
56feab9
[Test] Add Test Case to Cover Bug Fix by PR#7432 (#7601)
Johnson9009 Mar 11, 2021
f8596b5
[ONNX] Use take instead of min in NMS conditions (#7633)
masahi Mar 11, 2021
b2a3c48
[Ansor] Add HW param for Vulkan tuning (#7626)
masahi Mar 11, 2021
017ff94
[TOPI] Sparse Add Op added (#7435)
Mar 11, 2021
e9e014b
[Relay][QNN] Simulated Quantize and Dequantize (#7613)
jwfromm Mar 11, 2021
68b81ad
Introduce Apple BNNS backend (#7299)
apeskov Mar 12, 2021
8d08b21
[PROFILING] Combine USE_VM_PROFILER and USE_GRAPH_RUNTIME_DEBUG into …
tkonolige Mar 12, 2021
9d72bd0
[RUNTIME] Switch time evaluator to use device specific timing. (#7631)
tkonolige Mar 12, 2021
1a50679
fix missing qparams in aten::upsample_nearest2d (#7646)
eleflea Mar 12, 2021
b80e777
[docs] Getting Started with TVM: Auto Scheduler and matmul (#7644)
hogepodge Mar 12, 2021
fe25b9e
[TVMC] Allow options on --target to contain dots. (#7651)
leandron Mar 12, 2021
692da0a
[docker] fixed ci-gpu docker environment path typo. (#7648)
YubinCao Mar 15, 2021
3beec22
Fix issue when group attribute isnt defined in convtranspose. (#7655)
jwfromm Mar 15, 2021
1878889
revert SET_LLVM flag (#7657)
LeiWang1999 Mar 15, 2021
d373d25
fix build break for android_rpc (#7664)
euntaik Mar 15, 2021
10f5d17
[TVMC] Refactoring to document the --target regex and simplify test c…
leandron Mar 15, 2021
5bd78b3
[TVMC] Fix to check whether a path passed to --target is strictly a f…
leandron Mar 15, 2021
67f8397
Fixed strided_slice size (#7659)
akmaru Mar 15, 2021
068fed9
Remove pytest dependency in arm_compute_lib.py (#7556)
NicolaLancellotti Mar 15, 2021
7f96986
[Relay][Pass] Simplify consecutive transpose/layout_transform (#7656)
comaniac Mar 16, 2021
348d4e7
init the concat tensor with 1s and then slice them away (#7666)
Mar 16, 2021
d288bbc
[TOPI][GPU] Mergepath sort with odd-even block sort (#7611)
Mar 16, 2021
343b689
[docs] Getting Started with TVM: TVMC Tutorial (#7640)
hogepodge Mar 16, 2021
b8b63cd
add nvcc support (#7668)
Laurawly Mar 16, 2021
e697f03
Fix relay.testing.darknet convert_image (#7667)
apivovarov Mar 16, 2021
4abbe49
[Torch] Remove unnecessary reshapes for batch_matmul (#7675)
comaniac Mar 17, 2021
c55608f
[SPIRV] Declare int64 capability by default (#7681)
masahi Mar 17, 2021
60ff0c7
[Runtime] Extend Graph Runtime To Support Cuda Graph Launch (#7616)
zhuochenKIDD Mar 17, 2021
5c460ff
[COMMUNITY] @areusch -> Committer (#7679)
yzhliu Mar 17, 2021
c871784
[Frontend,TOPI] Improve dynamism for BatchMatmul and Dense (#7496)
monklof Mar 17, 2021
ab86aa6
[Relay][QNN] Relax simulated qnn tests to prevent flakiness. (#7684)
jwfromm Mar 18, 2021
4976bb2
[Relay] Add TopPattern to nn.dropout (#7685)
comaniac Mar 18, 2021
38aed59
[TVMC] Allow optional arguments to be passed to importers (#7674)
CircleSpin Mar 18, 2021
c976a07
[RUNTIME] Add libbacktrace for backtraces with line numbers (#7153)
tkonolige Mar 18, 2021
45442ed
[Relay][Training][Pass] Factor out first-order AD to a module pass (#…
altanh Mar 18, 2021
431a7d6
Default value for graph_runtime Init lookup_linked_param_func (#7676)
apivovarov Mar 18, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Torch] More graph rewrites for Faster RCNN / MaskRCNN (apache#7346)
* add post nms topk to max_out_size rewrite

* add argsort conversion

* scatter pattern first cut

* matching seems to working

* dup matching fixed

* add converter

* conversion seems working

* add reshape, use take

* remove pytorch argsort converter

* update test

* add doc
  • Loading branch information
masahi authored Jan 27, 2021
commit 4006bde68e32daeaac5de11d9fc331a28ff55706
258 changes: 245 additions & 13 deletions python/tvm/relay/frontend/pytorch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@
# under the License.
# pylint: disable=import-outside-toplevel, unused-argument, invalid-name
""" Common utilities used by PyTorch frontend """
from .. import expr
from .. import op
from ..dataflow_pattern import (
wildcard,
is_constant,
is_op,
rewrite,
is_tuple,
wildcard,
is_tuple_get_item,
is_if,
DFPatternCallback,
)

Expand All @@ -36,6 +39,19 @@ def is_version_greater_than(ver):
)


def dyn_strided_slice_pattern(inp, end):
"""A pattern to detect dynamic strided slice op."""
zero = is_constant()
cast_like = is_op("cast_like")(zero, is_constant())
less = is_op("less")(is_constant(), cast_like)
shape_of = is_op("shape_of")(inp)
cast_like = is_op("cast_like")(shape_of, is_constant())
add = is_op("add")(is_constant(), cast_like)
where = is_op("where")(less, add, is_constant())

return is_op("dyn.strided_slice")(inp, where, end, is_constant())


def batched_nms_pattern(boxes, scores, idxs, iou_threshold, num_boxes, indices):
"""A pattern to detect batched_nms function in torchvision

Expand Down Expand Up @@ -73,7 +89,6 @@ def batched_nms(boxes, scores, idxs, iou_threshold):

"""
one = is_constant()
zero = is_constant()

# Equivelent PyTorch code from above snippet
# offsets = idxs.to(boxes) * (max_coordinate + torch.tensor(1).to(boxes))
Expand All @@ -84,17 +99,10 @@ def batched_nms(boxes, scores, idxs, iou_threshold):

# The following doesn't appear in the above Relay snippet. It is required for dynamic
# stride_slice handling
cast_like = is_op("cast_like")(zero, is_constant())
less = is_op("less")(is_constant(), cast_like)
shape_of = is_op("shape_of")(mul)
cast_like = is_op("cast_like")(shape_of, is_constant())
add = is_op("add")(is_constant(), cast_like)
where = is_op("where")(less, add, is_constant())
shape_of = is_op("shape_of")(mul)
cast = is_op("cast")(shape_of)

# This corresponds to offsets[:, None], where offsets is the result of multiplication
dyn_strided_slice = is_op("dyn.strided_slice")(mul, where, cast, is_constant())
dyn_strided_slice = dyn_strided_slice_pattern(mul, cast)

# Add offsets to the boxes
expand_dims = is_op("expand_dims")(dyn_strided_slice)
Expand All @@ -112,8 +120,49 @@ def batched_nms(boxes, scores, idxs, iou_threshold):
)


class NMSRewrite(DFPatternCallback):
"""A callback to rewrite nms and restore batched nms"""
def topk_after_batch_nms_pattern(cond, true_branch, data, valid_count, indices, iou_threshold):
"""
Detect the following pattern used in torchvision detection models.

def batched_nms(...):
if boxes.numel() == 0:
return torch.empty((0,), dtype=torch.int64, device=boxes.device)
else:
...
return nms(boxes_for_nms, scores, iou_threshold)

keep = batched_nms(boxes, scores, lvl, self.nms_thresh)
keep = keep[:post_nms_top_k] # keep only topk scoring predictions

An equivalent Relay subgraph:

%1184 = if (%1117) {
...
} else {
...
%1172 = vision.non_max_suppression(%1167, %1168, %1171, -1, 0.7f, ...);
...
%1183 = dyn.strided_slice(%1174, %1180, %1182, ...);
cast(%1183, dtype="int64")
};
%1185 = strided_slice(%1184, begin=[0], end=[1000], strides=[1]);

"""
nms = is_op("vision.non_max_suppression")(
data, valid_count, indices, is_constant(), iou_threshold
)
indices = is_op("squeeze")(is_tuple_get_item(nms, 0))
size = is_op("squeeze")(is_tuple_get_item(nms, 1))
dyn_strided_slice = dyn_strided_slice_pattern(indices, size)
cast_i64 = is_op("cast")(dyn_strided_slice)

batched_nms_result = is_if(cond, true_branch, cast_i64)

return is_op("strided_slice")(batched_nms_result)


class MulticlassNMSRewrite(DFPatternCallback):
"""A callback to rewrite nms and restore batched nms."""

def __init__(self):
super().__init__()
Expand Down Expand Up @@ -169,10 +218,193 @@ def callback(self, pre, post, node_map):
return self.convert_batched_nms(boxes, scores, idxs, iou_thres, num_boxes, indices)


class PostNMSTopKRewrite(DFPatternCallback):
"""A callback to rewrite nms to exploit max_out_size parameter."""

def __init__(self):
super().__init__()
self.cond = wildcard()
self.true_branch = wildcard()
self.data = wildcard()
self.valid_count = wildcard()
self.indices = wildcard()
self.iou_threshold = wildcard()

self.pattern = topk_after_batch_nms_pattern(
self.cond,
self.true_branch,
self.data,
self.valid_count,
self.indices,
self.iou_threshold,
)

def rewrite_batch_nms_with_max_out_size(
self, cond, true_branch, data, valid_count, indices, iou_threshold, post_nms_topk
):
"""Use the detected post NMS topk parameter in NMS op."""
nms_ret = op.vision.non_max_suppression(
data=data,
valid_count=valid_count,
indices=indices,
max_output_size=post_nms_topk,
iou_threshold=iou_threshold,
force_suppress=False,
top_k=-1,
coord_start=2,
score_index=1,
id_index=0,
return_indices=True,
invalid_to_bottom=False,
)

size = op.squeeze(nms_ret[1], axis=[1])
data_slice = op.squeeze(nms_ret[0], axis=[0])

ret = op.strided_slice(data_slice, begin=expr.const([0]), end=size, slice_mode="size")

nms_result = op.cast(ret, "int64")

return expr.If(cond, true_branch, nms_result)

def callback(self, pre, post, node_map):
post_nms_topk = post.attrs.end[0].value
return self.rewrite_batch_nms_with_max_out_size(
node_map[self.cond][0],
node_map[self.true_branch][0],
node_map[self.data][0],
node_map[self.valid_count][0],
node_map[self.indices][0],
node_map[self.iou_threshold][0],
post_nms_topk,
)


def scatter_roi_align_result_pattern(levels, roi_align_results, num_scales):
"""Detect the Relay subgraph corresponding to the following PyTorch code

first_result = roi_align_results[0]
dtype, device = first_result.dtype, first_result.device
res = torch.zeros((levels.size(0), first_result.size(1),
first_result.size(2), first_result.size(3)),
dtype=dtype, device=device)
for level in range(len(roi_align_results)):
index = torch.where(levels == level)[0].view(-1, 1, 1, 1)
index = index.expand(index.size(0),
roi_align_results[level].size(1),
roi_align_results[level].size(2),
roi_align_results[level].size(3))
res = res.scatter(0, index, roi_align_results[level])
return res
"""

def do_where(levels, _):
idx_in_level = is_op("argwhere")(is_op("equal")(levels, is_constant()))
idx_in_level = is_op("split")(idx_in_level)
idx_in_level = is_tuple_get_item(idx_in_level, 0)
idx_in_level = is_op("squeeze")(idx_in_level)
idx_in_level = is_tuple_get_item(is_tuple([idx_in_level]), 0)
return idx_in_level

scatter_res = wildcard()

for i in range(num_scales):
# index = torch.where(levels == level)[0].view(-1, 1, 1, 1)
scatter_indices = do_where(levels, i)
scatter_indices = is_op("reshape")(scatter_indices)

# index = index.expand(index.size(0),
# unmerged_results[level].size(1),
# unmerged_results[level].size(2),
# unmerged_results[level].size(3))
scatter_indices = is_op("repeat")(scatter_indices)
scatter_indices = is_op("repeat")(scatter_indices)
scatter_indices = is_op("repeat")(scatter_indices)

scatter_res = is_op("scatter")(scatter_res, scatter_indices, roi_align_results[i])

return is_op("reshape")(scatter_res)


class ScatterRewrite(DFPatternCallback):
"""A callback to rewrite repeated scatters with a batched gather."""

def __init__(self, num_scales):
super().__init__()
self.num_scales = num_scales
self.levels = wildcard()
self.roi_align_results = []
for _ in range(num_scales):
self.roi_align_results.append(wildcard())

self.pattern = scatter_roi_align_result_pattern(
self.levels, self.roi_align_results, num_scales
)

def convert_scatter_to_gather(self, levels, roi_align_results):
"""Replace the detected scatter loop with the following PyTorch code

indices_per_level = []
for level in range(num_scales):
idx_in_level = torch.where(levels == level)[0]
indices_per_leve.append(idx_in_level)

stacked_features = torch.cat(roi_align_results, dim=0)
stacked_indices = torch.cat(indices_per_level, dim=0)
argsort_indices = torch.argort(stacked_indices)
return stacked_features[argsort_indices, :]
"""

# Collect inidices and concat them
indices_per_level = []
for i in range(self.num_scales):
equal = op.equal(levels, expr.const(i, dtype="int64"))
argwhere = op.argwhere(equal)
split = op.split(argwhere, indices_or_sections=1, axis=1)
squeeze = op.squeeze(split[0], axis=[1])
indices = op.cast(squeeze, dtype="int64")
indices_per_level.append(indices)

indices_concat = op.concatenate(indices_per_level, 0)

# Concat roi align results per level, and argsort indices
# To prepare for a batched gather
roi_align_results_concat = op.concatenate(roi_align_results, 0)
argsort_indices = op.cast(op.argsort(indices_concat), dtype="int64")

# Permute rows by argsorted indices
permuted = op.take(roi_align_results_concat, argsort_indices, axis=0)

return op.reshape(permuted, [0, -1, 1, 1])

def callback(self, pre, post, node_map):
levels = node_map[self.levels][0]
roi_align_results = [node_map[feat][0] for feat in self.roi_align_results]
return self.convert_scatter_to_gather(levels, roi_align_results)


def rewrite_nms_to_batched_nms(mod):
"""Rewrite the input graph to replace non maximum surpression
in torchvision that does not take class id into account with the one
that avoids IOU tests between different classes.
"""
mod["main"] = rewrite(NMSRewrite(), mod["main"])
mod["main"] = rewrite(MulticlassNMSRewrite(), mod["main"])
return mod


def rewrite_batched_nms_with_max_out_size(mod):
"""Rewrite the input graph to detect slicing after batched nms and
use the slicing size as the parameter max_out_size in NMS.
"""
mod["main"] = rewrite(PostNMSTopKRewrite(), mod["main"])
return mod


def rewrite_scatter_to_gather(mod, num_scales):
"""Rewrite the input graph to replace a repeated scatter loop with
a batched gather. The scatter loop is used in torchvision MultiScaleRoIAlign
to merge roi_align results for all scales. The scatter is used to emulate
inplace updates.
"""
mod["main"] = rewrite(ScatterRewrite(num_scales), mod["main"])
return mod
18 changes: 16 additions & 2 deletions tests/python/frontend/pytorch/test_object_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
import tvm.testing
from tvm import relay
from tvm.runtime.vm import VirtualMachine
from tvm.relay.frontend.pytorch_utils import rewrite_nms_to_batched_nms
from tvm.relay.frontend.pytorch_utils import (
rewrite_nms_to_batched_nms,
rewrite_batched_nms_with_max_out_size,
rewrite_scatter_to_gather,
)
from tvm.contrib.download import download


Expand Down Expand Up @@ -72,7 +76,7 @@ def generate_jit_model(index):
]

model_func = model_funcs[index]
model = TraceWrapper(model_func(pretrained=True, rpn_pre_nms_top_n_test=200))
model = TraceWrapper(model_func(pretrained=True, rpn_pre_nms_top_n_test=1000))

model.eval()
inp = torch.Tensor(np.random.uniform(0.0, 250.0, size=(1, 3, in_size, in_size)))
Expand Down Expand Up @@ -141,6 +145,16 @@ def compile_and_run_vm(mod, params, data_np, target):
after = mod["main"]
assert not tvm.ir.structural_equal(after, before)

before = mod["main"]
mod = rewrite_batched_nms_with_max_out_size(mod)
after = mod["main"]
assert not tvm.ir.structural_equal(after, before)

before = mod["main"]
mod = rewrite_scatter_to_gather(mod, 4) # num_scales is 4 for maskrcnn_resnet50_fpn
after = mod["main"]
assert not tvm.ir.structural_equal(after, before)

tvm_res_after_rewrite = compile_and_run_vm(mod, params, data_np, "llvm")

# Results should be equivalent after rewriting
Expand Down