From f6892ee6e32e95f4cb8e32f921af9d60757138d2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=98=A4=ED=98=95=EC=84=9D/On-Device=20Lab=28SR=29/Staff?= =?utf8?q?=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Thu, 18 Jul 2019 16:30:48 +0900 Subject: [PATCH] Introduce IODescription struct (#5678) Introduce IODescription, InputDesc, and OutputDesc struct to gather input and output buffer information in execution instance Introduce IODescription field in Execution class Signed-off-by: Hyeongseok Oh --- runtimes/neurun/core/include/exec/Execution.h | 7 ++- runtimes/neurun/core/include/exec/IODescription.h | 64 +++++++++++++++++++++++ runtimes/neurun/core/src/exec/Execution.cc | 31 +++++++++++ 3 files changed, 98 insertions(+), 4 deletions(-) create mode 100644 runtimes/neurun/core/include/exec/IODescription.h create mode 100644 runtimes/neurun/core/src/exec/Execution.cc diff --git a/runtimes/neurun/core/include/exec/Execution.h b/runtimes/neurun/core/include/exec/Execution.h index 3a2fc86..e5fdf86 100644 --- a/runtimes/neurun/core/include/exec/Execution.h +++ b/runtimes/neurun/core/include/exec/Execution.h @@ -22,6 +22,7 @@ #define __NEURUN_EXEC_EXECUTION_H__ #include "exec/IExecutor.h" +#include "IODescription.h" namespace neurun { @@ -40,10 +41,7 @@ public: * @brief Construct a new Execution object * @param[in] executor Model executor */ - Execution(const std::shared_ptr &executor) : _executor{executor} - { - // DO NOTHING - } + Execution(const std::shared_ptr &executor); public: /** @@ -107,6 +105,7 @@ public: private: const std::shared_ptr _executor; + IODescription _io_desc; }; } // namespace exec diff --git a/runtimes/neurun/core/include/exec/IODescription.h b/runtimes/neurun/core/include/exec/IODescription.h new file mode 100644 index 0000000..4809f34 --- /dev/null +++ b/runtimes/neurun/core/include/exec/IODescription.h @@ -0,0 +1,64 @@ +/* + * 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_EXEC_IO_DESCRIPTION_H__ +#define __NEURUN_EXEC_IO_DESCRIPTION_H__ + +#include + +#include "model/OperandInfo.h" + +namespace neurun +{ +namespace exec +{ + +struct InputDesc +{ + const model::OperandInfo info; + const void *buffer; + const size_t size; + + InputDesc(void) = delete; + InputDesc(const model::OperandInfo &info, const void *buffer, const size_t size) + : info(info), buffer(buffer), size(size) + { + } +}; + +struct OutputDesc +{ + const model::OperandInfo info; + void *buffer; + const size_t size; + + OutputDesc(void) = delete; + OutputDesc(const model::OperandInfo &info, void *buffer, const size_t size) + : info(info), buffer(buffer), size(size) + { + } +}; + +struct IODescription +{ + std::vector> inputs; + std::vector> outputs; +}; + +} // namespace exec +} // namespace neurun + +#endif // __NEURUN_EXEC_IO_DESCRIPTION_H__ diff --git a/runtimes/neurun/core/src/exec/Execution.cc b/runtimes/neurun/core/src/exec/Execution.cc new file mode 100644 index 0000000..d096878 --- /dev/null +++ b/runtimes/neurun/core/src/exec/Execution.cc @@ -0,0 +1,31 @@ +/* + * 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 "exec/Execution.h" + +namespace neurun +{ +namespace exec +{ + +Execution::Execution(const std::shared_ptr &executor) : _executor{executor}, _io_desc{} +{ + _io_desc.inputs.resize(_executor->model().inputs.size()); + _io_desc.outputs.resize(_executor->model().outputs.size()); +} + +} // namespace exec +} // namespace neurun -- 2.7.4