Currently, in some cases this round-trip cannot be completed. For
example, if an Integer value has a value outside a 32-bit signed
integer range, or if a String value contains spaces.
Co-authored-by: Eric Lunderberg <elunderberg@octoml.ai>
* add gather_nd shape func
* refactor gather_nd ref funcs
* add dynamic gather_nd test
* gather_dim -> num_indices_per_tuple
* support dynamic scatter nd
* minor fix
* fix pylint
* rename to index_rank and make it Optional
* pylint, do not use -1 for default value
This commit pins the black version to provide stability.
It is expected that the pinned version will be moved forward periodically.
Change-Id: Ied866bff85a1a832959bc1d4673a7fdec68128a7
* [Vulkan] Enable instance/device extensions
- Vulkan requires that extensions be explicitly enabled if used.
Explicitly list out which extensions are required (currently none)
and which are optional.
* [Vulkan] Extract device information from vulkan API.
- Based on vkGetPhysicalDeviceProperties and
vkGetPhysicalDeviceFeatures, determine which Vulkan capabilities are
supported, pack into a Target.
* [Vulkan] Query instance-supported apiVersion before creating instance
- Previously, vkCreateInstance was called to initialize Vulkan 1.0.
* [Vulkan] Moved options for dedicated allocation and push descriptors to environment variables
- Query support for dedicated allocation and push descriptors along
with the rest of the device support. Move the options to disable
their use from compile-time variables to environment variables
`TVM_VULKAN_DISABLE_PUSH_DESCRIPTOR` and
`TVM_VULKAN_DISABLE_DEDICATED_ALLOCATION`.
* [Vulkan] Move option for vulkan validation layers to environment variable
- Moved to enable faster use as a debug tool. If
`TVM_VULKAN_ENABLE_VALIDATION_LAYERS` is a non-empty string,
validation layers will be enabled.
* [Vulkan] Explicitly enable vulkan features in device creation
- Vulkan requires that features be explicitly enabled before use. For
each feature that the device supports and a shader might use,
declare it in the call to `vkCreateDevice`.
* [Vulkan] Avoid repeated queries for device attributes.
- Implement `VulkanDeviceAPI::GetAttr` based on the per-device values
stored in the Target. This pulls all logic for querying device
parameters is in a single location.
* [Vulkan] Implement "from_device" flag for the vulkan target.
- With the number of device capabilities that may or may not be
supported by a vulkan driver, it can be tedious to input them.
Specifying "-from_device=0" now indicate that any unspecified values
should be read from the device.
* [Vulkan][Codegen] Read vulkan device capabilities/limits from Target
- Previously, the codegen assumed that all device features were
present. Now, the codegen reads device capabilities from the
Target, and throws an error if codegen would require use of an
unsupported feature.
Co-authored-by: Eric Lunderberg <elunderberg@octoml.ai>
* [TVMC] Add support for the MLF to 'compile' command
Add support for the Model Library Format (MLF) to 'tvmc' so users can
output compilation artifacts to a MLF archive passing the new flag
'--output-format mlf'. For instance:
$ python3 -m tvm.driver.tvmc compile ./sine_model.tflite --target="c" --output sine.tar --output-format mlf
will generate a sine.tar archive that is serialized accordingly to the
MLF.
Since the MLF is currently meant to be used only on micro targets, an
error is generated if one tries to run a MLF outside a micro context.
The micro context does not exist yet but will be later introduced as
part of the [RFC] "TVMC: Add support for µTVM".
That commit also adds 3 pytest tests to test tvmc + MLF.
Finally, it also fixes some missing periods in the 'compile' command
help sections and renames export_format to output_format so there is
no confusion with flag '--dump-code', which contains "formats to export"
in its help section.
Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
* Fix missing importorskip in the import_package test
Fix missing importorskip() in the import_package test allowing the
test in question to be skipped when 'tflite' is not installed in the
test environment, otherwise the test will fail with:
[...]
> archive_path = exported_tvmc_package.package_path
E AttributeError: 'str' object has no attribute 'package_path'
* added test infrastructure for frozen TF2 models
* linting with black
* removing some comments
* change in comment in sequential test
* addressed the comments
* refactored to place vmobj_to_list in a common file
* Added helper function in python/tvm/relay/testing/tf.py
Co-authored-by: David Huang <davhuan@amazon.com>
Co-authored-by: Rohan Mukherjee <mukrohan@amazon.com>
Co-authored-by: Xiao <weix@amazon.com>
* Refactor tf according to CI error
Co-authored-by: David Huang <davhuan@amazon.com>
Co-authored-by: Rohan Mukherjee <mukrohan@amazon.com>
Co-authored-by: Xiao <weix@amazon.com>
* Added docstring
Co-authored-by: David Huang <davhuan@amazon.com>
Co-authored-by: Rohan Mukherjee <mukrohan@amazon.com>
Co-authored-by: Xiao <weix@amazon.com>
* removing print
Co-authored-by: David Huang <davhuan@amazon.com>
Co-authored-by: Xiao <weix@amazon.com>
* fix bugs in the auto scheduler record:
* reformat the code
* reformat the code
* use the os.path.abspath
* change error to warning
* reformat the warning code
* fix some typos
* fix some typos
* fix some typos
* fix the port number typo
Add the possibility to provide the cross compiler options when using the
tvmc compile functionality.
With some cross compiler, toolchains --sysroot option (at least) need to be
defined.
tvmc/test_compile.py as been updated to introduce simple tests to validate
the cross options functionnality.
Signed-off-by: Vincent ABRIOU <vincent.abriou@st.com>
* Add uniform distribution generator wrt threefry PRNG
* fix lint
* remove the redundant print
* modifications based on review
* update docs
* update uniform algorithm to use bit operations only
* add type restrictions
* minor fix upon review
* update test and error information
* [TOPI] Custom schedule for standalone transpose in cuda
* check if input is not Any
* fix vta test
* check input shape
* fix injective
* move transpose out of sparse.py
* update comments, use warp size
* missspelled transform
* formatting
* rename test
* comment
* fix tests
* Supporting dynamic slice on first few axes
* fix index normalization
* update dynamic slice tests
* pylint fix
* fix loop index dtype
* fix more dtype issue
* fix bugs in the auto scheduler record:
* reformat the code
* reformat the code
* use the os.path.abspath
* change error to warning
* reformat the warning code
* [RUNTIME] Improve signal handling in python env.
Python execution environment handles the signal by caching
the signal a state and invokes the handler when execution
goes into the python interpreter.
This model can cause problem when runnning a long running
c++ function. As keyboard interrupt can only be caught in the end.
Additionally, because python registered special signal handlers.
Socket operations can return EINTR that needs to be explicitly
retried when the interrupt is not a KeyboardInterrupt.
This PR adds the following changes to resolve these problems.
- Allow execution env(python) to register CheckSignals function
to the TVM runtime.
- Add runtime::EnvCheckSignals to check the signal error.
- Add retry when EINTR is encountered in socket.
- Register the python C API functions in cython mode.
To testout the EnvCheckSignals, run the following code
```python
import tvm.testing
tvm.testing.run_check_signal(10)
```
Note that the C API functions are only registered in cython FFI mode
because ctypes have problems invoking these functions. This however
won't affect the correctness, but will defer the interrupt handling
to function return sites.
Co-authored-by: Andrew Reusch <areusch@octoml.ai>
Co-authored-by: Robert Kimball <bobkimball@gmail.com>
* Address comments
* Alternative implementation that preserves python exception.
* Address comments
* Update check signals
Co-authored-by: Andrew Reusch <areusch@octoml.ai>
Co-authored-by: Robert Kimball <bobkimball@gmail.com>
* fix conv transpose import from TF
* fix String::fromwe() to String::from()
* * fixing pytorch converter to take into account the output_padding parameter for conv transpose operations
* updating pytorch converter to correctly convert conv1d to conv1d in tvm inestead of a flattened conv2d unless under circumstances of grouped convolution
* updating pytorch converter to correctly convert conv1d transpose to conv1d transpose in tvm instead of a flattened conv2d transpose
* added tests to cover these latest additions
* * removing print statements used for debugging
* * fixing typos and formatting
* * fixing formatting
* * fixing grammar
* * formatting fixes
* * updated formatting after running pylint and python_format checks
Co-authored-by: Mikael Sevenier <mikael.sevenier@sima.ai>
* [TVMC] convert timeout flag to int
fixes Check failed: type_code_ == kDLInt (11 vs. 0) : expected int but got str
when setting the timeout option using the cli flag.
* [TVMC] fix typo in tvmc tune help
* Fixed strided_slice alteroplayout bug.
* add test for non standard int8 conv2d padding.
* Add test for large index slices.
* Us same dtype as input in strided slice.