ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Module.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef __NEST_MODULE_H__
18#define __NEST_MODULE_H__
19
20#include "nest/VarContext.h"
21#include "nest/DomainContext.h"
22#include "nest/Ret.h"
23#include "nest/Block.h"
24
25namespace nest
26{
27
28class Module
29{
30public:
31 Module() = default;
32
33private:
34 VarContext _var_ctx;
35
36public:
37 VarContext &var(void) { return _var_ctx; }
38 const VarContext &var(void) const { return _var_ctx; }
39
40private:
41 DomainContext _domain_ctx;
42
43public:
44 DomainContext &domain(void) { return _domain_ctx; }
45 const DomainContext &domain(void) const { return _domain_ctx; }
46
47private:
48 Block _block;
49
50public:
51 const Block &block(void) const { return _block; }
52
53public:
54 void push(const Expr &expr);
55
56private:
57 std::shared_ptr<Ret> _ret;
58
59public:
60 // NOTE Do NOT invoke ret() before ret(expr) call
61 const Ret &ret(void) const;
62
63public:
64 // NOTE Only one ret(expr) call is allowed for each module
65 void ret(const Closure &closure);
66};
67
68} // namespace nest
69
70#endif // __NEST_MODULE_H__
DomainContext & domain(void)
Definition Module.h:44
void push(const Expr &expr)
Definition Module.cpp:24
const Ret & ret(void) const
Definition Module.cpp:37
Module()=default
const Block & block(void) const
Definition Module.h:51
VarContext & var(void)
Definition Module.h:37
const VarContext & var(void) const
Definition Module.h:38
const DomainContext & domain(void) const
Definition Module.h:45
Definition Block.h:27
std::shared_ptr< nest::expr::Node > Expr
Definition Expr.h:37