• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "third_party/tensorflow/stream_executor/stream_executor.h"
17 
18 #ifndef TENSORFLOW_STREAM_EXECUTOR_LIB_STATUS_H_
19 #define TENSORFLOW_STREAM_EXECUTOR_LIB_STATUS_H_
20 
21 #include "absl/strings/string_view.h"
22 #include "tensorflow/core/lib/core/status.h"
23 #include "tensorflow/stream_executor/lib/error.h"  // IWYU pragma: export
24 #include "tensorflow/stream_executor/platform/logging.h"
25 
26 namespace stream_executor {
27 namespace port {
28 
29 using Status = tensorflow::Status;
30 
31 #define SE_CHECK_OK(val) TF_CHECK_OK(val)
32 #define SE_ASSERT_OK(val) \
33   ASSERT_EQ(::stream_executor::port::Status::OK(), (val))
34 
35 // Define some canonical error helpers.
UnimplementedError(absl::string_view message)36 inline Status UnimplementedError(absl::string_view message) {
37   return Status(error::UNIMPLEMENTED, message);
38 }
InternalError(absl::string_view message)39 inline Status InternalError(absl::string_view message) {
40   return Status(error::INTERNAL, message);
41 }
FailedPreconditionError(absl::string_view message)42 inline Status FailedPreconditionError(absl::string_view message) {
43   return Status(error::FAILED_PRECONDITION, message);
44 }
45 
46 }  // namespace port
47 }  // namespace stream_executor
48 
49 namespace perftools {
50 namespace gputools {
51 
52 // Temporarily pull stream_executor into perftools::gputools while we migrate
53 // code to the new namespace.  TODO(b/77980417): Remove this once we've
54 // completed the migration.
55 using namespace stream_executor;  // NOLINT[build/namespaces]
56 
57 }  // namespace gputools
58 }  // namespace perftools
59 
60 #endif  // TENSORFLOW_STREAM_EXECUTOR_LIB_STATUS_H_
61