Files
apache--tvm/python
Lunderberg 783fe980b6 [UnitTests] Apply correct requires_gpu() pytest marks for parametrized target (#8542)
* [Onnx][UnitTests] Excluded additional onnx tests

- The onnx tests `test_basic_convinteger`, `test_convinteger_with_padding`, `test_range_float_type_positive_delta_expanded`, and `test_range_int32_type_positive_delta_expanded` don't run correctly on CUDA targets, so they are added to the exclusion.

- Parametrized over the relative directory name, rather than the full directory name.  This improves readability of the pytest output, and keeps the same parametrized test name across different python version.

- Changed the target-specific skips to check the target kind, rather than the full target string.

* [UnitTests] Apply correct requires_gpu() pytest marks for parametrized target

Prevoiusly, the addition of tvm.testing._target_to_requirement pytest marks
was handled by the parametrize_targets function.  The
_auto_parametrize_target function assumed that a unit test that was already
parametrized had all markings needed.  If a unit test was explicitly
parametrized using @pytest.mark.parametrize, these marks would be missing.

In most cases, this explicit use of @pytest.mark.parametrize('target', ...)
should be avoided, but has value in the case of marking with multiple
parameters with @pytest.mark.parametrize('target,other', ...).  This use
case isn't yet supported by the tvm.testing.parameters function.  Therefore,
if this occurs, detect it and add the appropriate marks.

* [UnitTest] Bugfix, applying requires_* markers to parametrized targets.

Initial implementation did work correctly with
@tvm.testing.parametrize_targets.

Also, went through all cases where "target" is used to parametrize on
something other than a target string, and renamed.

* [Onnx] Switched from using pytest.skip to tvm.testing.known_failing_targets

After merging of the `tvm.testing.parametrize_targets` and
`tvm.testing._auto_parametrize_target` code paths,
`known_failing_targets` can be used in both cases.

* [Testing] Enable `Target` object as argument to _target_to_requirement

Previously, tvm.testing._target_to_requirement required the argument
to be a string.  This commit allows it to be either a string or a
`tvm.target.Target`.

* [Testing] Auto-target parametrization, handle pytest ParameterSet

If the unit test has already been parametrized with pytest.params to
add parameter-specific marks, respect those existing marks.

This can happen in some cases in the CI, uncertain yet what is causing
them.  Maybe pytest-xdist related, but there's some difficulty in
reproducing it locally.

Co-authored-by: Eric Lunderberg <elunderberg@octoml.ai>
2021-08-06 17:23:49 +09:00
..
2021-07-15 23:08:10 -07:00