* add attribute registration to init
* blackify
* remove unused improt
* jostle ci
* avoid circular import
* change order to match orig
* other things
Co-authored-by: Andrew Zhao Luo <andrewzhaoluo@system76-pc.localdomain>
* Add RandomUniform converter and tests to onnx frontend.
* Fix comments.
* Remove weird import.
* Add test against golden array.
* Retrigger CI
* Improve test comment.
* Retrigger CI.
* Add storage scope to ProducerRealize, always create a buffer with scope
* update schedule_ops.cc
* update schedule_postproc_to_primfunc.cc
* restore more realize_scope
This reverts commit b66c3baa54feeb8e34016713a1be21802b3296bf.
* make the default scope be "" instead of None in ir builder
* restore realize_scope visit in storage_flatten.cc
* update storage_access.cc
* make sure buffer var is of PointerType in ir builder
This reverts commit e650b6c24cabd52a073064e51c2e4fee816e88fd.
* enforce default storage scope of global
* added remap pass but does not work yet
* fixed all reduce issue
This reverts commit 8e20003c5325085ed22ee57180aca18644b3b5ab.
* simplify
* trying mitigation for aot test
* merge remaining changes from initial branch
* remove use of attr::storage_scope from codegen
* restore a visit to AttrStmt with attr::storage_scope in storage_rewrite
* disable check
* lint fix
* revert default scope to ""
* format
* fix volatile access to shared mem in lower all reduce
* fixed gpu coorporative load/store test
* pass storage scope to PointerType in tvm script parser
This reverts commit 99cfb9d18781dcfdea169d920450f9063ab18b6b.
* fixed tvmscript roundtrip test
* fixed tir flatten buffer test
* fixed test_tir_transform_hoist_if.py
* use storage scope global by default in aot_executor_codegen.cc
* add missing default storage scope in create_primfunc.cc
* restore StorageInfo struct in llvm backend
* UpdateStorageScope -> WithStorageScope
* fixed lower warp memory test
* GetStorageScope -> GetPtrStorageScope
* Enable storage scope invariant check in AttrStmt constructor
* remove GetPtrStorageScope and WithStorageScope from public header
* move RemapStorageScope to its own file
* add more method to RemapStorageScope
* update lower_thread_allreduce to use RemapStorageScope
* RemapStorageScope -> UpdatePointerStorageScope
* remove realize_scope from hybrid script
* removed realize_scope in schedule_ops
* remove realize_scope from schedule_postproc_to_primfunc
* remove remaining realize_scope usage from schedule_ops.cc
* remove realize_scope usage from storage_flatten.cc
* fixed test_tir_transform_lower_warp_memory.py following realize_scope removal
* Add storage scope to ProducerRealize, always create a buffer with scope
* update schedule_ops.cc
* update schedule_postproc_to_primfunc.cc
* restore more realize_scope
This reverts commit b66c3baa54feeb8e34016713a1be21802b3296bf.
* make the default scope be "" instead of None in ir builder
* restore realize_scope visit in storage_flatten.cc
* update storage_access.cc
* make sure buffer var is of PointerType in ir builder
This reverts commit e650b6c24cabd52a073064e51c2e4fee816e88fd.
* enforce default storage scope of global
* added remap pass but does not work yet
* fixed all reduce issue
This reverts commit 8e20003c5325085ed22ee57180aca18644b3b5ab.
* simplify
* trying mitigation for aot test
* merge remaining changes from initial branch
* remove use of attr::storage_scope from codegen
* restore a visit to AttrStmt with attr::storage_scope in storage_rewrite
* disable check
* lint fix
* revert default scope to ""
* format
* fix volatile access to shared mem in lower all reduce
* fixed gpu coorporative load/store test
* pass storage scope to PointerType in tvm script parser
This reverts commit 99cfb9d18781dcfdea169d920450f9063ab18b6b.
* fixed tvmscript roundtrip test
* fixed tir flatten buffer test
* fixed test_tir_transform_hoist_if.py
* use storage scope global by default in aot_executor_codegen.cc
* add missing default storage scope in create_primfunc.cc
* restore StorageInfo struct in llvm backend
* UpdateStorageScope -> WithStorageScope
* fixed lower warp memory test
* GetStorageScope -> GetPtrStorageScope
* Enable storage scope invariant check in AttrStmt constructor
* remove GetPtrStorageScope and WithStorageScope from public header
* move RemapStorageScope to its own file
* add more method to RemapStorageScope
* update lower_thread_allreduce to use RemapStorageScope
* RemapStorageScope -> UpdatePointerStorageScope
* remove realize_scope from hybrid script
* removed realize_scope in schedule_ops
* remove realize_scope from schedule_postproc_to_primfunc
* remove remaining realize_scope usage from schedule_ops.cc
* remove realize_scope usage from storage_flatten.cc
* fixed test_tir_transform_lower_warp_memory.py following realize_scope removal
* Address comments
* Remove blank line diff
Co-authored-by: Masahiro Masuda <masahi@129@gmail.com>
Co-authored-by: masa <masa@pop-os.localdomain>
* [PROFILING] Use PAPI to collect hardware performance counters on CPU and CUDA
This PR adds an optional dependency on PAPI
(https://bitbucket.org/icl/papi/) in order to collect hardware
performance counters on CPU and CUDA. These performance counters include
data like total cycles, instructions executed, and cache misses. Users
can control which performance counters are collected by setting the
TVM_PAPI_${DEVICE}_METRICS environment variable to a semicolon separated
list of metrics.
* Update CMakeLists.txt
Co-authored-by: Leandro Nunes <leandro.nunes@arm.com>
* move thread pool reset out of crt
* add docs
* comments
* formatting
* forgot one doc
* kDLGPU -> kDLCUDA
* Refactor API to more closely match pass instrument's.
* forgot files
* formatting
* more lint
* fix docs
* optional loading of papi metric collector in python
* more formatting
* fix check
* update docs and default value
* formatting
* addressing andrews comments
* fix docs
* address comments
* move shared initialization code into private function
* move most definitions from papi header to implementation file
Co-authored-by: Leandro Nunes <leandro.nunes@arm.com>
* Add qnn batch_matmul operator
- add support of the different out type for x86 batch_matmul
* Fix code style
* Add out_dtype to generic batch_matmul
* Restore fixe in batch_matmul for dynamic shapes
* Fix documentation for qnn.batch_matmul
* Remove debug code
* Modify zero point for qnn batch_matmul test
* Fix the integer overflow problem of the scatter_nd op.
* Fix scatter_nd's crash problem:
1. Existing scatter_nd cuda implementation has a very large bound,
which could overflow int32 range when input tensor shape is
large enough;
2. The overflow could cause the if statement always evaluate to
true, thus conducts invalid memory accesses;
3. We fix this problem in this commit by reducing the bound, the
original large bound is not only unnecessary, but also degrading
the performance; With this fix, scatter_op's performance improves
100x on some cases.
Co-authored-by: wenxizhu <wenxizhu@tencent.com>
* [Relay to Onnx conversion]
* added support for Sigmoid op
* added unit test
* [Relay to Onnx conversion][Copy]
* added support for Copy op
* added unit test
* [Relay to Onnx conversion][Round]
* added support for Round op
* added unit test
* [Relay to Onnx conversion][Cast]
* added support for Cast op
* added unit test
* [Relay to Onnx testing]
* fixed formatting
* * fixed formatting issues
* * fixed formatting issue in onnx.py
* [Relay to Onnx conversion][Conv2d Transpose]
* Added support for conv2d transpose operator
* Added unit test case. Unit test is similar to the conv2d unit test.
* * Fixed formatting errors
* [Relay to Onnx conversion][Pool]
* added missing ceil_mode in average pool and max pool conversion
* [Relay to Onnx conversion][Pad]
* Fixed issue in Pad conversion: changed pad_value to input instead of attrs
* Refer to PR: https://github.com/apache/tvm/pull/7860
* Updated unit test for Pad
* Fixed some formatting errors
* Replace RuntimeError in _lookup_task with deferred error.
This allows unknown tasks to be created (e.g., when parsing
autotvm log files) but not invoked.
* Format.
* Update python/tvm/autotvm/task/task.py
Co-authored-by: Cody Yu <comaniac0422@gmail.com>
Co-authored-by: Matt Welsh <mdw@mdw.la>
Co-authored-by: Cody Yu <comaniac0422@gmail.com>
-Some ops(ex:view) call infer_value when converting a model into Relay IR.
-If LLVM is not enabled, it leads to segementation fault.
Co-authored-by: kueitang <kueitang@qti.qualcomm.com>
With either the ci_lint docker image, or the matched version of
pylint==2.4.4, I got two lint errors running locally that didn't show
up in the CI. Fixing them.
Co-authored-by: Eric Lunderberg <elunderberg@octoml.ai>
* [Relay] Add support of conv2d with NHWC for Mali
Added template schedule for conv2d NHWC reusing similar strategy
as for NCHW layout. The schedule is also added to the
corresponding test that can be run to verify correctness.
* [Relay] Fix issue from pylint in conv2d for Mali
When dilation is larger than value 1 in conv2d with NHWC
layout, the ordering of indexes when accessing data array
in computation of convolution appears to be incorrect.
'data_vec' is defined as
lambda n, oho, owo, kh, kw, ic, ohi, owi:
But accessed as
data_vec[n, oho, owo, kh, kw, ohi, owi, ic]
This patch fixes the order of indexes and modifies the test
so that it is suitable for running on an AArch64 CPU.
Duplicate the CompileEngine interface.
Refactor the graph_runtime_codegen to invoke the new LowerTE pass
More changes
Things appear to be working
Some tracing to get Relay code to flow through too.
Disable some assertions as exp.
Tweak printing for now
Fix a few bugs: (#13)
1. Don't add relay main function to list of lowered TIR functions
2. Don't skip visiting call to relay function in graph runtime codegen
Remove debug prints.
Start refactoring
Split out shared data structures
Fix implicit duplicate decl of IsDynamic
Clean up handling of name + global prim fn
Clean up the code and debug issue introduced by previous hack
Clean up the debugging
Do C++ lint clean up
Update src/relay/backend/graph_executor_codegen.cc
Co-authored-by: Chris Sullivan <csullivan@octoml.ai>
Clean up handling of external functions
Add more error messages
More clean up
Update src/runtime/graph_executor/graph_executor.cc
Co-authored-by: Chris Sullivan <csullivan@octoml.ai>
Update src/runtime/graph_executor/graph_executor.cc
Co-authored-by: Chris Sullivan <csullivan@octoml.ai>
Update src/relay/backend/te_compiler.h
Co-authored-by: Haichen Shen <shenhaichen@gmail.com>
Update src/relay/backend/te_compiler.h
Co-authored-by: Haichen Shen <shenhaichen@gmail.com>
Fix
CR
More CR
Format
Fix lowering path for C++
Fix tests
Remove uncessary change
Clean up a few more things
CI fix
Fix the default context
Fix
Fix broken test cases
Update
Fix
WIP
Clean up storage data structures
WIP
WIP
Fix build errors
Remove TVMLower
Fix lint
Lint again
fix black
Move UpdateMainWorkspaceSize into te_compiler.cc
Fix link errors
Formatting
Change UpdateMainWorkspaceSize to return Map<String, FunctionInfo>
Workaround for GCC 5 error caused by enums in maps (GCC 5 is on i386 CI)
Testing how functions should be named
Lint
Change how function metadata is updated
Attempt to update aot_executor_codegen to use new StaticMemoryPlan instead of storage_device_map
Pass memory plan through LowerTE into UpdateMainWorkspaceSize so that we don't need to run GraphPlanMemory an extra time
Fix return in UpdateMainWorkspaceSize
Lint
Try to fix UpdateMainWorkspaceSize
Fix construction of static memory plan
Clean up code while debugging
Adding UpdateWorkspaceSize back
Add closure + call to UpdateFunctionMetadata (WIP)
UpdateFunctionMetadata builds; weird error with device ctx map though. Not sure if it came from this change or something else
Add some debugging of UpdateMainWorkspaceSize
Starting to move UpdateFunctionMetadata call to use process_fn infra
UWhat target should be passed to UpdateFunctionMetadata?
UpdateFunctionMetadata is not workinggg
Added some comments about UpdateFunctionMetadata for Jared
Fix the creation of function metadata
Try another stab at cleaning up the information
Fix
Port StorageInfo and StaticMemoryPlan data structure (#8297)
Restoring reshape opt
Fix tests
Caught a nasty typo from Lily, Map::Set does not mutate
Format
Disable stupid Google style warning
Rebase cleanup
Formatting
Add docstring for storage info
Black
Post rebase fix
Remove prints
Disable assert that doesn't make sense for now
Fix lint
Add copying attrs from relay node to graph node; still need to figure out how to do this in the case of global vars
Work with Lily to fix graph attrs
Try to figure out where extra arguments are coming from; fix merge
passes the profiling test
Clean up
Fix profile test
Remove debugging
Add attributes for BYOC uTVM case
Format
Dumb typo
Another fix for byoc
Format
Fix last 3 failing tests
Format
Fix final two test cases
Format
Fix lint
Fix again
Fix
Fix auto scheduler code
Fix issue
Address CR comment
Format
Co-authored-by: Jared Roesch <roeschinc@gmail.com>
* Fix AttributeError when TEST_DATA_ROOT_PATH is set
Initiate a Path object from TEST_DATA_ROOT_PATH to fix the error:
AttributeError: 'str' object has no attribute 'mkdir'
* [DOCS] Add docs for Pass Instrument
- Add a tutorial about how to use pass instrument.
- Add related sections in Pass Infrastructure documents.
* Fix ir.rst, the length of separator.
* Fix unused local name
* Fix linting errors
* Fix linting errors
* Fix linting errors
* Address code-review feedbacks
* Fix linting
* Fix the order of tutorial.
* Add exception handling. Address feedbacks.
* Fix CI error -- clearing instruments in global pass_ctx
* Clarify section hierachy.
* Emphasize to use decorator instead of subclassing
* Add a sentence to explain Pass Instrument. Fix typo.
* Shrink python docs a little.
* Fix tag name.
* Address feedbacks.
* [ONNX] Wrap 'If' if it has multiple outputs
Without this wrapper, an assertion in from_onnx() will fail with the
error message showing ""Number of output mismatch"
* [ONNX] Test If nodes with multiple output tensors
* Fix formatting issues
* rename resize to resize2d
* refactor resize_2d
* Add resize1d op, normalize attribute names across ops
* normalize resize3d to match the API of 1D and 2D
* fix lint
* fix relay tests from API change
* refactor topi tests, docs
* fix method naming in framework frontends
fix more frontend issues
* refactor resize tests to reuse components, add more coordinate tranform modes to tests
* add cubic resize reference kernel and tests, add relay tests for resize1d
* fix pylint
* fix test typo
* rename _update_target and document its function
* make tvm.build return OperatorModule to return multiple outputs
* allow retrieving the var names used in TIR repr
* add Operator Model Library Format and test
* Add pathlib convenience functions to utils.TempDirectory.
* fix tests
* black format
* git-clang-format
* pylint fixes
* add asf header
* change memory map to make more sense, fix tests
* address giuseros comments
* align GetVarName with future TypedPackedFunc
* fix test
* clang-format
* rev model library format to v4 (bad merge)
* Fix np.int and np.float usage in the tree.
Newer versions of numpy give loads of warnings that suggest
that np.int and np.float will be deprecated. CI uses pytest
and these warning logs clog memory for testing and make it
slower.
* Fix formatting
After fix a66186b, I saw that it should be necessary to do the same fix
for depthwise_conv2d for intel graphics. I saw that we never used the
removed code and it is just the same code from
cuda/depthwise_conv2d.py. So we can use the cuda implementation when it
will be necessary.
* Allow tvmc to compile models with AOT executor
The tflite_compiled_model fixture was getting duplicated a few times so
I've added a parameterized fixture tflite_tvmc_compiler which combines
tmpdir_factory setup with compile_model
Nested targets broke a basic string split, so in cases where we use
nested targets I replaced the string split with shlex split
* Clarify that graph JSON is required only for graph executor
Plus other clean ups
* Change parametrize fixture to use string instead of list