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_COMPILER_XLA_STREAM_EXECUTOR_TPU_TPU_EXECUTOR_INTERFACE_H_ 17 #define TENSORFLOW_COMPILER_XLA_STREAM_EXECUTOR_TPU_TPU_EXECUTOR_INTERFACE_H_ 18 19 #include <memory> 20 21 #include "tensorflow/compiler/xla/stream_executor/device_memory.h" 22 #include "tensorflow/compiler/xla/stream_executor/lib/statusor.h" 23 #include "tensorflow/compiler/xla/stream_executor/stream_executor_internal.h" 24 #include "tensorflow/compiler/xla/stream_executor/tpu/tpu_platform_interface.h" 25 #include "tensorflow/compiler/xla/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_t memory_space,int64_t byte_offset,int64_t size)47 CreateTemporaryDeviceMemory(int64_t memory_space, int64_t byte_offset, 48 int64_t 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 UnloadAllPrograms()62 virtual Status UnloadAllPrograms() { LOG(FATAL) << "Unimplemented."; } 63 EnqueueCompactionOnStreamForHbm(stream_executor::Stream * compaction_stream)64 virtual Status EnqueueCompactionOnStreamForHbm( 65 stream_executor::Stream* compaction_stream) { 66 LOG(FATAL) << "Unimplemented."; 67 } 68 }; 69 70 } // namespace tpu 71 } // namespace tensorflow 72 73 #endif // TENSORFLOW_COMPILER_XLA_STREAM_EXECUTOR_TPU_TPU_EXECUTOR_INTERFACE_H_ 74