Bump up MinSystemMemory to 6% of available_memory.

PiperOrigin-RevId: 297689968
Change-Id: I4a6f3fbcc9c4dcc182d1c5b90f0b3e597e04e762
This commit is contained in:
A. Unique TensorFlower 2020-02-27 14:34:35 -08:00 committed by TensorFlower Gardener
parent b396f0ed32
commit 70db082057

View File

@ -805,17 +805,20 @@ int64 MinSystemMemory(int64 available_memory) {
// We use the following heuristic for now: // We use the following heuristic for now:
// //
// If the available_memory is < 2GiB, we allocate 225MiB to system memory. // If the available_memory is < 2GiB, we allocate 225MiB to system memory.
// Otherwise, allocate max(300MiB, 0.05 * available_memory) to system memory. // Otherwise, allocate max(300MiB, kMinSystemMemoryFraction *
// available_memory) to system memory.
// //
// In the future we could be more sophisticated by using a table of devices. // In the future we could be more sophisticated by using a table of devices.
int64 min_system_memory; int64 min_system_memory;
constexpr float kMinSystemMemoryFraction = 0.06;
if (available_memory < (1LL << 31)) { if (available_memory < (1LL << 31)) {
// 225MiB // 225MiB
min_system_memory = 225 * 1024 * 1024; min_system_memory = 225 * 1024 * 1024;
} else { } else {
// max(300 MiB, 0.05 * available_memory) // max(300 MiB, kMinSystemMemoryFraction * available_memory)
min_system_memory = min_system_memory = std::max(
std::max(int64{314572800}, static_cast<int64>(available_memory * 0.05)); int64{314572800},
static_cast<int64>(available_memory * kMinSystemMemoryFraction));
} }
#if defined(__GNUC__) && defined(__OPTIMIZE__) #if defined(__GNUC__) && defined(__OPTIMIZE__)
// Do nothing // Do nothing