1 /* Copyright 2015 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 // IWYU pragma: private, include "perftools/gputools/executor/stream_executor.h" 17 18 #ifndef TENSORFLOW_STREAM_EXECUTOR_LIB_STATUS_H_ 19 #define TENSORFLOW_STREAM_EXECUTOR_LIB_STATUS_H_ 20 21 #include "tensorflow/core/lib/core/status.h" 22 #include "tensorflow/stream_executor/lib/error.h" // IWYU pragma: export 23 #include "tensorflow/stream_executor/lib/stringpiece.h" 24 #include "tensorflow/stream_executor/platform/logging.h" 25 26 namespace perftools { 27 namespace gputools { 28 namespace port { 29 30 using Status = tensorflow::Status; 31 32 #define SE_CHECK_OK(val) TF_CHECK_OK(val) 33 #define SE_ASSERT_OK(val) \ 34 ASSERT_EQ(::perftools::gputools::port::Status::OK(), (val)) 35 36 // Define some canonical error helpers. 37 inline Status UnimplementedError(StringPiece message) { 38 return Status(error::UNIMPLEMENTED, message); 39 } 40 inline Status InternalError(StringPiece message) { 41 return Status(error::INTERNAL, message); 42 } 43 inline Status FailedPreconditionError(StringPiece message) { 44 return Status(error::FAILED_PRECONDITION, message); 45 } 46 47 } // namespace port 48 } // namespace gputools 49 } // namespace perftools 50 51 #endif // TENSORFLOW_STREAM_EXECUTOR_LIB_STATUS_H_ 52