================================================================================================
| 1307 | |
| 1308 | // ================================================================================================ |
| 1309 | hipError_t GraphExec::UpdatePacketBatchesForNodeEnableDisable(hip::GraphNode* node, |
| 1310 | bool isEnabled) { |
| 1311 | if (!node->GraphCaptureEnabled()) { |
| 1312 | // Only handle single stream case with captured nodes |
| 1313 | return hipSuccess; |
| 1314 | } |
| 1315 | |
| 1316 | // Use node_to_segment_id_ for O(1) segment lookup |
| 1317 | auto segIdIt = node_to_segment_id_.find(node); |
| 1318 | if (segIdIt == node_to_segment_id_.end()) { |
| 1319 | return hipSuccess; // Node not in any segment |
| 1320 | } |
| 1321 | |
| 1322 | int segmentId = segIdIt->second; |
| 1323 | |
| 1324 | // Find the segment batch for this segment ID using O(1) map lookup |
| 1325 | auto segBatchIt = segmentBatches_.find(segmentId); |
| 1326 | if (segBatchIt == segmentBatches_.end()) { |
| 1327 | return hipSuccess; // Segment not found |
| 1328 | } |
| 1329 | |
| 1330 | auto& segBatch = segBatchIt->second; |
| 1331 | |
| 1332 | // Search only within this segment's packet batches |
| 1333 | for (auto& packetBatch : segBatch.packet_batches) { |
| 1334 | auto it = packetBatch.nodeToRangeIndex.find(node); |
| 1335 | if (it != packetBatch.nodeToRangeIndex.end()) { |
| 1336 | // Found the batch containing this node - update enabled state |
| 1337 | packetBatch.setEnabled(node, isEnabled); |
| 1338 | return hipSuccess; |
| 1339 | } |
| 1340 | } |
| 1341 | return hipSuccess; |
| 1342 | } |
| 1343 | |
| 1344 | // ================================================================================================ |
| 1345 |
no test coverage detected