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 16 // For Google-internal use only. 17 // 18 // Supports serializing the autotune maps to string 19 // (SerializeAutotuneMaps), as well as deserializing them from 20 // string and injecting them into TF runtime 21 // (LoadSerializedAutotuneMaps). 22 // 23 // Aims to speed up the warmup time of neural nets. 24 25 #ifndef TENSORFLOW_CORE_UTIL_AUTOTUNE_MAPS_AUTOTUNE_SERIALIZE_H_ 26 #define TENSORFLOW_CORE_UTIL_AUTOTUNE_MAPS_AUTOTUNE_SERIALIZE_H_ 27 28 #include <string> 29 30 #include "tensorflow/core/platform/status.h" 31 32 namespace tensorflow { 33 34 // TODO(b/189530096) Support autotune maps for more ops. 35 // Loads autotune maps from string output by SerializeAutotuneMaps and uses 36 // them to update the runtime autotune maps. 37 Status LoadSerializedAutotuneMaps(absl::string_view s); 38 39 // Serializes all the autotune maps into a string that can be decoded by 40 // LoadSerializedAutotuneMaps. 41 Status SerializeAutotuneMaps(std::string* output); 42 43 // Resets all autotune maps. For test use only. 44 void ResetAutotuneMaps(); 45 46 } // namespace tensorflow 47 48 #endif // TENSORFLOW_CORE_UTIL_AUTOTUNE_MAPS_AUTOTUNE_SERIALIZE_H_ 49