1 /* Copyright 2021 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 #ifndef TENSORFLOW_CORE_TPU_KERNELS_TPU_EXECUTE_OP_OPTIONS_H_ 16 #define TENSORFLOW_CORE_TPU_KERNELS_TPU_EXECUTE_OP_OPTIONS_H_ 17 18 #include "absl/strings/string_view.h" 19 #include "tensorflow/core/platform/status.h" 20 21 namespace tensorflow { 22 namespace internal { 23 24 enum class TpuCancellationClosesChipsMode : int { 25 kUnset = 0, // fallback to other configuration, e.g. absl flag 26 kEnabled = 1, // Close TPU chips when cancellation happens 27 kDisabled = 2, // Do not close TPU chips when cancellation happens 28 }; 29 30 // Set TPU cancellation closing chips mode from an integer. See the enum 31 // definition of `TpuCancellationClosesChipsConfig` above for valid values. 32 Status SetTpuCancellationClosesChips(int val); 33 34 // Get whether to close chips when TPUExecutionOp is cancelled. If unset, return 35 // the value specified by the `default_value` argument. 36 bool TpuCancellationClosesChipsGetOrDefault(bool default_value); 37 } // namespace internal 38 } // namespace tensorflow 39 40 #endif // TENSORFLOW_CORE_TPU_KERNELS_TPU_EXECUTE_OP_OPTIONS_H_ 41