From: 오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 Date: Thu, 18 Jul 2019 07:30:48 +0000 (+0900) Subject: Introduce IODescription struct (#5678) X-Git-Tag: submit/tizen/20190809.050447~513 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f6892ee6e32e95f4cb8e32f921af9d60757138d2;p=platform%2Fcore%2Fml%2Fnnfw.git 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 --- 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