1 /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 ==============================================================================*/ 15 16 #ifndef TENSORFLOW_STREAM_EXECUTOR_TPU_TPU_EXECUTOR_INTERFACE_H_ 17 #define TENSORFLOW_STREAM_EXECUTOR_TPU_TPU_EXECUTOR_INTERFACE_H_ 18 19 #include <memory> 20 21 #include "tensorflow/stream_executor/device_memory.h" 22 #include "tensorflow/stream_executor/lib/statusor.h" 23 #include "tensorflow/stream_executor/stream_executor_internal.h" 24 #include "tensorflow/stream_executor/tpu/tpu_platform_interface.h" 25 #include "tensorflow/stream_executor/tpu/tpu_topology.h" 26 27 namespace tpu { 28 class TpuCore; 29 } // namespace tpu 30 31 namespace tensorflow { 32 namespace tpu { 33 34 class TpuExecutorInterface 35 : public stream_executor::internal::StreamExecutorInterface { 36 public: 37 template <typename T> 38 using StatusOr = stream_executor::port::StatusOr<T>; 39 40 class TemporaryDeviceMemory { 41 public: ~TemporaryDeviceMemory()42 virtual ~TemporaryDeviceMemory() {} 43 virtual stream_executor::DeviceMemoryBase AsDeviceMemoryBase() const = 0; 44 }; 45 46 virtual StatusOr<std::unique_ptr<TemporaryDeviceMemory>> CreateTemporaryDeviceMemory(int64 memory_space,int64 byte_offset,int64 size)47 CreateTemporaryDeviceMemory(int64 memory_space, int64 byte_offset, 48 int64 size) { 49 LOG(FATAL) << "Unimplemented."; 50 } 51 platform()52 virtual const TpuPlatformInterface& platform() const { 53 LOG(FATAL) << "Unimplemented."; 54 } 55 platform()56 virtual TpuPlatformInterface& platform() { LOG(FATAL) << "Unimplemented."; } 57 GetCoreLocationExternal()58 virtual TpuCoreLocationExternal GetCoreLocationExternal() const { 59 LOG(FATAL) << "Unimplemented."; 60 } 61 }; 62 63 } // namespace tpu 64 } // namespace tensorflow 65 66 #endif // TENSORFLOW_STREAM_EXECUTOR_TPU_TPU_EXECUTOR_INTERFACE_H_ 67