Skip to content

ASP-based solver: improve selection behavior for buildable externals#22566

Merged
becker33 merged 2 commits intospack:developfrom
alalazo:fixes/external_versions_buildable_true
Mar 29, 2021
Merged

ASP-based solver: improve selection behavior for buildable externals#22566
becker33 merged 2 commits intospack:developfrom
alalazo:fixes/external_versions_buildable_true

Conversation

@alalazo
Copy link
Copy Markdown
Member

@alalazo alalazo commented Mar 26, 2021

fixes #22565
fixes #22596

NOTE: REBASE AND MERGE INSTEAD OF SQUASH

This PR improves the handling of external specs by the clingo concretizer by making them always preferred to rebuilding, regardless of:

  • The version that was detected (may be older than latest version known to Spack)
  • The values of the variants, which may be different from the default

@alalazo alalazo added bugfix Something wasn't working, here's a fix concretization external-packages labels Mar 26, 2021
@alalazo alalazo closed this Mar 26, 2021
@alalazo alalazo reopened this Mar 26, 2021
@alalazo
Copy link
Copy Markdown
Member Author

alalazo commented Mar 26, 2021

Restarted after merging #22568

@alalazo alalazo marked this pull request as ready for review March 26, 2021 13:20
@alalazo alalazo requested a review from tgamblin March 26, 2021 13:20
@alalazo alalazo force-pushed the fixes/external_versions_buildable_true branch from ee006a3 to bc2f67d Compare March 29, 2021 13:25
@alalazo alalazo changed the title Enforce uniqueness of the version_weight atom per node ASP-based solver: improve selection behavior for buildable externals Mar 29, 2021
self.possible_versions[pkg.name], key=keyfn, reverse=True
)
# Compute which versions appear only in packages.yaml
from_packages_yaml = self.versions_in_packages_yaml[pkg.name]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this include versions set from

packages:
  foo:
    versions: [...]

If not, then I think we should rename the variables to be *from_externals instead of *from_packages_yaml.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it doesn't account for version preferences - only for versions of external specs that are unknown to Spack. I'll change the name accordingly.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed, rebased and pushed.

@alalazo alalazo force-pushed the fixes/external_versions_buildable_true branch from bc2f67d to 9884c88 Compare March 29, 2021 17:39
Copy link
Copy Markdown
Member

@becker33 becker33 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM

alalazo added 2 commits March 29, 2021 20:20
fixes spack#22565

This change enforces the uniqueness of the version_weight
atom per node(Package) in the DAG. It does so by applying
FTSE and adding an extra layer of indirection with the
possible_version_weight/2 atom.

Before this change it may have happened that for the same
node two different version_weight/2 were in the answer set,
each of which referred to a different spec with the same
version, and their weights would sum up.

This lead to unexpected result like preferring to build a
new version of an external if the external version was
older.
fixes spack#22596

Variants which are specified in an external spec are not
scored negatively if they encode a non-default value.
@alalazo alalazo force-pushed the fixes/external_versions_buildable_true branch from 9884c88 to a51635e Compare March 29, 2021 18:20
@becker33 becker33 enabled auto-merge (rebase) March 29, 2021 18:28
@becker33 becker33 merged commit 4079bbc into spack:develop Mar 29, 2021
@alalazo alalazo deleted the fixes/external_versions_buildable_true branch March 30, 2021 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Something wasn't working, here's a fix concretization external-packages

Projects

None yet

2 participants