aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/common_runtime/sycl/sycl_allocator.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/core/common_runtime/sycl/sycl_allocator.cc')
-rw-r--r--tensorflow/core/common_runtime/sycl/sycl_allocator.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/tensorflow/core/common_runtime/sycl/sycl_allocator.cc b/tensorflow/core/common_runtime/sycl/sycl_allocator.cc
index 0d238276f4..b7ef9361e9 100644
--- a/tensorflow/core/common_runtime/sycl/sycl_allocator.cc
+++ b/tensorflow/core/common_runtime/sycl/sycl_allocator.cc
@@ -25,6 +25,9 @@ string SYCLAllocator::Name() { return "device:SYCL"; }
void *SYCLAllocator::AllocateRaw(size_t alignment, size_t num_bytes) {
assert(device_);
+ if (num_bytes == 0) {
+ return device_->allocate(1);
+ }
auto p = device_->allocate(num_bytes);
return p;
}
@@ -42,6 +45,6 @@ void SYCLAllocator::EnterLameDuckMode() {
}
}
-} // namespace tensorflow
+} // namespace tensorflow
-#endif // TENSORFLOW_USE_SYCL
+#endif // TENSORFLOW_USE_SYCL