This commit LowerInfoMap as member into class IKernelGenerator.
Signed-off-by: jiseob.jang <jiseob.jang@samsung.com>
#include "ITensorBuilder.h"
#include "compiler/IExecutionBuilder.h"
+#include "graph/LowerInfoMap.h"
#include "model/OperationVisitor.h"
#include "model/Subgraph.h"
#include "cpp14/memory.h"
public:
virtual ~IKernelGenerator() = default;
- void generate(const model::Operation &node, neurun::compiler::IExecutionBuilder *executionBuilder)
+ void generate(const model::Operation &node, neurun::compiler::IExecutionBuilder *executionBuilder,
+ const graph::LowerInfoMap *lower_info_map)
{
_execution_builder = executionBuilder;
+ _lower_info_map = lower_info_map;
node.accept(*this);
}
protected:
neurun::compiler::IExecutionBuilder *_execution_builder;
+ const graph::LowerInfoMap *_lower_info_map;
};
} // namespace backend
// For LOWERED phase
public:
+ const LowerInfoMap *getLowerInfo() const { return _lower_info_map.get(); }
const operation::LowerInfo *getLowerInfo(const model::SubgraphIndex &subg_index) const;
void setLowerInfo(const model::SubgraphIndex &subg_index,
std::unique_ptr<operation::LowerInfo> &&lower_info);
linear->iterate([&](const compiler::Linear::Element &element) {
auto backend = element.lower_info->backend();
auto kernel_gen = linear->getBackendContext(backend)->kernel_gen;
- kernel_gen->generate(*element.subgraph, execution_builder.get());
+ kernel_gen->generate(*element.subgraph, execution_builder.get(), linear->getLowerInfo());
});
for (auto &tensor_builder : tensor_builders)
// TODO This approach is temporal. See declaration of `setNextIndex`.
execution_builder->setNextIndex(subg_index);
auto kernel_gen = graph.backend_resolver()->getBackendContext(backend)->kernel_gen;
- kernel_gen->generate(subg, execution_builder.get());
+ kernel_gen->generate(subg, execution_builder.get(), graph.getLowerInfo());
});
for (const auto &tensor_builder : tensor_builders)
void generateConstantInitializers(void) const;
std::unique_ptr<graph::LowerInfoMap> releaseLowerInfo() { return std::move(_lower_info_map); }
- graph::LowerInfoMap *getLowerInfo() { return _lower_info_map.get(); }
+ const graph::LowerInfoMap *getLowerInfo() { return _lower_info_map.get(); }
std::unique_ptr<model::Subgraphs> releaseSubgraphs() { return std::move(_subgraphs); }