1 /* Copyright 2018 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_SOURCE_MAP_UTIL_H_ 17 #define TENSORFLOW_COMPILER_XLA_SOURCE_MAP_UTIL_H_ 18 19 #include "tensorflow/compiler/xla/service/executable.h" 20 #include "tensorflow/compiler/xla/status.h" 21 #include "tensorflow/core/platform/macros.h" 22 23 namespace xla { 24 namespace source_map_util { 25 26 // Creates an INVALID_ARUGMENT status with the given format string. 27 // 28 // Also, attempts to extract the OpMetadata for parameter_number on executable 29 // and append it to the status message for source mapping to user code. 30 // 31 // executable may be nullptr, but parameter_number should not be out of bounds 32 // or a CHECK-failure may occur. 33 Status InvalidParameterArgument(Executable* executable, int parameter_number, 34 const char* format, ...) 35 TF_PRINTF_ATTRIBUTE(3, 4); 36 37 // As above, but takes the parameter metadata directly instead of extracting it 38 // from the executable. 39 Status InvalidParameterArgument(const OpMetadata& op_metadata, 40 const char* format, ...) 41 TF_PRINTF_ATTRIBUTE(2, 3); 42 43 } // namespace source_map_util 44 } // namespace xla 45 46 #endif // TENSORFLOW_COMPILER_XLA_SOURCE_MAP_UTIL_H_ 47