From 8784c9339b043cfb28d0481b9d60cbd0959aa80a Mon Sep 17 00:00:00 2001 From: Tristan O'Connor Date: Thu, 12 Nov 2020 19:09:43 +0000 Subject: [PATCH] [ETHOSN] Add support for default Ethos-N78 configuration. Note: 'ETHOSN_VARIANT_CONFIG' must be set to test against Ethos-N78 and this adds support for one configuration of Ethos-N78 in TVM. --- .../backend/contrib/ethosn/capabilities.h | 24 ++++++++++++++----- .../backend/contrib/ethosn/codegen_ethosn.h | 4 +++- .../contrib/test_ethosn/infrastructure.py | 9 ++++++- .../contrib/test_ethosn/test_networks.py | 8 +++++++ tests/scripts/task_python_ethosn_tests.sh | 4 ++++ tests/scripts/task_python_integration.sh | 3 +++ 6 files changed, 44 insertions(+), 8 deletions(-) diff --git a/src/relay/backend/contrib/ethosn/capabilities.h b/src/relay/backend/contrib/ethosn/capabilities.h index 77b2d911d38f..8c7ee6a0d009 100644 --- a/src/relay/backend/contrib/ethosn/capabilities.h +++ b/src/relay/backend/contrib/ethosn/capabilities.h @@ -20,7 +20,8 @@ /*! * \file src/relay/backend/contrib/ethosn/capabilities.h * \brief The Ethos-N processor series has four variants, the Ethos-N37, Ethos-N57, Ethos-N77 - * and the Ethos-N78. This release of the integration supports the first three variants. + * and the Ethos-N78. This release of the integration supports the first three variants and + * the default configuration of the fourth variant. * Configuration information for each variant is stored as a blob in this file. These blobs * are passed into the Ethos-N support library, which in turn uses them to optimize the * generated command-stream appropriately for the specified variant. @@ -38,13 +39,14 @@ namespace relay { namespace contrib { namespace ethosn { -/* Ethos-N variants (N77, N57 and N37) - * variant[0] - N77 - * variant[1] - N57 - * variant[2] - N37 +/* Ethos-N variants (Ethos-N77, Ethos-N57, Ethos-N37 and Ethos-N78) + * variant[0] - Ethos-N77 + * variant[1] - Ethos-N57 + * variant[2] - Ethos-N37 + * variant[3] - Ethos-N78 */ #if _ETHOSN_API_VERSION_ == 2008 -static std::vector variants[3] = { +static std::vector variants[4] = { { 0x03, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, @@ -74,6 +76,16 @@ static std::vector variants[3] = { 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }, + { + 0x03, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, }}; #else static std::vector variants[3] = { diff --git a/src/relay/backend/contrib/ethosn/codegen_ethosn.h b/src/relay/backend/contrib/ethosn/codegen_ethosn.h index 4b3e1bc05367..9887a2b3ad78 100644 --- a/src/relay/backend/contrib/ethosn/codegen_ethosn.h +++ b/src/relay/backend/contrib/ethosn/codegen_ethosn.h @@ -251,7 +251,9 @@ struct EthosnCompilerConfigNode : public tvm::AttrsNode