| 147 | } |
| 148 | |
| 149 | bool 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 | |
| 176 | bool HeuristicTree::check_if_structurally_correct() const |
| 177 | { |