MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Finish

Method Finish

tensorflow/compiler/xla/service/heap_simulator.cc:399–425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

397}
398
399HeapSimulator::Result HeapSimulator::Finish() {
400 Result result = algorithm_->Finish();
401
402 // Post-process the result to add chunks for shared buffers. An empty chunk
403 // map means that either no buffers were allocated, or the heap was only
404 // collecting statistics, e.g. NoFragmentationStatsHeap.
405 size_t total_chunk_count = 0;
406 absl::c_for_each(result.heap_results, [&](const HeapResult& hr) {
407 total_chunk_count += hr.chunk_map.size();
408 });
409 if (total_chunk_count != 0) {
410 // If we were told to assign specific buffers, make sure we've assigned
411 // exactly that many buffers.
412 if (options_.buffers_to_assign != nullptr) {
413 CHECK_EQ(options_.buffers_to_assign->size(), total_chunk_count);
414 }
415 }
416
417 // Fragmentation is the difference between the actual and ideal sizes.
418 const Result no_frag_result = no_fragmentation_stats_->Finish();
419 result.fragmentation_size = result.heap_size - no_frag_result.heap_size;
420
421 // Copy the debug trace we collected to the final result.
422 result.debug_trace.Swap(&debug_trace_);
423
424 return result;
425}
426
427void HeapSimulator::FillDebugTrace(HeapSimulatorTrace::Event::Kind kind,
428 const HloValue* buffer,

Callers 4

~GrpcTpuStreamMethod · 0.45
RunMethod · 0.45

Calls 8

sizeMethod · 0.45
SwapMethod · 0.45
emplace_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45
push_backMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected