MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / add_branch

Method add_branch

src/runtime/CL/mlgo/HeuristicTree.cpp:149–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149bool HeuristicTree::add_branch(NodeID id, Condition cond, NodeID t_node, NodeID f_node)
150{
151 if (_tree.size() >= _max_num_nodes)
152 {
153 ARM_COMPUTE_LOG_INFO_MSG_WITH_FORMAT_CORE("Exceeding the maximum number of nodes allowed %zu", _max_num_nodes);
154 return false;
155 }
156
157 const std::set<std::string> supported_features = {"m", "n", "k", "b", "r_mn", "r_mk", "r_nk", "r_mnk", "workload"};
158 const auto orig_feature = cond.feature;
159 std::transform(cond.feature.begin(), cond.feature.end(), cond.feature.begin(),
160 [](char c) { return std::tolower(c); });
161 if (supported_features.find(cond.feature) == supported_features.end())
162 {
163 ARM_COMPUTE_LOG_INFO_MSG_WITH_FORMAT_CORE("Unsupported feature %s", orig_feature.c_str());
164 return false;
165 }
166
167 if (_tree.find(id) != _tree.end())
168 {
169 ARM_COMPUTE_LOG_INFO_MSG_WITH_FORMAT_CORE("Cannot add node; node id %zu already exists", id);
170 return false;
171 }
172 _tree[id] = std::make_unique<BranchNode>(id, cond, t_node, f_node);
173 return true;
174}
175
176bool HeuristicTree::check_if_structurally_correct() const
177{

Callers 1

heuristic_treeFunction · 0.80

Calls 6

transformFunction · 0.85
findMethod · 0.80
tolowerFunction · 0.50
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected