This is an automated email from the ASF dual-hosted git repository. mbaret pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push: new c4b8934 [ETHOSN] Add support for Ethos-N 21.02 driver stack release. (#7628) c4b8934 is described below commit c4b89348cde17aed155c4831bae60b2ee4188796 Author: tristan-arm <tristan.ocon...@arm.com> AuthorDate: Mon Mar 22 15:16:24 2021 +0000 [ETHOSN] Add support for Ethos-N 21.02 driver stack release. (#7628) - Updated default Ethos-N driver stack to 21.02 - Fixed some test failures associated with this change --- .../install/ubuntu_install_ethosn_driver_stack.sh | 2 +- src/relay/backend/contrib/ethosn/codegen.cc | 30 +++++++++++----------- .../backend/contrib/ethosn/ethosn_api_version.h | 4 +++ tests/python/contrib/test_ethosn/test_networks.py | 16 +++++++++--- 4 files changed, 32 insertions(+), 20 deletions(-) diff --git a/docker/install/ubuntu_install_ethosn_driver_stack.sh b/docker/install/ubuntu_install_ethosn_driver_stack.sh index 15b93bb..e73d1c3 100755 --- a/docker/install/ubuntu_install_ethosn_driver_stack.sh +++ b/docker/install/ubuntu_install_ethosn_driver_stack.sh @@ -22,7 +22,7 @@ set -o pipefail repo_url="https://github.com/Arm-software/ethos-n-driver-stack" repo_dir="ethosn-driver" -repo_revision="20.08" +repo_revision="21.02" install_path="/opt/arm/$repo_dir" tmpdir=$(mktemp -d) diff --git a/src/relay/backend/contrib/ethosn/codegen.cc b/src/relay/backend/contrib/ethosn/codegen.cc index 5e052b3..dab0e6c 100644 --- a/src/relay/backend/contrib/ethosn/codegen.cc +++ b/src/relay/backend/contrib/ethosn/codegen.cc @@ -198,7 +198,7 @@ sl::TensorsAndId MakeOps(const sl::TensorAndId<sl::Operand>& op) { NetworkWithIDs ConstructNetworkVisitor::Construct(const Function& func) { // Initialise everything -#if _ETHOSN_API_VERSION_ == 2011 +#if _ETHOSN_API_VERSION_ >= 2011 auto ctx = transform::PassContext::Current(); auto cfg = ctx->GetConfig<EthosnCompilerConfig>("relay.ext.ethos-n.options"); if (!cfg.defined()) { @@ -206,7 +206,7 @@ NetworkWithIDs ConstructNetworkVisitor::Construct(const Function& func) { } #endif NetworkWithIDs network_with_ids; -#if _ETHOSN_API_VERSION_ == 2011 +#if _ETHOSN_API_VERSION_ >= 2011 network_ = sl::CreateNetwork(variants[cfg.value()->variant]); #else network_ = sl::CreateNetwork(); @@ -572,7 +572,7 @@ sl::CompilationOptions EthosnCompiler::CreateOptions() { cfg = AttrsWithDefaultValues<EthosnCompilerConfig>(); } -#if _ETHOSN_API_VERSION_ == 2011 +#if _ETHOSN_API_VERSION_ >= 2011 sl::CompilationOptions options; #else sl::CompilationOptions options(variants[cfg.value()->variant]); @@ -619,7 +619,7 @@ std::pair<std::vector<uint32_t>, std::vector<uint32_t>> EthosnCompiler::GetInput return std::make_pair(input_order, output_order); } -#if _ETHOSN_API_VERSION_ == 2011 +#if _ETHOSN_API_VERSION_ >= 2011 auto ctx = transform::PassContext::Current(); auto cfg = ctx -> GetConfig<EthosnCompilerConfig>("relay.ext.ethos-n.options").defined() ? ctx -> GetConfig<EthosnCompilerConfig>("relay.ext.ethos-n.options") @@ -632,7 +632,7 @@ TVM_REGISTER_GLOBAL("relay.ethos-n.support.conv2d") Call call = args[0]; ConvolutionParams params; auto err = EthosnAPI::QnnConv2d(call, ¶ms); -#if _ETHOSN_API_VERSION_ == 2011 +#if _ETHOSN_API_VERSION_ >= 2011 if (params.is_depthwise) { *rv = !err && m_Queries.IsDepthwiseConvolutionSupported(params.bias_info, params.weights_info, @@ -657,7 +657,7 @@ TVM_REGISTER_GLOBAL("relay.ethos-n.support.fc") Call call = args[0]; FullyConnectedParams params; auto err = EthosnAPI::QnnFullyConnected(call, ¶ms); -#if _ETHOSN_API_VERSION_ == 2011 +#if _ETHOSN_API_VERSION_ >= 2011 *rv = !err && m_Queries.IsFullyConnectedSupported(params.bias_info, params.weights_info, params.fc_info, params.input_info); #else @@ -671,7 +671,7 @@ TVM_REGISTER_GLOBAL("relay.ethos-n.support.max_pool2d") Call call = args[0]; MaxPool2DParams params; auto err = EthosnAPI::MaxPool2D(call, ¶ms); -#if _ETHOSN_API_VERSION_ == 2011 +#if _ETHOSN_API_VERSION_ >= 2011 *rv = !err && m_Queries.IsPoolingSupported(params.pool_info, params.input_info); #else *rv = !err && sl::IsPoolingSupported(params.pool_info, params.input_info); @@ -683,7 +683,7 @@ TVM_REGISTER_GLOBAL("relay.ethos-n.support.avg_pool2d") Call call = args[0]; AvgPool2DParams params; auto err = EthosnAPI::AvgPool2D(call, ¶ms); -#if _ETHOSN_API_VERSION_ == 2011 +#if _ETHOSN_API_VERSION_ >= 2011 *rv = !err && m_Queries.IsPoolingSupported(params.pool_info, params.input_info); #else *rv = !err && sl::IsPoolingSupported(params.pool_info, params.input_info); @@ -695,7 +695,7 @@ TVM_REGISTER_GLOBAL("relay.ethos-n.support.reshape") Call call = args[0]; ReshapeParams params; auto err = EthosnAPI::Reshape(call, ¶ms); -#if _ETHOSN_API_VERSION_ == 2011 +#if _ETHOSN_API_VERSION_ >= 2011 *rv = !err && m_Queries.IsReshapeSupported(params.new_shape, params.input_info); #else *rv = !err && sl::IsReshapeSupported(params.new_shape, params.input_info); @@ -707,7 +707,7 @@ TVM_REGISTER_GLOBAL("relay.ethos-n.support.addition") Call call = args[0]; AdditionParams params; auto err = EthosnAPI::Addition(call, ¶ms); -#if _ETHOSN_API_VERSION_ == 2011 +#if _ETHOSN_API_VERSION_ >= 2011 *rv = !err && m_Queries.IsAdditionSupported(params.lhs_info, params.rhs_info, params.output_quantization_info); #else @@ -721,7 +721,7 @@ TVM_REGISTER_GLOBAL("relay.ethos-n.support.sigmoid") Call call = args[0]; SigmoidParams params; auto err = EthosnAPI::Sigmoid(call, ¶ms); -#if _ETHOSN_API_VERSION_ == 2011 +#if _ETHOSN_API_VERSION_ >= 2011 *rv = !err && m_Queries.IsSigmoidSupported(params.input_info); #else *rv = !err && sl::IsSigmoidSupported(params.input_info); @@ -733,7 +733,7 @@ TVM_REGISTER_GLOBAL("relay.ethos-n.support.concatenate") Call call = args[0]; ConcatenateParams params; auto err = EthosnAPI::Concatenate(call, ¶ms); -#if _ETHOSN_API_VERSION_ == 2011 +#if _ETHOSN_API_VERSION_ >= 2011 *rv = !err && m_Queries.IsConcatenationSupported(params.input_infos, params.concat_info); #else *rv = !err && sl::IsConcatenationSupported(params.input_infos, params.concat_info); @@ -745,7 +745,7 @@ TVM_REGISTER_GLOBAL("relay.ethos-n.support.split") Call call = args[0]; SplitParams params; auto err = EthosnAPI::Split(call, ¶ms); -#if _ETHOSN_API_VERSION_ == 2011 +#if _ETHOSN_API_VERSION_ >= 2011 *rv = !err && m_Queries.IsSplitSupported(params.input_info, params.split_info); #else *rv = !err && sl::IsSplitSupported(params.input_info, params.split_info); @@ -757,7 +757,7 @@ TVM_REGISTER_GLOBAL("relay.ethos-n.support.depth_to_space") Call call = args[0]; DepthToSpaceParams params; auto err = EthosnAPI::DepthToSpace(call, ¶ms); -#if _ETHOSN_API_VERSION_ == 2011 +#if _ETHOSN_API_VERSION_ >= 2011 *rv = !err && m_Queries.IsDepthToSpaceSupported(params.input_info, params.depth_info); #else *rv = !err && sl::IsDepthToSpaceSupported(params.input_info, params.depth_info); @@ -769,7 +769,7 @@ TVM_REGISTER_GLOBAL("relay.ethos-n.support.relu") Call call = args[0]; ReluParams params; auto err = EthosnAPI::Relu(call, ¶ms); -#if _ETHOSN_API_VERSION_ == 2011 +#if _ETHOSN_API_VERSION_ >= 2011 *rv = !err && m_Queries.IsReluSupported(params.relu_info, params.input_info); #else *rv = !err && sl::IsReluSupported(params.relu_info, params.input_info); diff --git a/src/relay/backend/contrib/ethosn/ethosn_api_version.h b/src/relay/backend/contrib/ethosn/ethosn_api_version.h index 78f0895..c975ee6 100644 --- a/src/relay/backend/contrib/ethosn/ethosn_api_version.h +++ b/src/relay/backend/contrib/ethosn/ethosn_api_version.h @@ -29,6 +29,9 @@ * along with associated compatibility measures when no * longer necessary. */ +#if ETHOSN_SUPPORT_LIBRARY_VERSION_PATCH == 2 +#define _ETHOSN_API_VERSION_ 2102 +#else #ifndef ETHOSN_API_VERSION #define _ETHOSN_API_VERSION_ 2008 #elif ~(~ETHOSN_API_VERSION + 0) == 0 && ~(~ETHOSN_API_VERSION + 1) == 1 @@ -36,5 +39,6 @@ #else #define _ETHOSN_API_VERSION_ ETHOSN_API_VERSION #endif +#endif #endif // TVM_RELAY_BACKEND_CONTRIB_ETHOSN_ETHOSN_API_VERSION_H_ diff --git a/tests/python/contrib/test_ethosn/test_networks.py b/tests/python/contrib/test_ethosn/test_networks.py index 06ce93b..ce89c90 100644 --- a/tests/python/contrib/test_ethosn/test_networks.py +++ b/tests/python/contrib/test_ethosn/test_networks.py @@ -122,7 +122,9 @@ 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. - _compile_hash = {"81637c89339201a07dc96e3b5dbf836a"} + _compile_hash = {"bfb5a50607edb50009c58ae9d4287e4d"} + if tei.get_ethosn_variant() == 3: + _compile_hash = {"896c28b4f06341ea638ead3a593e1aed"} if tei.get_ethosn_api_version() == 2008: _compile_hash = {"47e216d8ab2bf491708ccf5620bc0d02"} if tei.get_ethosn_variant() == 3: @@ -150,7 +152,9 @@ 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. - _compile_hash = {"de0e175af610ebd45ccb03d170dc9664"} + _compile_hash = {"96116d7e6c7385de0688074a3f889983"} + if tei.get_ethosn_variant() == 3: + _compile_hash = {"551cde850c6ef960d19be4f317fb8e68"} if tei.get_ethosn_api_version() == 2008: _compile_hash = {"8c9d75659cd7bc9ff6dd6d490d28f9b2"} if tei.get_ethosn_variant() == 3: @@ -177,7 +181,9 @@ 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. - _compile_hash = {"06bf6cb56344f3904bcb108e54edfe87"} + _compile_hash = {"b34aec2a48c591818761ed6b42c133e5"} + if tei.get_ethosn_variant() == 3: + _compile_hash = {"30f078bd42757e8686eafa1f28d0d352"} if tei.get_ethosn_api_version() == 2008: if not tei.get_ethosn_variant() == 0: pytest.skip( @@ -206,7 +212,9 @@ 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. - _compile_hash = {"29aec6b184b09454b4323271aadf89b1", "6211d96103880b016baa85e638abddef"} + _compile_hash = {"c312edfc9a946ed4dc7c049d472dae6e", "3183f0fa5eba8f6b9557d14eaf47842d"} + if tei.get_ethosn_variant() == 3: + _compile_hash = {"deee52e136327436411fc725624ae2ea", "6526509d3cbee014e38c79e22bb29d7f"} if tei.get_ethosn_api_version() == 2008: _compile_hash = {"5999f26e140dee0d7866491997ef78c5", "24e3a690a7e95780052792d5626c85be"} if tei.get_ethosn_variant() == 3: