namespace neurun
{
-namespace linear
+namespace compiler
{
class Linear;
} // namespace linear
void finishBuilding(void);
void lower(void);
void removeOperand(const model::OperandIndex &ind) { _model->operands.remove(ind); }
- std::unique_ptr<linear::Linear> linearize(void);
+ std::unique_ptr<compiler::Linear> linearize(void);
bool isBuildingPhase(void) const { return _phase == Phase::BUILDING; }
std::shared_ptr<const model::Model> shareModel() { return _model; }
std::unique_ptr<graph::LowerInfoMap> releaseLowerInfo() { return std::move(_lower_info_map); }
#include "backend/ExecTime.h"
#include "graph/operation/LowerInfo.h"
#include "dumper/dot/DotDumper.h"
-#include "linear/Linear.h"
+#include "compiler/Linear.h"
#include "exec/interp/ExecManager.h"
#include "backend/ExecTime.h"
#include "util/ConfigSource.h"
* limitations under the License.
*/
-#ifndef __NEURUN_LINEAR_ELEMENT_H__
-#define __NEURUN_LINEAR_ELEMENT_H__
+#ifndef __NEURUN_COMPILER_ELEMENT_H__
+#define __NEURUN_COMPILER_ELEMENT_H__
#include "model/Subgraph.h"
#include "graph/LowerInfoMap.h"
+// TODO Put this in class Linear (as an inner class)
namespace neurun
{
-namespace linear
+namespace compiler
{
struct Element
}
};
-} // namespace linear
+} // namespace compiler
} // namespace neurun
-#endif // __NEURUN_LINEAR_ELEMENT_H__
+#endif // __NEURUN_COMPILER_ELEMENT_H__
#include "exec/ParallelExecutor.h"
#include "compiler/BackendResolver.h"
#include "backend/ExecTime.h"
-#include "linear/Linear.h"
+#include "compiler/Linear.h"
#include "graph/dumper/Dumper.h"
#include "OperationValidator.h"
#include "SubTensorAnalyzer.h"
***********************/
// Fix shapes
- linear->iterate([&](const linear::Element &element) {
+ linear->iterate([&](const compiler::Element &element) {
auto backend = element.lower_info->backend();
auto shape_fixer = linear->getBackendContext(backend)->shape_fixer;
shape_fixer->fix(*element.subgraph);
auto execution_builder = nnfw::cpp14::make_unique<ExecutionBuilder>(*function_sequence);
// Generate kernels
- linear->iterate([&](const linear::Element &element) {
+ linear->iterate([&](const compiler::Element &element) {
auto backend = element.lower_info->backend();
auto kernel_gen = linear->getBackendContext(backend)->kernel_gen;
kernel_gen->generate(*element.subgraph, execution_builder.get());
namespace neurun
{
-namespace linear
+namespace compiler
{
Linear::Linear(const std::shared_ptr<const model::Model> &model,
void Linear::generateConstantInitializers(void) const
{
- iterate([&](const linear::Element &element) {
+ iterate([&](const compiler::Element &element) {
auto backend = element.lower_info->backend();
auto constant_initializer = _backend_resolver->getBackendContext(backend)->constant_initializer;
return itr->second.get();
}
-} // namespace linear
+} // namespace compiler
} // namespace neurun
* limitations under the License.
*/
-#ifndef __NEURUN_LINEAR_LINEAR_H__
-#define __NEURUN_LINEAR_LINEAR_H__
+#ifndef __NEURUN_COMPILER_LINEAR_H__
+#define __NEURUN_COMPILER_LINEAR_H__
#include <vector>
#include <memory>
namespace neurun
{
-namespace linear
+namespace compiler
{
class Linear
std::unique_ptr<compiler::BackendResolver> _backend_resolver;
};
-} // namespace linear
+} // namespace compiler
} // namespace neurun
-#endif // __NEURUN_LINEAR_LINEAR_H__
+#endif // __NEURUN_COMPILER_LINEAR_H__
#include "ExecutorBase.h"
#include "compiler/Plan.h"
-#include "linear/Element.h"
+#include "compiler/Element.h"
namespace neurun
{
const std::shared_ptr<compiler::OperandContext> &operand_context,
std::unique_ptr<graph::LowerInfoMap> lower_info,
std::unique_ptr<backend::MemoryManagerSet> mem_mgrs,
- std::unique_ptr<std::vector<linear::Element>> elements,
+ std::unique_ptr<std::vector<compiler::Element>> elements,
const std::shared_ptr<const neurun::compiler::Plan> &plan)
: ExecutorBase{model, std::move(subgraphs), operand_context, std::move(lower_info),
std::move(mem_mgrs)},
private:
std::shared_ptr<const compiler::Plan> _plan;
- std::unique_ptr<std::vector<linear::Element>> _elements;
+ std::unique_ptr<std::vector<compiler::Element>> _elements;
};
} // namespace exec
#include "util/logging.h"
#include "verifier/Verifier.h"
#include "cpp14/memory.h"
-#include "linear/Linear.h"
+#include "compiler/Linear.h"
#include "graph/operation/LowerInfo.h"
#include "graph/operand/LowerInfo.h"
#include "graph/operand/PermuteFactor.h"
}
}
-std::unique_ptr<linear::Linear> Graph::linearize(void)
+std::unique_ptr<compiler::Linear> Graph::linearize(void)
{
assert(_phase == Phase::MODEL);
- auto linear = nnfw::cpp14::make_unique<linear::Linear>(
+ auto linear = nnfw::cpp14::make_unique<compiler::Linear>(
shareModel(), releaseSubgraphs(), releaseLowerInfo(), releaseBackendResolver());
// TODO Move the operations and operands to linear object