Skip to content

Commit

Permalink
Merge pull request #2467 from ROCm/rocm_dnn_workspace_limit_dev_upstream
Browse files Browse the repository at this point in the history
[ROCM] adding env variable to control rocm_dnn workspace limit
  • Loading branch information
pemeliya authored Mar 22, 2024
2 parents ea6764b + c3d966e commit 08cac3a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion third_party/xla/xla/service/gpu/conv_algorithm_picker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ limitations under the License.
#include "tsl/platform/logging.h"
#include "tsl/platform/numbers.h"
#include "tsl/util/proto/proto_utils.h"
#include "tsl/util/env_var.h"

#if (defined(GOOGLE_CUDA) && GOOGLE_CUDA)
#include "third_party/gpus/cudnn/cudnn.h" // IWYU pragma: keep
Expand Down Expand Up @@ -96,10 +97,18 @@ class ScratchAllocator : public se::ScratchAllocator {
: device_ordinal_(device_ordinal), memory_allocator_(memory_allocator) {}

int64_t GetMemoryLimitInBytes() override {
return 1LL << 32; // 4GB. TODO(jlebar): Tune this?
return ScratchAllocator::GetDefaultMemoryLimitInBytes();
}

int64_t TotalAllocatedBytes() { return total_allocated_bytes_; }

static int64_t GetDefaultMemoryLimitInBytes() {
int64_t value;
TF_CHECK_OK(tsl::ReadInt64FromEnvVar("TF_CUDNN_WORKSPACE_LIMIT_IN_MB",
1LL << 12, &value));
return value * (1LL << 20);
}

absl::StatusOr<se::DeviceMemory<uint8_t>> AllocateBytes(
int64_t byte_size) override;

Expand Down

0 comments on commit 08cac3a

Please sign in to comment.