From 0e1734317fe7390fd05d18a84ba7843e287b1efe 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: Fri, 22 Nov 2019 09:59:37 +0900 Subject: [PATCH] Introduce AclTensorRegister registering tensor info of acl (#9106) This commit introduces Introduce AclTensorRegister registering tensor info of acl. Signed-off-by: jiseob.jang --- runtime/neurun/backend/acl_cl/TensorRegister.h | 35 ++++++++++++++++ .../neurun/backend/acl_common/AclTensorRegister.cc | 35 ++++++++++++++++ .../neurun/backend/acl_common/AclTensorRegister.h | 49 ++++++++++++++++++++++ runtime/neurun/backend/acl_neon/TensorRegister.h | 35 ++++++++++++++++ 4 files changed, 154 insertions(+) create mode 100644 runtime/neurun/backend/acl_cl/TensorRegister.h create mode 100644 runtime/neurun/backend/acl_common/AclTensorRegister.cc create mode 100644 runtime/neurun/backend/acl_common/AclTensorRegister.h create mode 100644 runtime/neurun/backend/acl_neon/TensorRegister.h diff --git a/runtime/neurun/backend/acl_cl/TensorRegister.h b/runtime/neurun/backend/acl_cl/TensorRegister.h new file mode 100644 index 0000000..b78c9b5 --- /dev/null +++ b/runtime/neurun/backend/acl_cl/TensorRegister.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved + * + * Licensed 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. + */ + +#ifndef __NEURUN_BACKEND_ACL_CL_TENSOR_REGISTER_H__ +#define __NEURUN_BACKEND_ACL_CL_TENSOR_REGISTER_H__ + +#include + +namespace neurun +{ +namespace backend +{ +namespace acl_cl +{ + +using TensorRegister = acl_common::AclTensorRegister; + +} // namespace acl_cl +} // namespace backend +} // namespace neurun + +#endif // __NEURUN_BACKEND_ACL_CL_TENSOR_REGISTER_H__ diff --git a/runtime/neurun/backend/acl_common/AclTensorRegister.cc b/runtime/neurun/backend/acl_common/AclTensorRegister.cc new file mode 100644 index 0000000..14691a6 --- /dev/null +++ b/runtime/neurun/backend/acl_common/AclTensorRegister.cc @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved + * + * Licensed 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. + */ + +#include "AclTensorRegister.h" + +namespace neurun +{ +namespace backend +{ +namespace acl_common +{ + +AclTensorRegister::AclTensorRegister(const model::Operands &operands, + const std::shared_ptr &tensor_builder) + : _operands{operands}, _tensor_builder{tensor_builder} +{ + assert(tensor_builder != nullptr); +} + +} // namespace acl_common +} // namespace backend +} // namespace neurun diff --git a/runtime/neurun/backend/acl_common/AclTensorRegister.h b/runtime/neurun/backend/acl_common/AclTensorRegister.h new file mode 100644 index 0000000..ff21507 --- /dev/null +++ b/runtime/neurun/backend/acl_common/AclTensorRegister.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved + * + * Licensed 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. + */ + +#ifndef __NEURUN_BACKEND_ACL_COMMON_TENSOR_REGISTER_H__ +#define __NEURUN_BACKEND_ACL_COMMON_TENSOR_REGISTER_H__ + +#include + +namespace neurun +{ +namespace backend +{ +namespace acl_common +{ + +class AclTensorRegister : public ITensorRegister +{ +public: + AclTensorRegister(const model::Operands &operands, + const std::shared_ptr &tensor_builder); + +private: + const model::Operands &operands() const override { return _operands; } + std::shared_ptr tensor_builder() const override { return _tensor_builder; } + bool supportSubTensor() const final { return true; } + +private: + const model::Operands &_operands; + const std::shared_ptr _tensor_builder; +}; + +} // namespace acl_common +} // namespace backend +} // namespace neurun + +#endif // __NEURUN_BACKEND_ACL_COMMON_TENSOR_REGISTER_H__ diff --git a/runtime/neurun/backend/acl_neon/TensorRegister.h b/runtime/neurun/backend/acl_neon/TensorRegister.h new file mode 100644 index 0000000..388cb91 --- /dev/null +++ b/runtime/neurun/backend/acl_neon/TensorRegister.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved + * + * Licensed 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. + */ + +#ifndef __NEURUN_BACKEND_ACL_NEON_TENSOR_REGISTER_H__ +#define __NEURUN_BACKEND_ACL_NEON_TENSOR_REGISTER_H__ + +#include + +namespace neurun +{ +namespace backend +{ +namespace acl_neon +{ + +using TensorRegister = acl_common::AclTensorRegister; + +} // namespace acl_neon +} // namespace backend +} // namespace neurun + +#endif // __NEURUN_BACKEND_ACL_NEON_TENSOR_REGISTER_H__ -- 2.7.4