@@ -100,11 +100,18 @@ def setup(self, config):
100100 )
101101 self .step_ = 0
102102 self .variant = f"variant-{ self .__class__ .__name__ } -{ self .trial_id } -or"
103+ # Do a valid config check here, since we still have the config in a
104+ # dict vs. having to scan through the parameter string later
105+ self .is_valid_config = self ._is_valid_config (config )
103106
104107 def step (self ):
105108 """
106109 Run step experiment and compute its score.
107110 """
111+
112+ # if not a valid config, then don't run and pass back an error
113+ if not self .is_valid_config :
114+ return {METRIC : ERROR_METRIC , "effective_clk_period" : "-" , "num_drc" : "-" }
108115 self ._variant = f"{ self .variant } -{ self .step_ } "
109116 metrics_file = openroad (
110117 args = args ,
@@ -142,6 +149,32 @@ def evaluate(self, metrics):
142149 score = score * (100 / self .step_ ) + gamma * num_drc
143150 return (score , effective_clk_period , num_drc )
144151
152+ def _is_valid_config (self , config ):
153+ """
154+ Checks dependent parameters and returns False if we violate
155+ a dependency. That way, we don't end up running an incompatible run
156+ """
157+
158+ ret_val = True
159+ ret_val &= self ._is_valid_padding (config )
160+ return ret_val
161+
162+ def _is_valid_padding (self , config ):
163+ """Returns True if global padding >= detail padding"""
164+
165+ if (
166+ "CELL_PAD_IN_SITES_GLOBAL_PLACEMENT" in config
167+ and "CELL_PAD_IN_SITES_DETAIL_PLACEMENT" in config
168+ ):
169+ global_padding = config ["CELL_PAD_IN_SITES_GLOBAL_PLACEMENT" ]
170+ detail_padding = config ["CELL_PAD_IN_SITES_DETAIL_PLACEMENT" ]
171+ if global_padding < detail_padding :
172+ print (
173+ f"[WARN TUN-0032] CELL_PAD_IN_SITES_DETAIL_PLACEMENT cannot be greater than CELL_PAD_IN_SITES_GLOBAL_PLACEMENT: { detail_padding } { global_padding } "
174+ )
175+ return False
176+ return True
177+
145178
146179class PPAImprov (AutoTunerBase ):
147180 """
0 commit comments