| 132 | } |
| 133 | |
| 134 | ExecutionWorkload configure_all_nodes(Graph &g, GraphContext &ctx, const std::vector<NodeID> &node_order) |
| 135 | { |
| 136 | ExecutionWorkload workload; |
| 137 | workload.graph = &g; |
| 138 | workload.ctx = &ctx; |
| 139 | |
| 140 | // Reserve memory for tasks |
| 141 | workload.tasks.reserve(node_order.size()); |
| 142 | |
| 143 | // Create tasks |
| 144 | for (auto &node_id : node_order) |
| 145 | { |
| 146 | auto node = g.node(node_id); |
| 147 | if (node != nullptr) |
| 148 | { |
| 149 | Target assigned_target = node->assigned_target(); |
| 150 | backends::IDeviceBackend &backend = backends::BackendRegistry::get().get_backend(assigned_target); |
| 151 | std::unique_ptr<IFunction> func = backend.configure_node(*node, ctx); |
| 152 | if (func != nullptr || is_utility_node(node)) |
| 153 | { |
| 154 | workload.tasks.emplace_back(ExecutionTask(std::move(func), node)); |
| 155 | } |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | // Add inputs and outputs |
| 160 | for (auto &node : g.nodes()) |
| 161 | { |
| 162 | if (node != nullptr && node->type() == NodeType::Input) |
| 163 | { |
| 164 | workload.inputs.push_back(node->output(0)); |
| 165 | } |
| 166 | |
| 167 | if (node != nullptr && node->type() == NodeType::Output) |
| 168 | { |
| 169 | workload.outputs.push_back(node->input(0)); |
| 170 | continue; |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | return workload; |
| 175 | } |
| 176 | |
| 177 | void release_unused_tensors(Graph &g) |
| 178 | { |
no test coverage detected