message: Update compilation cache key computation implementation.
diff: @@ -22,25 +22,6 @@ limitations under the License.
  namespace tensorflow {
  namespace tpu {
  namespace {
  -// Return fingerprint_in_metadata if it's not empty; otherwise read input tensor
  -// data to compute the fingerprint.
  -std::string GuaranteedConstFingerprint(const string& fingerprint_in_metadata,
  - const Tensor* guaranteed_constants,
  - size_t guaranteed_constants_size) {
  - if (fingerprint_in_metadata.empty()) {
  - uint64_t fingerprint = 0;
  - for (size_t i = 0; i < guaranteed_constants_size; ++i) {
  - const Tensor& constant = guaranteed_constants[i];
  - fingerprint = TpuCompile_CreateGuaranteedConstFingerprint(
  - fingerprint, constant.tensor_data().data(),
  - constant.tensor_data().size());
  - }
  - return std::to_string(fingerprint);
  - } else {
  - return fingerprint_in_metadata;
  - }
  -}
  -
  std::string CreateShapePrefix(
  const std::vector<tensorflow::TensorShape>& dynamic_shapes) {
  std::string shapes_prefix;
  @@ -87,6 +68,25 @@ std::string CreateConfigPrefix(const TPUCompileMetadataProto& metadata) {
  }
  } // namespace
  +// Return fingerprint_in_metadata if it's not empty; otherwise read input tensor
  +// data to compute the fingerprint.
  +std::string GuaranteedConstFingerprint(const string& fingerprint_in_metadata,
  + const Tensor* guaranteed_constants,
  + size_t guaranteed_constants_size) {
  + if (fingerprint_in_metadata.empty()) {
  + uint64_t fingerprint = 0;
  + for (size_t i = 0; i < guaranteed_constants_size; ++i) {
  + const Tensor& constant = guaranteed_constants[i];
  + fingerprint = TpuCompile_CreateGuaranteedConstFingerprint(
  + fingerprint, constant.tensor_data().data(),
  + constant.tensor_data().size());
  + }
  + return std::to_string(fingerprint);
  + } else {
  + return fingerprint_in_metadata;
  + }
  +}
  +
  // The `guaranteed_constants` must be passed as reference due to the lazy
  // evaluation of `guaranteed_const_fingerprint()` callback.
  TpuCompilationCacheKey CreateCompilationCacheKey(
  