Tighten topology and auto-high validation
This commit is contained in:
@@ -1755,31 +1755,23 @@ def _parallel_size_can_vary(study: StudySpec) -> bool:
|
||||
effective_gpu_count = _effective_gpu_count(study)
|
||||
if effective_gpu_count <= 1:
|
||||
return False
|
||||
constraints = study.engine.topology_constraints
|
||||
if constraints is not None and constraints.allowed_tp_dp_products:
|
||||
legal_products = {
|
||||
item for item in constraints.allowed_tp_dp_products if item <= effective_gpu_count
|
||||
}
|
||||
return len(legal_products) > 1
|
||||
if constraints is not None:
|
||||
tp_values = (
|
||||
constraints.allowed_tensor_parallel_sizes
|
||||
if constraints.allowed_tensor_parallel_sizes
|
||||
else [1, 2, 4, 8]
|
||||
)
|
||||
dp_values = (
|
||||
constraints.allowed_data_parallel_sizes
|
||||
if constraints.allowed_data_parallel_sizes
|
||||
else [1]
|
||||
)
|
||||
products = {
|
||||
int(tp) * int(dp)
|
||||
for tp in tp_values
|
||||
for dp in dp_values
|
||||
if int(tp) > 0 and int(dp) > 0 and int(tp) * int(dp) <= effective_gpu_count
|
||||
}
|
||||
return len(products) > 1
|
||||
return True
|
||||
base = _normalized_topology_flags(study.engine.base_flags)
|
||||
legal = _legal_topology_points(
|
||||
study,
|
||||
current_tp=int(base["tensor-parallel-size"]),
|
||||
current_dp=int(base["data-parallel-size"]),
|
||||
current_ep=int(base["expert-parallel-size"]),
|
||||
current_enable_ep=bool(base["enable-expert-parallel"]),
|
||||
)
|
||||
signatures: set[str] = set()
|
||||
for point in legal:
|
||||
patch = _topology_patch(study, point)
|
||||
flags = {**study.engine.base_flags, **patch}
|
||||
normalized = _normalized_topology_flags(flags)
|
||||
if any(normalized.get(key) != point.get(key) for key in point):
|
||||
continue
|
||||
signatures.add(_config_signature({"env_patch": {}, "flag_patch": patch}))
|
||||
return len(signatures) > 1
|
||||
|
||||
|
||||
def _score_topology_candidate(
|
||||
|
||||
@@ -381,6 +381,9 @@ def resolve_auto_high_search(
|
||||
return search, evidence
|
||||
ceiling = min(float(policy.max_sampling_u), 1.0, float(trace_max_sampling_u))
|
||||
evidence["effective_ceiling"] = ceiling
|
||||
if ceiling < float(search.low):
|
||||
evidence["reason"] = "auto_high_ceiling_below_search_low"
|
||||
return search, evidence
|
||||
if abs(float(search.high) - ceiling) <= 1e-12:
|
||||
evidence["reason"] = "search_high_already_at_auto_high_ceiling"
|
||||
return search, evidence
|
||||
|
||||
Reference in New Issue
Block a user