P4C
The P4 Compiler
Loading...
Searching...
No Matches
power_spec.h
1
19#ifndef BACKENDS_TOFINO_BF_P4C_MAU_POWER_SPEC_H_
20#define BACKENDS_TOFINO_BF_P4C_MAU_POWER_SPEC_H_
21
33 public:
34 MauPowerSpec() {}
35
36 virtual double get_max_power() const = 0; // Value for all pipes.
41 virtual double get_excess_power_threshold() const = 0;
42 virtual double get_absolute_max_power_threshold() const = 0;
43
49 virtual double get_ram_scaling_factor() const = 0;
50 virtual double get_tcam_scaling_factor() const = 0;
51 virtual double get_voltage_scaling_factor() const = 0;
52 virtual double get_ram_read_power() const = 0;
53 virtual double get_ram_write_power() const = 0;
54 virtual double get_tcam_search_power() const = 0;
55 virtual double get_map_ram_read_power() const = 0;
56 virtual double get_map_ram_write_power() const = 0;
57 virtual double get_deferred_ram_read_power() const = 0;
58 virtual double get_deferred_ram_write_power() const = 0;
59
63 virtual int get_base_delay() const { return 20; }
64 virtual int get_base_predication_delay() const { return 11; }
65 virtual int get_tcam_delay() const { return 2; }
66 virtual int get_selector_delay() const { return 8; }
67 virtual int get_meter_lpf_delay() const { return 4; }
68 virtual int get_stateful_delay() const { return 4; }
69 virtual int get_mau_corner_turn_delay() const = 0;
70
74 virtual int get_concurrent_latency_contribution() const = 0;
75 virtual int get_action_latency_contribution() const { return 2; }
76
80 virtual int get_min_required_egress_mau_latency() const = 0;
81
88 virtual int get_deparser_max_phv_valid() const = 0;
89 virtual int get_cycles_to_issue_credit_to_pmarb() const = 0;
90 virtual int get_pmarb_cycles_from_receive_credit_to_issue_phv_to_mau() const = 0;
91};
92
94 public:
96
97 double get_max_power() const override { return 40.0; }
98 double get_excess_power_threshold() const override { return 10.0; }
99 double get_absolute_max_power_threshold() const override { return 22.0; }
100
106 double get_ram_scaling_factor() const override {
107 return 1.88574 * get_voltage_scaling_factor();
108 }
109 double get_tcam_scaling_factor() const override {
110 return 0.62736 * get_voltage_scaling_factor();
111 }
115 double get_voltage_scaling_factor() const override { return 1.0; }
116
117 // Power nos are for 1.27 GHz PPS (Clock freq of MAU)
118 double get_ram_read_power() const override { return 0.012771 * get_ram_scaling_factor(); }
119 double get_ram_write_power() const override { return 0.023419 * get_ram_scaling_factor(); }
120 double get_tcam_search_power() const override { return 0.0398 * get_tcam_scaling_factor(); }
121 double get_map_ram_read_power() const override { return 0.0025861 * get_ram_scaling_factor(); }
122 double get_map_ram_write_power() const override { return 0.0030107 * get_ram_scaling_factor(); }
123 double get_deferred_ram_read_power() const override {
124 return 0.0029238 * get_ram_scaling_factor();
125 }
126 double get_deferred_ram_write_power() const override {
127 return 0.0020185 * get_ram_scaling_factor();
128 }
129
130 int get_mau_corner_turn_delay() const override { return 4; }
131 int get_concurrent_latency_contribution() const override { return 1; }
132 int get_min_required_egress_mau_latency() const override { return 160; }
133
134 // For scaling MAU power based on deparser throttling.
136 return get_deparser_max_phv_valid() - get_cycles_to_issue_credit_to_pmarb() -
137 get_pmarb_cycles_from_receive_credit_to_issue_phv_to_mau();
138 }
139 int get_deparser_max_phv_valid() const override { return 288; }
140 int get_cycles_to_issue_credit_to_pmarb() const override { return 28; }
141 int get_pmarb_cycles_from_receive_credit_to_issue_phv_to_mau() const override { return 11; }
142};
143
150 public:
152
153 double get_max_power() const override { return 52.0; }
154 double get_excess_power_threshold() const override { return 10.0; }
155 double get_absolute_max_power_threshold() const override { return 10.0; }
156
162 double get_ram_scaling_factor() const override { return 1.0 * get_voltage_scaling_factor(); }
163 double get_tcam_scaling_factor() const override { return 1.0 * get_voltage_scaling_factor(); }
164 double get_voltage_scaling_factor() const override {
165 // The voltage the unit memory numbers are derived from.
166 double measured_voltage = 0.750; // in Volts
167 // TODO: Pass in a voltage as command line argument, and sanity check.
168 double user_voltage = 0.750; // in Volts
169 // Power consumption scales with difference in voltage from measured as:
170 // (V_user / V_meas)^2
171 return (user_voltage / measured_voltage) * (user_voltage / measured_voltage);
172 }
173
174 // Power nos are for 1.5 GHz PPS (Clock freq of MAU)
175 double get_ram_read_power() const override { return 0.0166 * get_ram_scaling_factor(); }
176 double get_ram_write_power() const override { return 0.0176 * get_ram_scaling_factor(); }
177 double get_tcam_search_power() const override { return 0.0185 * get_tcam_scaling_factor(); }
178 double get_map_ram_read_power() const override { return 0.0027 * get_ram_scaling_factor(); }
179 double get_map_ram_write_power() const override { return 0.0030 * get_ram_scaling_factor(); }
180 double get_deferred_ram_read_power() const override {
181 return 0.0025 * get_ram_scaling_factor();
182 }
183 double get_deferred_ram_write_power() const override {
184 return 0.0024 * get_ram_scaling_factor();
185 }
186
191 int get_mau_corner_turn_delay() const override { return 0; }
192
199 return get_action_latency_contribution();
200 }
201
205 int get_min_required_egress_mau_latency() const override { return 0; }
206
214 int get_deparser_throughput_scaling_starts() const override { return 600; }
215
220 int get_deparser_max_phv_valid() const override { return 0; }
221 int get_cycles_to_issue_credit_to_pmarb() const override { return 0; }
222 int get_pmarb_cycles_from_receive_credit_to_issue_phv_to_mau() const override { return 0; }
223};
224
225#if BAREFOOT_INTERNAL
226class JBayHMauPowerSpec : public JBayMauPowerSpec {
227 public:
228 JBayHMauPowerSpec() {}
229 double get_max_power() const override { return 15.6; } // scaled by stages
230};
231#endif /* BAREFOOT_INTERNAL */
232
234 public:
236 double get_max_power() const override { return 31.2; } // scaled by stages
237};
238
240 public:
242};
243
244#endif /* BACKENDS_TOFINO_BF_P4C_MAU_POWER_SPEC_H_ */
Definition power_spec.h:233
Definition power_spec.h:149
int get_deparser_max_phv_valid() const override
Definition power_spec.h:220
int get_concurrent_latency_contribution() const override
Definition power_spec.h:198
double get_excess_power_threshold() const override
Definition power_spec.h:154
int get_min_required_egress_mau_latency() const override
Definition power_spec.h:205
double get_ram_scaling_factor() const override
Definition power_spec.h:162
int get_deparser_throughput_scaling_starts() const override
Definition power_spec.h:214
int get_mau_corner_turn_delay() const override
Definition power_spec.h:191
Definition power_spec.h:239
Definition power_spec.h:32
virtual int get_concurrent_latency_contribution() const =0
virtual int get_base_delay() const
Definition power_spec.h:63
virtual int get_deparser_throughput_scaling_starts() const =0
virtual double get_ram_scaling_factor() const =0
virtual int get_min_required_egress_mau_latency() const =0
virtual double get_excess_power_threshold() const =0
Definition power_spec.h:93
double get_ram_scaling_factor() const override
Definition power_spec.h:106
int get_concurrent_latency_contribution() const override
Definition power_spec.h:131
double get_voltage_scaling_factor() const override
Definition power_spec.h:115
double get_excess_power_threshold() const override
Definition power_spec.h:98
int get_deparser_throughput_scaling_starts() const override
Definition power_spec.h:135
int get_min_required_egress_mau_latency() const override
Definition power_spec.h:132