Skip to content

Commit

Permalink
[Hexagon][CI] Re-enable Hexagon tests in CI
Browse files Browse the repository at this point in the history
These were enabled in apache#11294, then
erroneously disabled in apache#11313.
This applies the same fix as in
apache#11294, checking the
`ANDROID_SERIAL_NUMBER` to determine if Hexagon tests can execute at
runtime, but using the refactored `pytest.skipif` messages introduced
in apache#11313.
  • Loading branch information
Lunderberg committed Jun 7, 2022
1 parent 609d6af commit baeee37
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 13 deletions.
38 changes: 30 additions & 8 deletions python/tvm/contrib/hexagon/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import pytest

import tvm
import tvm.testing
import tvm.rpc.tracker
from tvm.contrib.hexagon.build import HexagonLauncher, HexagonLauncherRPC
from tvm.contrib.hexagon.session import Session
Expand Down Expand Up @@ -53,15 +54,36 @@ def _compose(args, decs):
return decs


def requires_hexagon_toolchain(*args):
_requires_hexagon_toolchain = [
pytest.mark.skipif(
os.environ.get(HEXAGON_TOOLCHAIN) is None,
reason=f"Missing environment variable {HEXAGON_TOOLCHAIN}.",
),
]
def _compile_time_check():
"""Return True if compile-time support for Hexagon is present, otherwise
error string.
return _compose(args, _requires_hexagon_toolchain)
Designed for use as a the ``compile_time_check`` argument to
`tvm.testing.Feature`.
"""
if _cmake_flag_enabled("USE_LLVM") and tvm.target.codegen.llvm_version_major() < 7:
return "Hexagon requires LLVM 7 or later"

if "HEXAGON_TOOLCHAIN" not in os.environ:
return f"Missing environment variable {HEXAGON_TOOLCHAIN}."

return True


def _run_time_check():
"""Return True if run-time support for Hexagon is present, otherwise
error string.
Designed for use as a the ``run_time_check`` argument to
`tvm.testing.Feature`.
"""
if ANDROID_SERIAL_NUMBER not in os.environ:
return f"Missing environment variable {ANDROID_SERIAL_NUMBER}."

return True


requires_hexagon_toolchain = tvm.testing.requires_hexagon(support_required="compile-only")


@tvm.testing.fixture
Expand Down
8 changes: 3 additions & 5 deletions python/tvm/testing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def test_something():
import tvm._ffi

from tvm.contrib import nvcc, cudnn
from tvm.contrib.hexagon import pytest_plugin as hexagon
from tvm.error import TVMError


Expand Down Expand Up @@ -937,11 +938,8 @@ def _any_gpu_exists():
"Hexagon",
cmake_flag="USE_HEXAGON",
target_kind_enabled="hexagon",
compile_time_check=lambda: (
(_cmake_flag_enabled("USE_LLVM") and tvm.target.codegen.llvm_version_major() >= 7)
or "Hexagon requires LLVM 7 or later"
),
target_kind_hardware="hexagon",
compile_time_check=hexagon._compile_time_check,
run_time_check=hexagon._run_time_check,
parent_features="llvm",
)

Expand Down

0 comments on commit baeee37

Please sign in to comment.