MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / ComputeMemoryVolume

Method ComputeMemoryVolume

oneflow/core/graph/straighten_nodes.cpp:348–356  ·  view source on GitHub ↗

Memory volume is memory * lifetime, but we might change the formula

Source from the content-addressed store, hash-verified

346
347// Memory volume is memory * lifetime, but we might change the formula
348void TopoStruct::ComputeMemoryVolume() {
349 static float lifetime_order = ParseFloatFromEnv("LifetimeOrder", 1.0);
350 // We might get a large tensor multiply by a long life time, we need some rescaling
351 memory_volume = static_cast<int64_t>(
352 (memory_increment * pow(static_cast<double>(min_lifetime), lifetime_order)) / 1000.0);
353 // We need to distinguish zero or negative memory increment from slight positive memory increment.
354 // Make sure that we execute -0.1, 0, -0.003 before 0.1, 0.2
355 if (memory_increment > 0) { memory_volume += 1; }
356}
357
358// deciding parameter
359// kTributaryLayerAscend = 0, // small tributary layers go first

Callers 1

FindMinLifetimeFunction · 0.80

Calls 2

ParseFloatFromEnvFunction · 0.85
powFunction · 0.85

Tested by

no test coverage detected