@@ -12,9 +12,9 @@ enum route_config_member
12
12
{
13
13
route_config_member_route ,
14
14
route_config_member_path ,
15
- route_config_member_path_premodule ,
16
15
route_config_member_admissions_percentile ,
17
16
route_config_member_relative_deadline_us ,
17
+ route_config_member_path_preprocess ,
18
18
route_config_member_model_bias ,
19
19
route_config_member_model_scale ,
20
20
route_config_member_model_num_of_param ,
@@ -27,9 +27,9 @@ enum route_config_member
27
27
struct route_config {
28
28
char * route ;
29
29
char * path ;
30
- char * path_premodule ;
31
30
uint8_t admissions_percentile ;
32
31
uint32_t relative_deadline_us ;
32
+ char * path_preprocess ;
33
33
uint32_t model_bias ;
34
34
uint32_t model_scale ;
35
35
uint32_t model_num_of_param ;
@@ -54,14 +54,16 @@ route_config_print(struct route_config *config)
54
54
{
55
55
printf ("[Route] Route: %s\n" , config -> route );
56
56
printf ("[Route] Path: %s\n" , config -> path );
57
- printf ("[Route] Path of Preprocessing Module: %s\n" , config -> path_premodule );
58
57
printf ("[Route] Admissions Percentile: %hhu\n" , config -> admissions_percentile );
59
58
printf ("[Route] Relative Deadline (us): %u\n" , config -> relative_deadline_us );
59
+ printf ("[Route] HTTP Response Content Type: %s\n" , config -> http_resp_content_type );
60
+ #ifdef EXECUTION_HISTOGRAM
61
+ printf ("[Route] Path of Preprocessing Module: %s\n" , config -> path_preprocess );
60
62
printf ("[Route] Model Bias: %u\n" , config -> model_bias );
61
63
printf ("[Route] Model Scale: %u\n" , config -> model_scale );
62
64
printf ("[Route] Model Num of Parameters: %u\n" , config -> model_num_of_param );
63
65
printf ("[Route] Model Betas: [%u, %u]\n" , config -> model_beta1 , config -> model_beta2 );
64
- printf ( "[Route] HTTP Response Content Type: %s\n" , config -> http_resp_content_type );
66
+ #endif
65
67
}
66
68
67
69
/**
@@ -73,7 +75,7 @@ static inline int
73
75
route_config_validate (struct route_config * config , bool * did_set )
74
76
{
75
77
if (did_set [route_config_member_route ] == false) {
76
- fprintf (stderr , "path field is required\n" );
78
+ fprintf (stderr , "route field is required\n" );
77
79
return -1 ;
78
80
}
79
81
@@ -82,19 +84,14 @@ route_config_validate(struct route_config *config, bool *did_set)
82
84
return -1 ;
83
85
}
84
86
85
- if (did_set [route_config_member_path_premodule ] == false) {
86
- fprintf (stderr , "path_premodule field is required\n" );
87
- return -1 ;
88
- }
89
-
90
87
if (did_set [route_config_member_http_resp_content_type ] == false) {
91
88
debuglog ("http_resp_content_type not set, defaulting to text/plain\n" );
92
89
config -> http_resp_content_type = "text/plain" ;
93
90
}
94
91
95
- if (scheduler != SCHEDULER_FIFO ) {
92
+ if (scheduler != SCHEDULER_FIFO && scheduler != SCHEDULER_SJF ) {
96
93
if (did_set [route_config_member_relative_deadline_us ] == false) {
97
- fprintf (stderr , "relative_deadline_us is required\n" );
94
+ fprintf (stderr , "relative_deadline_us is required for the selected scheduler \n" );
98
95
return -1 ;
99
96
}
100
97
@@ -103,20 +100,69 @@ route_config_validate(struct route_config *config, bool *did_set)
103
100
(uint32_t )RUNTIME_RELATIVE_DEADLINE_US_MAX , config -> relative_deadline_us );
104
101
return -1 ;
105
102
}
103
+ }
104
+
105
+ #ifdef EXECUTION_HISTOGRAM
106
+ if (config -> admissions_percentile > 99 || config -> admissions_percentile < 50 ) {
107
+ fprintf (stderr , "admissions-percentile must be > 50 and <= 99 but was %u, defaulting to 70\n" ,
108
+ config -> admissions_percentile );
109
+ config -> admissions_percentile = 70 ;
110
+ }
111
+ #endif
112
+
113
+ #ifdef EXECUTION_REGRESSION
114
+ if (did_set [route_config_member_path_preprocess ] == false) {
115
+ fprintf (stderr , "model path_preprocess field is required. Put zero if just default preprocessing\n" );
116
+ return -1 ;
117
+ } else if (strcmp (config -> path_preprocess , "0" ) == 0 ) {
118
+ config -> path_preprocess = NULL ;
119
+ }
120
+
121
+ if (did_set [route_config_member_model_bias ] == false) {
122
+ fprintf (stderr , "model bias field is required\n" );
123
+ return -1 ;
124
+ }
125
+
126
+ if (did_set [route_config_member_model_scale ] == false) {
127
+ fprintf (stderr , "model scale field is required\n" );
128
+ return -1 ;
129
+ }
130
+
131
+ if (did_set [route_config_member_model_num_of_param ] == false) {
132
+ fprintf (stderr , "model num_of_param field is required\n" );
133
+ return -1 ;
134
+ }
135
+
136
+ if (did_set [route_config_member_model_beta1 ] == false) {
137
+ fprintf (stderr , "model beta1 field is required\n" );
138
+ return -1 ;
139
+ }
140
+
141
+ if (did_set [route_config_member_model_beta2 ] == false) {
142
+ fprintf (stderr , "model beta2 field is required. Put zero for just default preprocessing\n" );
143
+ return -1 ;
144
+ }
106
145
107
- #ifdef ADMISSIONS_CONTROL
108
- if (did_set [route_config_member_admissions_percentile ] == false) {
109
- fprintf (stderr , "admissions_percentile is required\n" );
146
+ if (config -> model_num_of_param < 1 ) {
147
+ fprintf (stderr , "model num_of_param must be at least 1 (just default preprocessing)\n" );
148
+ return -1 ;
149
+ } else if (config -> model_num_of_param == 1 ) {
150
+ if (config -> path_preprocess ) {
151
+ fprintf (stderr , "model_num_of_param cannot be 1 when using tenant preprocessing\n" );
110
152
return -1 ;
111
153
}
112
-
113
- if (config -> admissions_percentile > 99 || config -> admissions_percentile < 50 ) {
114
- fprintf (stderr , "admissions-percentile must be > 50 and <= 99 but was %u\n" ,
115
- config -> admissions_percentile );
154
+ if (config -> model_beta2 != 0 ) {
155
+ fprintf (stderr , "model beta2 must be zero for just default preprocessing\n" );
156
+ return -1 ;
157
+ }
158
+ } else {
159
+ /* For now we just support up to two params */
160
+ assert (config -> model_num_of_param == 2 );
161
+ if (config -> path_preprocess == NULL ) {
162
+ fprintf (stderr , "model_num_of_param cannot be more than 1 when just default preprocessing\n" );
116
163
return -1 ;
117
164
}
118
- #endif
119
165
}
120
-
166
+ #endif
121
167
return 0 ;
122
168
}
0 commit comments