Revisit which soft-preferences are global vs. per-package in packages.yaml
#31199
Closed
2 tasks done
packages.yaml
#31199
Summary
Currently, we can set soft-preferences for
version
,providers
,variants
,compiler
andtarget
inpackages.yaml
both under theall
attribute (which makes the prescription valid for any package) and under each specific package. The corresponding documentation is here. The proposal here is to change the semantic and allow:version
only under each packagetarget
,compiler
andproviders
only underall
variants
valid under both (details on the semantic to be defined)Rationale
Having all of the attributes allowed both under
all
and under each package name leads to semantic conflicts or to situations that make little sense. Forversion
, it is highly unlikely that:will ever make sense, since the versioning scheme is something that is tightly coupled to each package.
For
compiler
,providers
andtarget
there are currently questionable decisions in the solver on how to assign weights for the optimization. These decisions are forced to keep some backward compatibility with apackages.yaml
structure which might contain conflicts. An example tied totarget
is:spack/lib/spack/spack/solver/concretize.lp
Lines 782 to 791 in ec9803a
Note that a
packages.yaml
with conflicting choices can lead to unexpected behavior (e.g. if two transitive dependencies specify different compilers it's not clear which one will be picked by a common dependency of both). Complicating the weight structure can also lead to unexpected, and difficult to diagnose, performance regressions - like the one in #30997. If the soft preferences forcompiler
,target
andproviders
were always global, we could avoid workarounds and have a unique set of weights for each category. This will simplify the logic program and maybe (to be verified) speed-up the overall concretization process.Allowing
compiler
,providers
andtarget
to be global only can be complemented by adding the ability to specify hard-requirements inpackages.yaml
on a package-by-package base, similarly to what drafted in #27987Description
Description of a possible implementation is within the "Rationale" section. Still to be defined how, in case, we should deal with backward compatibility.
Additional information
For completeness, some issues with
compiler
andtarget
are also stemming from the decision to minimize mismatches at a higher priority than selecting the best compiler/target. I think this was the right decision, but it's worth pointing that out in case somebody wants to explore that part of the design space.General information
spack --version
and reported the version of SpackThe text was updated successfully, but these errors were encountered: