syntax = "proto3";

package tensorflow.tf2xla;

import "tensorflow/core/framework/tensor_shape.proto";
import "tensorflow/core/framework/types.proto";

option cc_enable_arenas = true;
option java_outer_classname = "Tf2XlaProtos";
option java_multiple_files = true;
option java_package = "org.tensorflow.tf2xla";

// TensorMetadata indicates the type and shape of a Tensor that is
// part of a host compute transfer.
message TensorMetadata {
  DataType type = 1;
  TensorShapeProto shape = 2;
  int64 channel_id = 3;
}

// HostTransferMetadata describes a transfer either from host to device
// or device to host. It has a key that is unique to the computation,
// and metadata about the list of tensors being transferred.
message HostTransferMetadata {
  // The key used to identify this transfer.
  string key = 1;

  // For each Tensor being transferred, its type and shape.
  repeated TensorMetadata metadata = 2;
}

// HostComputeMetadata describes all the sends and recvs
// from all host compute transfer ops in a computation.
message HostComputeMetadata {
  // Metadata about each device_to_host transfer
  repeated HostTransferMetadata device_to_host = 1;

  // Metadata about each host_to_device transfer
  repeated HostTransferMetadata host_to_device = 2;
}
