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