Commit Graph

43 Commits

Author SHA1 Message Date
Gavin Uberti 3cca6465ba [microTVM] Autotuning performance tests (#11782)
* Common autotuning test

* Autotuned model evaluation utilities

* Bugfixes and more enablement

* Working autotune profiling test

* Refactoring based on PR comments

Bugfixes to get tests passing

Refactor to remove tflite model for consistency

Black formatting

Linting and bugfixes

Add Apache license header

Use larger chunk size to read files

Explicitly specify LRU cache size for compatibility with Python 3.7

Pass platform to microTVM common tests

Better comment for runtime bound

Stop directory from being removed after session creation

* Use the actual Zephyr timing library

Use unsigned integer

Additional logging

Try negation

Try 64 bit timer

Use Zephyr's timing library

Fix linting

Enable timing utilities
2022-07-05 10:36:26 -07:00
xndcn 2f8b008730 [tests] Fix changed var name from 'target_str' to 'target_names', NFC (#11982) 2022-07-01 17:06:51 +01:00
Florin Blanaru 288b983b82 [CI] Skip some additional tests that are failing in the wheel (#11969)
This PR skips some additional tests that are failing in the nightly wheel.
2022-06-30 12:50:21 -07:00
driazati c0f4bf72b6 [ci] Redirect sphinx-gallery URLs to S3 (#11839)
Co-authored-by: driazati <driazati@users.noreply.github.com>
2022-06-30 09:10:12 -07:00
Dmitriy Smirnov 08723d0ce6 [usmp] U3 use case (#11015)
* U3

Change-Id: Ibc088f19ad1dc9466fc368f8523baa30ee88b7d0

* addressed upstream comments

* Unit test added

Added unit test for InterfaceCNode::EmitConstantPool method
2022-06-28 12:02:21 +01:00
Dmitriy Smirnov c80da037d8 [USMP] Adding support for U1 usecase for constant pools (#10189)
* [TIR.Constant] U1 usecase

Constants are now aggregated into one struct and initialized in default_lib0.c
file

Change-Id: I34d61f8139c8a92c06944fe990ba892a660476fd

Unit test fixed

Change-Id: I436e7b6d6b3064b3f8bbfbb048d4296b63a6b69c

* Refactored

Addressed:
* PoolInfo splitted to WorkspacePoolInfo and ConstantPoolInfo
* workspace_byte_alignment moved to ExecutorCodegenMetadata
* getModuleAlignment -> GetModuleAlignment
* GenerateInternalWorkspaceBuffers refactored
* reverted format change of src/tir/transforms/legalize_packed_calls.cc
* addressed comments for src/tir/usmp/analysis/extract_buffer_info.cc
* removed commented code from include/tvm/tir/usmp/utils.h

Change-Id: I7d1b32884b0e5992e2e00c7838c85e425d9c25fd

* more unit test fixes

Change-Id: I573a05fa1cb4037ae83691f7dff2c2724b1d7700

* More refactoring and unit test fixes

Added ConstantMemoryPools

Change-Id: If1e391c631575980564bca790ba33748c82d907f

* bugfix

Change-Id: Iacc7a9d734a505dfa0d8d32d23ea3f57e6de8582

* refactoring. added constant_alignment

added constant_alignment
unit tests updated

Change-Id: I378193cb9e675e352c61d96ff4e09655090053e1

* unit-test bugix

Change-Id: Ia4411d59c4a376c01326fed366cdb196a432899e

* unit test fix

Change-Id: Ia2077bdeb1d2c6c9827eeef90ab410ae31b8c4a4

* Added support for c++ runtime

* refactored

* renamed pools and consts

renamed pools and consts to workspace_pools and constant_pools

* addressed upstream comments

* addressed upstream comments-2

* addressed upstream comments-3
2022-06-22 16:41:53 -07:00
Florin Blanaru a64368be0e [ci] Skip failing tests in wheel (#11705)
Some python tests are failing in the wheel. This PR skips them if the environment variable `WHEEL_TEST` is set.

This PR is related to https://github.com/tlc-pack/tlcpack/pull/115.
2022-06-15 11:16:25 -07:00
Mark Shields dfc8e95604 [BYOC] Make CUTLASS BYOC integration 'Collage friendly' (#11631)
* [BYOC] Make CUTLASS BYOC integration 'Collage friendly'

(See https://discuss.tvm.apache.org/t/byoc-supporting-cutlass-byoc-with-collage/12796/6 for
context, which in turn is part of Collage (https://github.com/apache/tvm-rfcs/blob/main/rfcs/0062-collage.md).

Currently CUTLASS has four entry points:
 - The usual 'partition_for_cutlass' partitioning function, using the
   standard pattern table and pass machinery (see cutlass/build.py).
 - A 'tune_cutlass_kernels' function which augments CUTLASS partition
   functions with the results of building and running test kernels (see cutlass/build.py).
 - A 'relay.ext.cutlass' external codegen function which inspects the
   turning results and generates a CSourceModule for each partitions
   (see cutlass/codegen.cc).
 - A 'build_cutlass_kernels_vm' function which runs 'export_library' with
   all the nvcc compiler options needed to build all the CSourceModules
   (see cutlass/bild.py).

For Collage we'd like CUTLASS to have only two entry points: 'partition_for_cutlass',
and 'relay.ext.cutlass' or equivalent. This makes the CUTLASS external codegen integration
composable with other integrations, which in turn helps Collage avoid having to understand any
external codegen APIs other than the global pattern table and the custom compilation function/pass.

Collage also tends to end up requiring multiple partitions for the same backend since it is
more aggressive at mixing-and-matching smaller sub-graphs between backends. Thus we'd also like
to make sure all tuning, generated code and compilation overhead is shared between all such CUTLASS
partitions.

So, in this PR:
 - We add all the CUTLASS-specific tuning and compilation options as new Target
   attributes for the 'external codegen' "cutlass" TargetKind (cutlass/target.cc).
   The user now has one place to provide those settings, and we've already done the
   legwork to plumb the target instance.
 - We replace 'relay.ext.cutlass' with a 'RelayToTIR' custom pass hook
   'CompileForCutlass' (see cutlass/codegen.cc). This pass obviously can see all
   the CUTLASS partitions in the IRModule, so we can now share tuning results
   between them all and can be sure to generate a single CSourceModule. The pass can
   also invoke the compiler to yield a StaticModule, which we've also already done the
   legwork to support. In this way all CUTLASS-specific steps are handled at once.
 - For convenience we supply 'finalize_modules' and 'finalize_modules_vm' which
   invoke nvcc for final linking (using export_library as usual). However, there's now
   nothing CUTLASS specific in those helpers other than their overriding of the 'compiler' to
   be nvcc.
 - test_cutlass.py is updated to use the new API.

 Though this is a breaking change for existing users of the CUTLASS integration the
 change is pretty minor, as shown in test_cutlass.py.

* - Masa's comments

* - Remove unnecessary save.
2022-06-11 11:52:29 +09:00
Masahiro Masuda 53d163c968 [TIR, CUDA] Add pass to replace global to shared memory copy with cp.async (#11658)
* [TIR, CUDA] Add pass to replace global to shared memory copy with cp.async

* add missing doc

* black

* missing src

* clang format

* clang format

* check against nested async scope
2022-06-09 19:05:18 -07:00
Eric Lunderberg d490620085 [Hexagon][CI] Re-enable Hexagon tests in CI (#11613)
* [Hexagon][CI] Re-enable Hexagon tests in CI

These were enabled in https://github.com/apache/tvm/pull/11294, then
erroneously disabled in https://github.com/apache/tvm/pull/11313.
This applies the same fix as in
https://github.com/apache/tvm/pull/11294, checking the
`ANDROID_SERIAL_NUMBER` to determine if Hexagon tests can execute at
runtime, but using the refactored `pytest.skipif` messages introduced
in https://github.com/apache/tvm/pull/11313.

* Fixed circular dependency, but feels somewhat ugly
2022-06-07 17:16:37 -05:00
Eric Lunderberg b885362c36 [CI] Refactor of tvm.testing.requires_* annotations (#11313)
* [CI] Improved skip messages when using @tvm.testing.requires_*

Previously, the same message was given regardless of why a test
couldn't be run.  This has been split up into separate checks for TVM
cmake options in `config.cmake`, enabled targets in `TVM_TEST_TARGETS`
environment variable, and checks for available hardware.

* Refactor to specify repeated feature marks, compile-only markers

* Fixed lint errors

* Import from contrib, not from a different import

* Removed use of requires_llvm() as a list of marks

* Corrected mark from requires_gpu to requires_cuda

* Adding missing "not"

* Added USE_CMSISNN as a requirement for corstone300.
2022-06-03 14:03:08 -07:00
Tristan Konolige f31477f9c3 [FIX] Pad feature vectors to the same size in xgboost cost model (#11479)
* [FIX] Pad feature vectors to the same size in xgboost cost model

* add test

* more test

* explaination

* formatting
2022-06-02 16:47:20 -07:00
Masahiro Masuda 2389f1f0d8 [Software pipeline] Fix hardcoded index in access_ptr rewriting, add a GPU test with depth 4 (#11495)
* fixed hard-coded index in software pipeling

* fixed three-stage pipeline test

* add three stage pipelined gemm test

* refactor mma test

* use mma_4k schedule utility in test

* apply pipeling annotation

* black

* require ampere in test
2022-05-28 09:47:45 +09:00
Tianqi Chen 2e1666d386 [FFI][CYTHON] Release GIL when calling into long running functions (#11461)
Unlike ctypes, Cython by default do not release GIL when
calling into C API functions. This causes problems when the
function is long running. As the particular calling thread will
block other python threads by holding the GIL.

This PR explicitly releases GIL when calling into possible
long running functions. It fixes the timeout issue in
PopenPool which previously relied on another python thread
for timeout.

Added a regression test-case by changing sleep to sleep
in FFI, which previously will indefinitely block the popen tests.
2022-05-27 11:14:50 -07:00
Florin Blanaru 553eb1acd0 [tests] add utility to replace direct call to pytest.main (#11393) 2022-05-23 11:52:22 -07:00
Mehrdad Hessar 5e29dddd02 [microTVM][ARM] Add Relay tests for conv2d registered schedules (#11250)
* Added conv2d relay test for each schedule
* Enable relay tests in qemu
* split aot test utils
2022-05-19 16:09:51 -07:00
Mehrdad Hessar b03f11dfde [Hexagon]Use requires_hexagon instead of requires_hexagon_toolchain if running on hexagon target (#11294)
* refactor requires_hexagon_toolchain

* trigger

* lint
2022-05-17 11:48:04 -05:00
Mehrdad Hessar aa67a6a01c [Hexagon] Add USMP tests (#11279)
* Add USMP tests

* Address Chris comments

* Address Chris comment on assert

* trigger
2022-05-13 15:38:20 -07:00
Eric Lunderberg 83672c65c7 [Analysis] Exposed Analyzer::CanProveEqual to Python API (#11102)
* [Analysis] Exposed Analyzer::CanProveEqual to Python API

Checking for `analyizer.simplify(lhs-rhs) == 0` was a frequent pattern
in Python unit tests, and already had a utility function in the C++
public API.  Exposing this utility function to Python allowed this
pattern to be cleaned up.

* Replaced more cases of .simplify with .can_prove_equal
2022-04-23 07:00:10 +09:00
Andrew Reusch 4178617fcf [AOT] Support LLVM backend with C++ runtime (#10753)
* add get_c_struct_name() method to Metadata to distinguish struct type name in llvm

* add metadata serialization support to llvm codegen

* Organize MetadataQueuer into a separate file.

* Add DiscoverArraysVisitor to metadata_utils

* Fill DLTensor metadata in LegalizePackedCalls.

* Improve error message from Call asserts

* Pass non-String device_context down to codegen.

 * this is necessary to allow CodeGenCPU to emit calls that include resource_handle.

* Scope usage of lvalue refs in LowerTVMBuiltin to avoid corrupt memory.

* test fixes

* Also fill preflattened_buffer_map (TODO, maybe don't do this)

* Fix C codegen.

* Set USMP elem_offset to 0.

* Clarify calculation of byte_offset from elem_offset.

* fix tests

* Fix arm compile warning

* Fix hexagon test.

 * previously I believe we required interface_api == "c", but
   this really means to generate C API bindings, and we are generating
   "packed" bindings.
 * I think "c" was chosen here because the distinction between
   interface-api and use-unpacked-api is confusing. "c" interface-api
   means to generate an entrypoint API for microcontrollers that
   accepts bare data buffers. "packed" interface-api means to generate
   a TVMBackendPackedCFunc entrypoint. use-unpacked-api forms the same
   determination for the operator functions.
 * A further confusion here is that there are two ways to call
   "packed" operator functions: tir.tvm_builtin_call_packed and
   tir.tvm_builtin_call_cpacked. This distinction describes whether or
   not to late-bind calls via TVMBackendGetFuncFromEnv. Right now, AOT
   only ever requires call_cpacked because target_host == target, and
   for all suitable target_host, we expect a single DSO-exportable
   runtime.Module. When we move away from this by introducing
   heterogeneous target support to AOT, we can use this as a condition
   to help us choose between call_cpacked and call_packed (and
   possibly add a compile-time option to assert it is call_cpacked,
   for situations where we really don't want call_packed).

* Document T.preflattened_buffer

* Fix test_aot_legalize_packed_calls

* Address manupa comments

* Fix convert_pool_allocations_to_offsets test.

* lint

* Fix T.preflattened_buffer

* Add preflattened_buffer_map to TIRTextPrinter

* Fix tests

* Fix BYOC

* Fix invoking C device API.

* remove comments

* Address Mousius comments

* lint

* lint

* Fix GMock linking on new CMake

* address masahi comment

Co-authored-by: Masahiro Masuda <masahi129@gmail.com>
2022-04-18 18:44:46 -07:00
Leandro Nunes 89061fafa5 [CI] Bump black version to 22.3.0 (#10960)
* Make all required adjusts in the code to comply with the new version
* Upadte ci-lint to v0.71, based on tlcpackstaging/ci_lint:20220411-060305-45f3d4a52
2022-04-11 10:24:05 -07:00
anilmartha ba8698f0a6 [CI] Fix Vitis-AI tests when USE_VITIS_AI flag set to OFF (#10802)
* Register relay.ext.vitis_ai.available function

* Fix vitis-ai tests when running with USE_VITIS_AI OFF

* Replace skip_test with pytest skipif

* Add a function to see if vitis_ai is available

* Use requires_vitis_ai function for running tests
2022-03-29 19:46:12 +01:00
Christopher Sidebottom 532b2b4a62 Check for toolchain when marking reference system tests (#10659)
This mimics the behaviour of aot_test_utils.py to ensure the tests don't start running when the toolchain isn't available.
2022-03-25 14:12:13 +00:00
driazati c90ae2dfa3 [ci] Fix condition for skipping tests in i386 (#10698)
The Python and base image update for the i386 container changed the results of the various functions in `platform` as found in #10687. This updates them to work correctly with the new container and updates the relevant parts of the codebase to use the new check.

cc @masahi @mosius

Co-authored-by: driazati <driazati@users.noreply.github.com>
2022-03-22 13:43:27 +09:00
Christopher Sidebottom e1af22888f Mark x86 specific test (#10672)
Currently this test crashes pytest on any other architecture, this introduces a decorator which can be used to mark future x86 tests.
2022-03-19 13:26:48 +09:00
David Riazati 5b5d969b0c Add @slow decorator to run tests on main (#10057)
* Add @slow decorator to run tests on `main`

This adds the infrastructure discussed in https://discuss.tvm.apache.org/t/rfc-ci-skip-slow-tests-on-prs/11910, but without affecting any tests. As we investigate reasons behind [slow tests](https://gist.github.com/driazati/e009f09ff44c6bc91c4d95a8e17fd6f1) in CI, this decorator will allow us to move these to run only on `main` and not PRs after checking with all concerned parties.

* cleanup

Co-authored-by: driazati <driazati@users.noreply.github.com>
2022-02-28 10:59:57 -08:00
Eric Lunderberg ffd517ad6e [UnitTest] Disable ptx mma tests on unsupported nvcc versions. (#10229)
* [UnitTest] Disable ptx mma tests on unsupported nvcc versions.

- Modified `tvm.contrib.nvcc.get_cuda_version` to return a
  `(major,minor,release)` tuple rather than a float.

- Implemented `tvm.testing.requries_nvcc_version` decorator to specify
  the minimum `(major,minor,release)` version needed to run a unit
  test.

- Applied decorated to unit tests in `test_tir_ptx_mma.py` that fail
  on earlier nvcc versions.

* Fix lint errors.

* Updated a few of the cuda version checks.

* More lint fixes.

* Only compare major/minor in find_libdevice, not release version.
2022-02-18 22:05:43 +09:00
Masahiro Masuda 44192418dd [TEST] Remove llvm -device=arm_cpu and cuda -libs=cudnn from (#9905)
default list
2022-01-15 07:19:36 +09:00
Yuanjing Shi c945b24c36 [TVMScript] Add for loop syntax sugar (#9620)
* add for loop syntax sugar

* remove prints

* better doc

* finish thread binding

* fix CI

* fix CI

* address comments

* update sstub

* fix CI

* remove failed test

* update stub

* address comments

* add decorator
2021-12-07 19:19:47 -05:00
Leo-arm 3f2ae34782 [ETHOSN] Cleanup of trademarks and registered trademarks (#9516)
Simple cleanup of comments and documentation, mainly for Arm(R) Ethos(TM)-N NPU related code.
2021-11-16 19:59:19 +00:00
Sergei Smirnov 76c78a9d40 [Topi] Cortex-M DSP support (#9233)
Co-authored-by: Sergey Smirnov <Sergey.Smirnov@mir.dev>
Co-authored-by: Ekaterina Bern <Ekaterina.Bern@mir.dev>
Co-authored-by: Mikhail Trubnikov <Mikhail.Trubnikov@mir.dev>
Co-authored-by: German Tretiakov <german.tretiakov@mir.dev>
Co-authored-by: Ilya Gozman <Ilya.Gozman@mir.dev>
Co-authored-by: Alexey.Yazev <Alexey.Yazev@mir.dev>
Co-authored-by: Ilya Gozman <92577591+ilyag-grovety@users.noreply.github.com>
2021-11-15 09:41:18 -08:00
Lunderberg 64b58b1303 [PyTest] Sort by test location, but not parametrization (#9353)
A follow-up from https://github.com/apache/tvm/pull/9188.  The
`item.location` tuple contains `(filename, line_number, test_name)`,
where the `test_name` includes a string representation of all
parameters.  This change preserves pytest's sorting of parametrized
values within a parametrized test, rather than sorting by strings.
2021-10-27 08:14:10 +09:00
Lunderberg 523eb12a1a [Pytest] Sort unit tests before running. (#9188)
* [Pytest] Sort unit tests before running.

By default, pytest will sort tests to maximize the re-use of fixtures.
However, this assumes that all fixtures have an equal cost to
generate, and no caches outside of those managed by pytest.  A fixture
for a `tvm.testing.parameter` is effectively free, while a fixture
maintaining a cache of reference data
`tvm.testing.utils._fixture_cache` be quite large.

Since most of the TVM fixtures are specific to a python function, sort
the test ordering by python function, so that
tvm.testing.utils._fixture_cache can be cleared sooner rather than
later.

* Updated TestTargetAutoParametrization

When sorting the tests, the order of parametrizations may change.
Therefore, the tests checking for automatic target parametrization
shouldn't depend on order.
2021-10-13 21:26:18 -07:00
Lunderberg 7c6d71bd50 [UnitTests][CMSISNN] Mark CMSISNN with skipif they are missing libraries (#9179)
* [UnitTests][CMSISNN] Mark CMSISNN with skipif they are missing libraries

Show test as skipped, rather than failing test.

* Added tvm.testing.requires_cmsisnn
2021-10-05 11:09:32 +09:00
Krzysztof Parzyszek a2bf430a8a [Hexagon] Pytestify Hexagon unit test (#8955)
* [Hexagon] Pytestify Hexagon unit test

* Fix formatting

* Convert linker registration into pytest fixture

* Use yield in pytest fixture

* Restart CI
2021-09-22 19:11:46 -05:00
Yuanjing Shi 1f2fdbf6c2 [AutoTVM] Use popenpool in local_executor (#8851)
* use popenpool in local_executor

* move auto_tvm_common to tvm.testing

* refactor

* nit

* remove LocalFutureNoFork

* exception handling

* handling two exceptions

* handling error

* add initiazlier
2021-09-08 13:08:15 -04:00
Lunderberg 6dea994e43 [UnitTest][Vulkan] Runnable relay unit tests on Vulkan (#8947)
* [UnitTest] Added ids argument to tvm.testing.parameters

This matches the usage in `tvm.testing.parameter`, and allows for
parameter sets to be referred to by a single name.

* [Pytest] Fixed ordering issue of tvm.testing.parametrize_targets and known_failing_targets

If an explicit list of targets is given, then the
`known_failing_targets` decorator would fail to apply.  This commit
resolves the issue, and cleans up all target-specific marks to apply
in `tvm.testing.plugin._add_target_specific_marks`.

* [UnitTest][Vulkan] Runnable relay unit tests on Vulkan

This commit allows the relay test suite to be run targeting Vulkan with
`TVM_TEST_TARGETS="vulkan -from_device=0" pytest tests/python/relay`.  All
tests that require a specific environment are skipped if that environment
isn't present.  All tests that are known to fail when running on Vulkan
are marked as expected failure, and will be tracked in
https://github.com/apache/tvm/issues/8903.

- Failures during code generation
  - Type mismatches, boolean vs int8
    - tests/python/relay/test_any.py::test_any_reduce
    - tests/python/relay/test_op_level3.py::test_sparse_reshape
    - tests/python/relay/test_op_level4.py::test_reduce_functions
    - tests/python/relay/test_vm.py::test_cond
    - tests/python/relay/test_vm.py::test_simple_if

  - Incorrect strategy selection, picks NCHWc implemenation for NHWC layout
    - tests/python/relay/test_op_level2.py::test_conv2d_run

  - Unresolved CallNode operation
    - tests/python/relay/test_op_level1.py::test_unary_op[erf/tan/atan]
    - tests/python/relay/test_op_level3.py::test_scatter_add
    - tests/python/relay/test_op_level3.py::test_segment_sum

  - Generates 64-bit calls to GLSL that have only 16-/32-bit support
    - tests/python/relay/test_op_grad_level1.py::test_log_softmax_grad
    - tests/python/relay/test_op_grad_level1.py::test_softmax_grad
    - tests/python/relay/test_op_grad_level1.py::test_unary_op
    - tests/python/relay/test_op_grad_level10.py::test_cross_entropy_grad

  - Codegen raises error for variable size
    - tests/python/relay/test_any.py::test_any_batch_matmul
    - tests/python/relay/test_any.py::test_any_conv2d_NCHWc
    - tests/python/relay/test_any.py::test_any_dense

- Failures when running
  - Numeric differences (observed on GTX 1650 with NVIDIA driver)
    - tests/python/relay/test_op_level3.py::test_take
    - tests/python/relay/test_op_level5.py::TestCropAndResize
    - tests/python/relay/test_op_level5.py::TestResize1D
    - tests/python/relay/test_op_level5.py::TestResize2D
2021-09-08 07:44:35 +09:00
Lunderberg 3a72d2fe34 [UnitTests][Ethos-N] Mark unit tests as requiring Ethos-N (#8873)
- Adds the decorator `tvm.testing.requires_ethosn`

- Marks all tests in `tests/python/contrib/test_ethosn` as requiring
  ethosn instead of directly checking `ethosn_available()`.  This way,
  they show up as skipped rather than passing.

- Marks test_compile_tflite_module_with_external_codegen as requiring
  ethosn.
2021-09-04 14:15:38 +09:00
Lunderberg aac0754ed6 [UnitTests][Contrib] Enable contrib tensorrt/coreml unit tests (#8902)
* [UnitTests][CoreML] Marked test_annotate as a known failure.

The unit tests in `test_coreml_codegen.py` haven't run in the CI
lately, so this test wasn't caught before.  (See tracking issue

- Added `pytest.mark.xfail` mark to `test_annotate`.

- Added `tvm.testing.requires_package` decorator, which can mark tests
  as requiring a specific python package to be available.  Switched
  from `pytest.importorskip('coremltools')` to
  `requires_package('coremltools')` in `test_coreml_codegen.py` so
  that all tests would explicitly show up as skipped in the report.

- Added `uses_gpu` tag to all tests in `test_coreml_codegen.py`, since
  only ci_gpu has coremltools installed.  In the future, if the ci_cpu
  image has coremltools installed, this mark can be removed.

* [Pytest][TensorRT] Mark the TensorRT tests with tvm.testing.requires_cuda

Previously, the tests had an early bailout if tensorrt was disabled,
or if there was no cuda device present.  However, the tests were not
marked with `pytest.mark.gpu` and so they didn't run during
`task_python_integration_gpuonly.sh`.  This commit adds the
`requires_cuda` mark, and maintains the same behavior of testing the
tensorrt compilation steps if compilation is enabled, and running the
results if tensorrt is enabled.

In addition, some of the tests result in failures when run.  These
have been marked with `pytest.mark.xfail`, and are being tracked in
issue #8901.
2021-09-02 20:10:28 +01:00
Lunderberg 3c86eec10f [UnitTests] Expose TVM pytest helpers as plugin (#8532)
* [UnitTests] Expose TVM pytest helpers as plugin

Previously, pytest helper utilities such as automatic parametrization
of `target`/`dev`, or `tvm.testing.parameter` were only available for
tests within the `${TVM_HOME}/tests` directory.  This PR extracts the
helper utilities into an importable plugin, which can be used in
external tests (e.g. one-off debugging).

* [UnitTests] Refactor the plugin-specific logic out into plugin.py.

* [UnitTests] Moved marker definition out to global variable.
2021-08-27 14:43:49 -07:00
Yuanjing Shi d722c109ee [CONTRIB] Allow customized initializer in PopenPool (#8789) 2021-08-20 10:39:10 -04:00
Lunderberg dbf9ce52d4 [UnitTests] Require cached fixtures to be copy-able, with opt-in. (#8451)
* [UnitTests] Require cached fixtures to be copy-able, with opt-in.

Previously, any class that doesn't raise a TypeError in copy.deepcopy
could be used as a return value in a @tvm.testing.fixture.  This has
the possibility of incorrectly copying classes inherit the default
object.__reduce__ implementation.  Therefore, only classes that
explicitly implement copy functionality (e.g. __deepcopy__ or
__getstate__/__setstate__), or that are explicitly listed in
tvm.testing._fixture_cache are allowed to be cached.

* [UnitTests] Added TestCachedFixtureIsCopy

Verifies that tvm.testing.fixture caching returns copy of object, not
the original object.

* [UnitTests] Correct parametrization of cudnn target.

Previous checks for enabled runtimes were based only on the target
kind.  CuDNN is the same target kind as "cuda", and therefore needs
special handling.

* Change test on uncacheable to check for explicit TypeError
2021-08-17 08:30:27 -07:00
Yuanjing Shi 4dd7f6806f [TIR] Use PopenPool instead of multiprocessing.pool (#8492)
Co-authored-by: Wuwei Lin <wuwei@apache.org>
2021-08-12 13:35:04 -07:00