build: 更新 RefactorGraph

Signed-off-by: YdrMaster <ydrml@hotmail.com>
This commit is contained in:
YdrMaster 2023-10-06 15:57:51 +08:00
parent 2fd02eec59
commit de392beb87
3 changed files with 18 additions and 4 deletions

View File

@ -79,7 +79,6 @@ if(USE_PROTOBUF)
endif()
if(USE_REFACTOR_GRAPH)
set(BUILD_SHARED ON CACHE BOOL "build shared refactor graph")
add_subdirectory(RefactorGraph)
include_directories(RefactorGraph/3rd-party/fmt/include)

@ -1 +1 @@
Subproject commit f20c536f9a846a766113f371a117eba2108b82f1
Subproject commit 31819b82fce1f85cf872e6aec38d0f8f1353bf35

View File

@ -41,7 +41,7 @@ class Compiler {
public:
explicit Compiler(Graph g) : _g(std::move(g)) {}
std::unordered_set<Name> fillEdgeInfo() { return _g.fillEdgeInfo(); }
std::unordered_set<Name> fillEdgeInfo() { return _g.fillEdgeInfo(true); }
void setInput(size_t index, int dataType,
std::vector<std::variant<std::string, int64_t>> shape) {
ASSERT(index < _g.internal().topology.globalInputsCount(),
@ -146,7 +146,22 @@ namespace frontend {
infini::Executor Compiler::compile(infini::Runtime rt) {
_g.collectVariables();
ASSERT(_g.fillEdgeInfo().empty(), "Unknown variables");
std::vector<std::string_view> unknownVariables;
for (auto const &[_, v] : _g.variables()) {
if (!v->value.has_value()) {
unknownVariables.emplace_back(v->name);
}
}
if (!unknownVariables.empty()) {
std::string msg = "Unknown variables: [ ";
for (auto const &v : unknownVariables) {
msg += v;
msg += ' ';
}
msg += ']';
RUNTIME_ERROR(std::move(msg));
}
_g.fillEdgeInfo(true);
return infini::Executor(std::move(rt), _g);
}