[XLA] Make XlaAllocator obey retry_on_failure arg.
authorJustin Lebar <jlebar@google.com>
Wed, 9 May 2018 01:16:47 +0000 (18:16 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Wed, 9 May 2018 17:37:41 +0000 (10:37 -0700)
Previously we ignored it.

PiperOrigin-RevId: 195908178

tensorflow/compiler/jit/xla_launch_util.cc

index 0223f97..e12e88f 100644 (file)
@@ -62,7 +62,10 @@ XlaAllocator::~XlaAllocator() {}
 
 xla::StatusOr<se::DeviceMemoryBase> XlaAllocator::Allocate(
     int device_ordinal, uint64 size, bool retry_on_failure) {
-  void* data = wrapped_->AllocateRaw(Allocator::kAllocatorAlignment, size);
+  AllocationAttributes attrs;
+  attrs.no_retry_on_failure = !retry_on_failure;
+  void* data =
+      wrapped_->AllocateRaw(Allocator::kAllocatorAlignment, size, attrs);
   if (data == nullptr) {
     return errors::ResourceExhausted("Out of memory while trying to allocate ",
                                      size, " bytes.");