| 583 | #if GOOGLE_CUDA || TENSORFLOW_USE_ROCM |
| 584 | |
| 585 | int64 GetDnnWorkspaceLimit(const string& envvar_in_mb, |
| 586 | int64 default_value_in_bytes) { |
| 587 | const char* workspace_limit_in_mb_str = getenv(envvar_in_mb.c_str()); |
| 588 | if (workspace_limit_in_mb_str != nullptr && |
| 589 | strcmp(workspace_limit_in_mb_str, "") != 0) { |
| 590 | int64 scratch_limit_in_mb = -1; |
| 591 | if (strings::safe_strto64(workspace_limit_in_mb_str, |
| 592 | &scratch_limit_in_mb)) { |
| 593 | return scratch_limit_in_mb * (1 << 20); |
| 594 | } else { |
| 595 | LOG(WARNING) << "Invalid value for env-var " << envvar_in_mb << ": " |
| 596 | << workspace_limit_in_mb_str; |
| 597 | } |
| 598 | } |
| 599 | return default_value_in_bytes; |
| 600 | } |
| 601 | |
| 602 | // A dummy type to group forward convolution autotune results together. |
| 603 | struct ConvAutoTuneGroup { |
no test coverage detected