@@ -102,9 +102,9 @@ class StopCriterionReached(Exception):
102
102
"block_size_x" ,
103
103
"block_size_y" ,
104
104
"block_size_z" ,
105
- "ngangs" ,
106
- "nworkers" ,
107
- "vlength" ,
105
+ # "ngangs",
106
+ # "nworkers",
107
+ # "vlength",
108
108
]
109
109
110
110
@@ -263,7 +263,7 @@ def check_restrictions(restrictions, params: dict, verbose: bool) -> bool:
263
263
# if it's a python-constraint, convert to function and execute
264
264
if isinstance (restrict , Constraint ):
265
265
restrict = convert_constraint_restriction (restrict )
266
- if not restrict (params .values ()):
266
+ if not restrict (list ( params .values () )):
267
267
valid = False
268
268
break
269
269
# if it's a string, fill in the parameters and evaluate
@@ -284,9 +284,15 @@ def check_restrictions(restrictions, params: dict, verbose: bool) -> bool:
284
284
# look up the selected parameters and their value
285
285
selected_params = dict ((key , params [key ]) for key in selected_params )
286
286
# call the restriction
287
- if not restrict (** selected_params ):
288
- valid = False
289
- break
287
+ if isinstance (restrict , Constraint ):
288
+ restrict = convert_constraint_restriction (restrict )
289
+ if not restrict (list (selected_params .values ())):
290
+ valid = False
291
+ break
292
+ else :
293
+ if not restrict (** selected_params ):
294
+ valid = False
295
+ break
290
296
# otherwise, raise an error
291
297
else :
292
298
raise ValueError (f"Unkown restriction type { type (restrict )} ({ restrict } )" )
@@ -884,6 +890,7 @@ def is_or_evals_to_number(s: str) -> Optional[Union[int, float]]:
884
890
except Exception :
885
891
# it's not a solvable subexpression, return None
886
892
return None
893
+
887
894
888
895
# either the left or right side of the equation must evaluate to a constant number
889
896
left_num = is_or_evals_to_number (left )
@@ -998,6 +1005,9 @@ def to_equality_constraint(restriction: str, params: list[str]) -> Optional[Unio
998
1005
params_used = list (params_used )
999
1006
finalized_constraint = None
1000
1007
if try_to_constraint and " or " not in res and " and " not in res :
1008
+ # if applicable, strip the outermost round brackets
1009
+ while parsed_restriction [0 ] == '(' and parsed_restriction [- 1 ] == ')' and '(' not in parsed_restriction [1 :] and ')' not in parsed_restriction [:1 ]:
1010
+ parsed_restriction = parsed_restriction [1 :- 1 ]
1001
1011
# check if we can turn this into the built-in numeric comparison constraint
1002
1012
finalized_constraint = to_numeric_constraint (parsed_restriction , params_used )
1003
1013
if finalized_constraint is None :
@@ -1052,8 +1062,15 @@ def compile_restrictions(restrictions: list, tune_params: dict, monolithic = Fal
1052
1062
# return the restrictions and used parameters
1053
1063
if len (restrictions_ignore ) == 0 :
1054
1064
return compiled_restrictions
1055
- restrictions_ignore = list (zip (restrictions_ignore , (() for _ in restrictions_ignore )))
1056
- return restrictions_ignore + compiled_restrictions
1065
+
1066
+ # use the required parameters or add an empty tuple for unknown parameters of ignored restrictions
1067
+ noncompiled_restrictions = []
1068
+ for r in restrictions_ignore :
1069
+ if isinstance (r , tuple ) and len (r ) == 2 and isinstance (r [1 ], (list , tuple )):
1070
+ noncompiled_restrictions .append (r )
1071
+ else :
1072
+ noncompiled_restrictions .append ((r , ()))
1073
+ return noncompiled_restrictions + compiled_restrictions
1057
1074
1058
1075
1059
1076
def process_cache (cache , kernel_options , tuning_options , runner ):
0 commit comments