• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1syntax = "proto3";
2
3package tensorflow.data.model;
4
5option cc_enable_arenas = true;
6option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/model_go_proto";
7
8// Class of a node in the performance model.
9enum NodeClass {
10  UNKNOWN = 0;
11  INTERLEAVE_MANY = 1;
12  ASYNC_INTERLEAVE_MANY = 2;
13  KNOWN_RATIO = 3;
14  ASYNC_KNOWN_RATIO = 4;
15  UNKNOWN_RATIO = 5;
16  ASYNC_UNKNOWN_RATIO = 6;
17}
18
19// Algorithm used for model autotuning optimization.
20enum AutotuneAlgorithm {
21  DEFAULT = 0;
22  HILL_CLIMB = 1;
23  GRADIENT_DESCENT = 2;
24  MAX_PARALLELISM = 3;
25  STAGE_BASED = 4;
26}
27
28// Protocol buffer representing the data used by the autotuning modeling
29// framework.
30message ModelProto {
31  // General representation of a node in the model.
32  message Node {
33    // Unique node ID.
34    int64 id = 1;
35
36    // Human-readable name of the node.
37    string name = 2;
38
39    // An indication whether autotuning is enabled for this node.
40    bool autotune = 3;
41
42    // The number of bytes stored in this node's buffer.
43    int64 buffered_bytes = 4;
44
45    // The number of elements stored in this node's buffer.
46    int64 buffered_elements = 5;
47
48    // The number of bytes consumed by the node.
49    int64 bytes_consumed = 6;
50
51    // The number of bytes produced by the node.
52    int64 bytes_produced = 7;
53
54    // The number of elements produced by the node.
55    int64 num_elements = 8;
56
57    // The aggregate processing time spent in this node in nanoseconds.
58    int64 processing_time = 9;
59
60    // An indication whether this node records metrics about produced and
61    // consumed elements.
62    bool record_metrics = 10;
63
64    // Represents a node parameter.
65    message Parameter {
66      // Human-readable name of the parameter.
67      string name = 1;
68
69      // Identifies the model value of the parameter. This can be different from
70      // the actual value (e.g. during optimization search).
71      double value = 2;
72
73      // The actual value of the parameter.
74      double state_value = 3;
75
76      // Minimum value of the parameter.
77      double min = 4;
78
79      // Maximum value of the parameter.
80      double max = 5;
81
82      // Identifies whether the parameter should participate in autotuning.
83      bool tunable = 6;
84    }
85
86    // Parameters of this node.
87    repeated Parameter parameters = 11;
88
89    // Statistic of inputs processing time history.
90    double input_processing_time_sum = 12;
91    int64 input_processing_time_count = 13;
92
93    // IDs of inputs of this node.
94    repeated int64 inputs = 14;
95
96    // Class of this node.
97    NodeClass node_class = 15;
98
99    // Ratio of input to output elements. This is only used by KNOWN_RATIO and
100    // ASYNC_KNOWN_RATIO nodes.
101    double ratio = 16;
102
103    // Ratio identifies how many parallelism calls are introduced by one
104    // buffered element. This is only used by ASYNC_KNOWN_RATIO nodes.
105    double memory_ratio = 17;
106  }
107
108  // Map of node IDs to nodes of this model.
109  map<int64, Node> nodes = 1;
110
111  // ID of the output node of this model.
112  int64 output = 2;
113
114  // Counter for node IDs of this model.
115  int64 id_counter = 3;
116
117  reserved 4;
118
119  // Contains parameters of the model autotuning optimization.
120  message OptimizationParams {
121    // Algorithm used for autotuning optimization.
122    AutotuneAlgorithm algorithm = 1;
123
124    // Number of available logical threads.
125    int64 cpu_budget = 2;
126
127    // Amount of available memory in bytes.
128    int64 ram_budget = 3;
129
130    // Time between two consecutive `GetNext` calls to the iterator represented
131    // by the output node.
132    double model_input_time = 4;
133  }
134
135  OptimizationParams optimization_params = 5;
136}
137