Skip to content

fix: parse rocm714 legacy variants as rocm 7.14 - #996

Merged
drbh merged 3 commits into
mainfrom
fix-rocm-legacy-variant-parse
Nov 12, 2026
Merged

drbh merged 3 commits into
mainfrom
fix-rocm-legacy-variant-parse

Conversation

@drbh

@drbh drbh commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

this pr fixes #995

the legacy backend regexes now use named major/minor captures and rocm special cases 7.14 (rocm(?P<major>7(?=14$)|\d+)(?P<minor>\d+)), so rocm714 parses as 7.14 and every other version keeps the old split

resolve_local_kernel also keeps the rejection reasons from every pass, previously the build/ pass replaced them with an empty trace

note: the named captures came out of review so the 7.14 special case reads explicitly. it uses a lookahead since python re does not allow the same group name twice in an alternation. this only matters for 7.14 since kernel-builder builds no other two-digit minor, the dotted format from #985 avoids it going forward

another note: the trace change is not needed for the parse fix, it only changes the error message. without it the ci error ended in an empty list instead of the rocm version rejection, which is what made this hard to track down

new cases in test_parse_backend_formats and a regression test for the trace, both fail without the fix

Signed-off-by: David Holtz <david.richard.holtz@gmail.com>
@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.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Coverage report — kernels/

Measured on: Python 3.10 / Torch 2.13.0.
Other CI configurations are not included in this number.
Hardware-gated code paths (ROCm/XPU/NPU/Darwin/Windows) are excluded or unreachable on the Linux+CUDA runner.

Total coverage: 90.2% — threshold: 80% — ✅

Per-file breakdown
Name Stmts Miss Cover Missing
src/kernels/__init__.py 14 0 100%
src/kernels/_system.py 6 1 83% 10
src/kernels/_versions.py 130 14 89% 53, 59-60, 63-64, 102, 165-170, 199, 219
src/kernels/archs.py 56 1 98% 94
src/kernels/backends.py 252 47 81% 43, 103, 163, 172, 181, 206, 215, 224, 248, 295, 311, 315, 319-344, 352, 375-395
src/kernels/compat.py 9 1 89% 5
src/kernels/deps.py 70 1 99% 56
src/kernels/digest.py 58 5 91% 71-73, 136-137
src/kernels/hf_hub.py 62 2 97% 21, 23
src/kernels/importer.py 74 5 93% 158, 162, 165, 179-180
src/kernels/install.py 21 7 67% 76-100
src/kernels/layer/__init__.py 7 0 100%
src/kernels/layer/_interval_tree.py 103 4 96% 23, 52, 147, 150
src/kernels/layer/device.py 48 12 75% 42, 47-49, 91, 96-98, 101, 149, 152, 156
src/kernels/layer/func.py 93 5 95% 94, 119, 195, 315, 390
src/kernels/layer/globals.py 5 0 100%
src/kernels/layer/inspect.py 27 0 100%
src/kernels/layer/kernelize.py 84 6 93% 306, 314-315, 328, 344-346
src/kernels/layer/layer.py 326 14 96% 212, 259, 447, 608-609, 630, 638, 649, 690, 694, 707, 762, 803, 885
src/kernels/layer/mode.py 14 0 100%
src/kernels/layer/repos.py 136 36 74% 32, 35-42, 73, 86, 90, 99-100, 103, 106-109, 116-117, 120, 123-126, 133-134, 137, 140-143, 150-151, 154, 157-160, 235
src/kernels/load.py 71 2 97% 338, 378
src/kernels/locking.py 89 64 28% 35-83, 91-98, 102-125, 137, 152-159, 165-175, 179-186
src/kernels/python_deps.py 58 6 90% 59-60, 64-65, 101, 104
src/kernels/resolver.py 164 1 99% 250
src/kernels/status.py 50 2 96% 25, 79
src/kernels/validate.py 104 7 93% 9, 101, 172, 195-196, 232-233
src/kernels/variants.py 424 11 97% 217, 249, 501-502, 544-547, 549, 728-734
src/kernels/verify.py 102 6 94% 44, 176-178, 266-267
TOTAL 2657 260 90%

Updated by the Test kernels workflow on commit b00e94671eb74fd969960238fd7c86512461fe8e.

Comment thread kernels/src/kernels/backends.py Outdated
Comment on lines +187 to +190
# Legacy variant string: `rocmxy`, new variant string: `rocm-x.y`. The
# legacy major is one digit, or two starting with 1, so that `rocm714` is
# 7.14 and `rocm100` is 10.0.
_LEGACY_VARIANT_REGEX: ClassVar[re.Pattern] = re.compile(r"rocm(1\d|[2-9])(\d+)")

@danieldk danieldk Nov 12, 2026 •

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.

This breaks if they go to 20.something. Maybe we should switch to named captures for the legacy backend regexes, so that we can special-case 7.14?

@drbh drbh Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

good point, I updated it to special case 7.14 with a lookahead rocm(7(?=14$)|\d+)(\d+) so everything else keeps the old split (rocm200 is 20.0, added a test for it). the groups stay positional so I didnt need named captures, but happy to switch the legacy regexes over if that is a better approach!

@drbh drbh Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

update: decided to go with the named captures, the legacy backend regexes now use major/minor groups and rocm keeps the 7.14 special case rocm(?P<major>7(?=14$)|\d+)(?P<minor>\d+)

drbh added 2 commits November 12, 2026 11:52
Signed-off-by: David Holtz <david.richard.holtz@gmail.com>
Signed-off-by: David Holtz <david.richard.holtz@gmail.com>
@drbh
drbh merged commit cdc61b2 into main Nov 12, 2026
58 checks passed
@sayakpaul
sayakpaul deleted the fix-rocm-legacy-variant-parse branch November 13, 2026 02:46
drbh added a commit to huggingface/kernels-community that referenced this pull request Nov 13, 2026
…1328)

this pr fixes the nix install in `test-kernel-rocm`
https://github.com/huggingface/kernels-community/actions/runs/43093355445/job/130795729876

tldr; the action restores its cached `nix-installer` owned by uid 1001
with mode `0110`, so its executable check fails as root in the
container. `TAR_OPTIONS: --no-same-owner` restores it as root and keeps
the cache

note: kernels need `python3 scripts/update_flakes.py <kernel>` to pick
up huggingface/kernels#996 before their rocm
tests pass

verified on the mi300 with activation bumped to kernels main,
`torch215-rocm714` loads and passes
https://github.com/huggingface/kernels-community/actions/runs/43285735858

Signed-off-by: David Holtz <david.richard.holtz@gmail.com>
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.

rocm714 variants parse as rocm 71.4

3 participants