From 9d2d6934d8d9b88fcb31f0f4f016a1e4244ef1a3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=9E=A5=EC=A7=80=EC=84=AD/On-Device=20Lab=28SR=29/Enginee?= =?utf8?q?r/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Mon, 23 Sep 2019 13:54:25 +0900 Subject: [PATCH] Introduce `SupportPermutation` to check if backend supports permutation (#7616) This commit introduces `SupportPermutation` to check if backend supports permutation. Signed-off-by: jiseob.jang --- runtimes/neurun/backend/acl_cl/Config.h | 1 + runtimes/neurun/backend/acl_neon/Config.h | 1 + runtimes/neurun/backend/cpu/Config.h | 1 + runtimes/neurun/backend/srcn/Config.h | 1 + runtimes/neurun/core/include/backend/IConfig.h | 2 ++ runtimes/neurun/test/core/backend/ExecTime.test.cc | 1 + runtimes/neurun/test/core/compiler/Scheduler.cc | 3 +++ 7 files changed, 10 insertions(+) diff --git a/runtimes/neurun/backend/acl_cl/Config.h b/runtimes/neurun/backend/acl_cl/Config.h index 1857651..ae527dd 100644 --- a/runtimes/neurun/backend/acl_cl/Config.h +++ b/runtimes/neurun/backend/acl_cl/Config.h @@ -33,6 +33,7 @@ class Config : public IConfig public: std::string id() override { return "acl_cl"; } void initialize() override; + bool SupportPermutation() override { return true; } bool SupportSubTensorAlloc() override { return true; } std::unique_ptr timer() override { return nnfw::cpp14::make_unique(); } }; diff --git a/runtimes/neurun/backend/acl_neon/Config.h b/runtimes/neurun/backend/acl_neon/Config.h index 0656fa4..13f6c83 100644 --- a/runtimes/neurun/backend/acl_neon/Config.h +++ b/runtimes/neurun/backend/acl_neon/Config.h @@ -33,6 +33,7 @@ class Config : public IConfig public: std::string id() override { return "acl_neon"; } void initialize() override; + bool SupportPermutation() override { return true; } bool SupportSubTensorAlloc() override { return true; } std::unique_ptr timer() override diff --git a/runtimes/neurun/backend/cpu/Config.h b/runtimes/neurun/backend/cpu/Config.h index ac55d98..262d477 100644 --- a/runtimes/neurun/backend/cpu/Config.h +++ b/runtimes/neurun/backend/cpu/Config.h @@ -33,6 +33,7 @@ class Config : public IConfig public: std::string id() override { return "cpu"; } void initialize() override; + bool SupportPermutation() override { return true; } bool SupportSubTensorAlloc() override { // NOTE CPU allocator cannot support subtensor allocation yet diff --git a/runtimes/neurun/backend/srcn/Config.h b/runtimes/neurun/backend/srcn/Config.h index bffcbf2..fbe2f09 100644 --- a/runtimes/neurun/backend/srcn/Config.h +++ b/runtimes/neurun/backend/srcn/Config.h @@ -31,6 +31,7 @@ class Config : public IConfig public: std::string id() override { return "srcn"; } void initialize() override; + bool SupportPermutation() override { return false; } bool SupportSubTensorAlloc() override { // NOTE srcn allocator cannot support subtensor allocation yet diff --git a/runtimes/neurun/core/include/backend/IConfig.h b/runtimes/neurun/core/include/backend/IConfig.h index 0e95720..e6c2235 100644 --- a/runtimes/neurun/core/include/backend/IConfig.h +++ b/runtimes/neurun/core/include/backend/IConfig.h @@ -32,6 +32,8 @@ struct IConfig virtual std::string id() = 0; virtual void initialize() = 0; + // Support permute kernel + virtual bool SupportPermutation() = 0; // Support subtensor allocation virtual bool SupportSubTensorAlloc() = 0; diff --git a/runtimes/neurun/test/core/backend/ExecTime.test.cc b/runtimes/neurun/test/core/backend/ExecTime.test.cc index 15185fa..b0065d3 100644 --- a/runtimes/neurun/test/core/backend/ExecTime.test.cc +++ b/runtimes/neurun/test/core/backend/ExecTime.test.cc @@ -29,6 +29,7 @@ struct MockConfig : public IConfig { std::string id() override { return "b1"; } void initialize() override{}; + bool SupportPermutation() override { return false; } bool SupportSubTensorAlloc() override { return false; } }; diff --git a/runtimes/neurun/test/core/compiler/Scheduler.cc b/runtimes/neurun/test/core/compiler/Scheduler.cc index 57aed27..cf82261 100644 --- a/runtimes/neurun/test/core/compiler/Scheduler.cc +++ b/runtimes/neurun/test/core/compiler/Scheduler.cc @@ -57,6 +57,7 @@ struct MockConfigCPU : public IConfig { std::string id() override { return "cpu"; } void initialize() override{}; + bool SupportPermutation() override { return false; } bool SupportSubTensorAlloc() override { return false; } }; @@ -75,6 +76,7 @@ struct MockConfigGPU : public IConfig { std::string id() override { return "gpu"; } void initialize() override{}; + bool SupportPermutation() override { return false; } bool SupportSubTensorAlloc() override { return false; } }; @@ -93,6 +95,7 @@ struct MockConfigNPU : public IConfig { std::string id() override { return "npu"; } void initialize() override{}; + bool SupportPermutation() override { return false; } bool SupportSubTensorAlloc() override { return false; } }; -- 2.7.4