Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Hexagon][CI] Re-enable Hexagon tests in CI #11613

Merged
merged 2 commits into from
Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions python/tvm/contrib/hexagon/_ci_env_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

"""Hexagon environment checks for CI usage

These may be required by either tvm.testing or
tvm.contrib.hexagon.pytest_plugin, and are separated here to avoid a
circular dependency.
"""

import os

import tvm

ANDROID_SERIAL_NUMBER = "ANDROID_SERIAL_NUMBER"
HEXAGON_TOOLCHAIN = "HEXAGON_TOOLCHAIN"


def _compile_time_check():
"""Return True if compile-time support for Hexagon is present, otherwise
error string.

Designed for use as a the ``compile_time_check`` argument to
`tvm.testing.Feature`.
"""
if (
tvm.testing.utils._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
10 changes: 1 addition & 9 deletions python/tvm/contrib/hexagon/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,7 @@ 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}.",
),
]

return _compose(args, _requires_hexagon_toolchain)
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
import tvm.contrib.hexagon._ci_env_check 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