Skip to content

Commit

Permalink
[ETHOSN] Remove support for 22.05 version of the driver stack (#12770)
Browse files Browse the repository at this point in the history
After the upgrade of the driver stack to 22.08 (3.1.0), this commit removes support for the 22.05 (3.0.1) version.
  • Loading branch information
lhutton1 authored Sep 28, 2022
1 parent 178f82d commit d1c9feb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 49 deletions.
2 changes: 1 addition & 1 deletion python/tvm/relay/op/contrib/ethosn.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def partition_for_ethosn(mod, params=None, **opts):
raise ValueError("When targeting Ethos(TM)-N78, -variant=n78 should be set.")

api_version = ethosn_api_version()
supported_api_versions = ["3.0.1", "3.1.0"]
supported_api_versions = ["3.1.0"]
if all(api_version != LooseVersion(exp_ver) for exp_ver in supported_api_versions):
raise ValueError(
f"Driver stack version {api_version} is unsupported. "
Expand Down
28 changes: 5 additions & 23 deletions tests/python/contrib/test_ethosn/test_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,11 @@
pytest.importorskip("tflite")
pytest.importorskip("tensorflow")

from distutils.version import LooseVersion

import tflite.Model

from tvm import relay
from tvm.testing import requires_ethosn
from tvm.contrib import download
from tvm.relay.op.contrib.ethosn import ethosn_api_version
import tvm.relay.testing.tf as tf_testing

from . import infrastructure as tei
Expand Down Expand Up @@ -125,10 +122,7 @@ def test_mobilenet_v1():
# codegen, which could come about from either a change in Support Library
# version or a change in the Ethos-N codegen. To update this requires running
# on hardware that isn't available in CI.
if ethosn_api_version() == LooseVersion("3.1.0"):
_compile_hash = {"c37fec1f214c7f93ce49ee4e3b587969"}
else:
_compile_hash = {"50186822915909303e813205db80e032"}
_compile_hash = {"c37fec1f214c7f93ce49ee4e3b587969"}
_test_image_network(
model_url="https://storage.googleapis.com/download.tensorflow.org/"
"models/mobilenet_v1_2018_08_02/mobilenet_v1_1.0_224_quant.tgz",
Expand All @@ -150,10 +144,7 @@ def test_resnet_50_int8():
# codegen, which could come about from either a change in Support Library
# version or a change in the Ethos-N codegen. To update this requires running
# on hardware that isn't available in CI.
if ethosn_api_version() == LooseVersion("3.1.0"):
_compile_hash = {"12d65aec33594c88b6d0d31dcd5144e6", "6a64d69ccb36dfb6b30dd2abdba4b005"}
else:
_compile_hash = {"9245965b2c01e7f3d9b478e38a186eb4", "4225fa951c145bb1e48e28cad6a3bdd4"}
_compile_hash = {"12d65aec33594c88b6d0d31dcd5144e6", "6a64d69ccb36dfb6b30dd2abdba4b005"}
_test_image_network(
model_url="https://raw.githubusercontent.com/dmlc/web-data/main/tensorflow/"
"models/Quantized/resnet_50_quantized.tflite",
Expand All @@ -174,10 +165,7 @@ def test_inception_v3():
# codegen, which could come about from either a change in Support Library
# version or a change in the Ethos-N codegen. To update this requires running
# on hardware that isn't available in CI.
if ethosn_api_version() == LooseVersion("3.1.0"):
_compile_hash = {"cff892eb15944756f22dad4b83c756d2"}
else:
_compile_hash = {"a5a2b5d2b618de754bf9a01033a020c0"}
_compile_hash = {"cff892eb15944756f22dad4b83c756d2"}
_test_image_network(
model_url="https://storage.googleapis.com/download.tensorflow.org/"
"models/tflite_11_05_08/inception_v3_quant.tgz",
Expand All @@ -198,10 +186,7 @@ def test_inception_v4():
# codegen, which could come about from either a change in Support Library
# version or a change in the Ethos-N codegen. To update this requires running
# on hardware that isn't available in CI.
if ethosn_api_version() == LooseVersion("3.1.0"):
_compile_hash = {"2eeae331898f8e94c74868e190077837"}
else:
_compile_hash = {"61b4ade41898d7cb2451dbdc3340aced"}
_compile_hash = {"2eeae331898f8e94c74868e190077837"}
_test_image_network(
model_url="https://storage.googleapis.com/download.tensorflow.org/"
"models/inception_v4_299_quant_20181026.tgz",
Expand All @@ -222,10 +207,7 @@ def test_ssd_mobilenet_v1():
# codegen, which could come about from either a change in Support Library
# version or a change in the Ethos-N codegen. To update this requires running
# on hardware that isn't available in CI.
if ethosn_api_version() == LooseVersion("3.1.0"):
_compile_hash = {"ec2b78852192058f88b64d45c26620d5", "f68cbeaaba03874ea735ce3f5eab9227"}
else:
_compile_hash = {"789906c7d8ac787809b303d82781fc9d", "6b699f94795785d31b39940a5cf84a81"}
_compile_hash = {"ec2b78852192058f88b64d45c26620d5", "f68cbeaaba03874ea735ce3f5eab9227"}
_test_image_network(
model_url="https://storage.googleapis.com/download.tensorflow.org/"
"models/tflite/coco_ssd_mobilenet_v1_1.0_quant_2018_06_29.zip",
Expand Down
13 changes: 0 additions & 13 deletions tests/python/contrib/test_ethosn/test_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@

"""Split tests for Arm(R) Ethos(TM)-N"""

from distutils.version import LooseVersion

import numpy as np
import pytest

import tvm
from tvm import relay
from tvm.testing import requires_ethosn
from tvm.relay.op.contrib.ethosn import ethosn_api_version

from . import infrastructure as tei

Expand All @@ -47,11 +44,6 @@ def _get_model(shape, dtype, splits, axis):
)
def test_split(dtype, shape, splits, axis):
"""Compare Split output with TVM."""
if ethosn_api_version() == LooseVersion("3.0.1"):
pytest.skip(
"Split is not supported by the 3.0.1 version of the driver stack.",
)

np.random.seed(0)

outputs = []
Expand Down Expand Up @@ -89,11 +81,6 @@ def test_split(dtype, shape, splits, axis):
)
def test_split_failure(shape, dtype, splits, axis, err_msg):
"""Check Split error messages."""
if ethosn_api_version() == LooseVersion("3.0.1"):
pytest.skip(
"Split is not supported by the 3.0.1 version of the driver stack.",
)

model = _get_model(shape, dtype, splits, axis)
mod = tei.make_ethosn_partition(model)
tei.test_error(mod, {}, err_msg)
17 changes: 5 additions & 12 deletions tests/python/contrib/test_ethosn/test_topologies.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@

"""Arm(R) Ethos(TM)-N tests for complex network topologies."""

from distutils.version import LooseVersion

import numpy as np
import pytest

import tvm
from tvm import relay
from tvm.testing import requires_ethosn
from tvm.relay.op.contrib.ethosn import Available, ethosn_available, ethosn_api_version
from tvm.relay.op.contrib.ethosn import Available, ethosn_available

from . import infrastructure as tei

Expand Down Expand Up @@ -80,8 +78,8 @@ def get_model(input_shape, dtype, var_names):
model = get_model(inputs["a"].shape, dtype, iter(inputs))
mod = tei.make_module(model, [])

expected_host_ops = 1 if ethosn_api_version() == LooseVersion("3.0.1") else 0
npu_partitions = 2 if ethosn_api_version() == LooseVersion("3.0.1") else 1
expected_host_ops = 0
npu_partitions = 1

# Mock inference is only supported when the whole graph is offloaded to the NPU
if ethosn_available() == Available.SW_ONLY:
Expand Down Expand Up @@ -282,8 +280,8 @@ def get_model(shape, dtype, splits, axis):
model = get_model(shape, dtype, splits, axis)
mod = tei.make_module(model, {})

expected_host_ops = 1 if ethosn_api_version() == LooseVersion("3.0.1") else 0
npu_partitions = 2 if ethosn_api_version() == LooseVersion("3.0.1") else 1
expected_host_ops = 0
npu_partitions = 1

# Mock inference is only supported when the whole graph is offloaded to the NPU
if ethosn_available() == Available.SW_ONLY:
Expand Down Expand Up @@ -317,11 +315,6 @@ def test_output_tuple_propagation(dtype):
"""This tests the case where the output tuple must be inferred
as having dummy tensor information."""

if ethosn_api_version() == LooseVersion("3.0.1"):
pytest.skip(
"Split is not supported by the 3.0.1 version of the driver stack.",
)

def get_model(dtype):
a = relay.var("a", shape=(1, 4, 4, 16), dtype=dtype)
split = relay.op.split(a, indices_or_sections=4, axis=2)
Expand Down

0 comments on commit d1c9feb

Please sign in to comment.