Skip to content

Remove compatible variant enumeration, add decision trace - #561

Merged
danieldk merged 3 commits into
mainfrom
variant-decision-trace
May 18, 2026
Merged

danieldk merged 3 commits into
mainfrom
variant-decision-trace

Conversation

@danieldk

Copy link
Copy Markdown
Member

We added support for enumerating variants that are compatible with the system. However, this has the issue that it is nearly impossible to make the enumeration exhaustive (e.g. because we have fallback from backend versions) and it is easy to miss variants.

As discussed on Slack, it would be better to instead have an explanation/decision trace on why the available variants were rejected. This PR add such traces and hooks them up in kernels versions and some error messages.

Fixes #436.

We added support for enumerating variants that are compatible with the
system. However, this has the issue that it is nearly impossible to make
the enumeration exhaustive (e.g. because we have fallback from backend
versions) and it is easy to miss variants.

As discussed on Slack, it would be better to instead have an
explanation/decision trace on why the available variants were rejected.
This PR add such traces and hooks them up in `kernels versions` and some
error messages.

Fixes #436.
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@danieldk

Copy link
Copy Markdown
Member Author

API changes are expected (so the CI fails for that reason), they are not public symbols anyway.

Comment thread kernels/src/kernels/variants.py Resolved
def test_resolve_cuda_no_different_major_no_noarch():
# 11.8 has a different major, so there is no compatible fallback.
result = _resolve_variant_for_system(
result, trace = _resolve_variant_for_system(

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.

I think the tests should also assert again trace so that we know they emit what's expected.

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.

But how do we know what is expected? It depends on what system the tests are run on. I think the most we can do is that result is the same set as accepted inside the trace. I'll add that.

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.

Yeah that should suffice.

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.

Added the following: the accepted variants in the trace must be equal to the returned variants. The variants in the trace (accepted and rejected) must be the same set as the input.

@sayakpaul sayakpaul left a comment

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.

Thanks for this massive user improvement!

@danieldk
danieldk merged commit 56bcdee into main May 18, 2026
66 of 69 checks passed
@danieldk
danieldk deleted the variant-decision-trace branch May 18, 2026 13:48
sayakpaul pushed a commit that referenced this pull request May 19, 2026
* Remove compatible variant enumeration, add decision trace

We added support for enumerating variants that are compatible with the
system. However, this has the issue that it is nearly impossible to make
the enumeration exhaustive (e.g. because we have fallback from backend
versions) and it is easy to miss variants.

As discussed on Slack, it would be better to instead have an
explanation/decision trace on why the available variants were rejected.
This PR add such traces and hooks them up in `kernels versions` and some
error messages.

Fixes #436.

* Fix overeager sed

* Additional trace assertions

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider removing variant enumeration again and instead explain why each available are not compatible

3 participants