| 257 | } // namespace |
| 258 | |
| 259 | Status Compile(const GraphFloat32& graph, const RuntimeOptions& options, |
| 260 | CompiledModel* compiled_model) { |
| 261 | for (const auto& node : graph.nodes()) { |
| 262 | std::vector<ValueId> inputs; |
| 263 | for (auto& input : graph.FindInputs(node->id)) { |
| 264 | inputs.push_back(static_cast<ValueId>(input->id)); |
| 265 | } |
| 266 | std::vector<ValueId> outputs; |
| 267 | for (auto& output : graph.FindOutputs(node->id)) { |
| 268 | outputs.push_back(static_cast<ValueId>(output->id)); |
| 269 | } |
| 270 | std::vector<ComputeTaskDescriptorPtr> tasks; |
| 271 | auto custom_status = |
| 272 | RegisterCustomOps(graph, node, inputs, outputs, options, &tasks); |
| 273 | if (!custom_status.ok()) { |
| 274 | auto primary_status = |
| 275 | RegisterPrimaryOps(graph, node, inputs, outputs, options, &tasks); |
| 276 | if (!primary_status.ok()) { |
| 277 | return UnimplementedError(absl::Substitute( |
| 278 | "Unsupported op type: $0; custom registry error: " |
| 279 | "$1; primary registry error: $2;", |
| 280 | node->operation.type, custom_status.error_message(), |
| 281 | primary_status.error_message())); |
| 282 | } |
| 283 | } |
| 284 | compiled_model->insert(compiled_model->end(), tasks.begin(), tasks.end()); |
| 285 | } |
| 286 | return OkStatus(); |
| 287 | } |
| 288 | |
| 289 | } // namespace metal |
| 290 | } // namespace gpu |
nothing calls this directly
no test coverage detected