Skip to content

nix-builder: add a hook to detect incorrect op registrations#569

Merged
danieldk merged 4 commits into
mainfrom
ops-names-check
May 19, 2026
Merged

nix-builder: add a hook to detect incorrect op registrations#569
danieldk merged 4 commits into
mainfrom
ops-names-check

Conversation

@danieldk
Copy link
Copy Markdown
Member

Also update the documentation to mention that ops should be prefixed with the correct name.

@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.

Copy link
Copy Markdown
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

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

Thanks. Just some nits.

But I don't see examples/kernels/silu-and-mul-bad-registration being used anywhere. Did we mean to include some checks against it in the CI?

Comment thread docs/source/builder/writing-kernels.md Outdated
Comment thread docs/source/builder/writing-kernels.md Outdated
@@ -0,0 +1,12 @@
import torch
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.

Very very good idea to include an example to test bad registration sites!

import sys
from pathlib import Path

TORCH_LIBRARY_DECORATORS = frozenset(
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.

For now, this is fine (as you also mentioned internally).

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
@danieldk
Copy link
Copy Markdown
Member Author

But I don't see examples/kernels/silu-and-mul-bad-registration being used anywhere. Did we mean to include some checks against it in the CI?

https://github.com/huggingface/kernels/pull/569/changes#diff-a9fac6739b3ed28b5afba5be10a701a956fc148443963e2216204f634f2ec6c4

Comment thread nix-builder/lib/checks.nix Outdated
Copy link
Copy Markdown
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

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

So cool!

@danieldk danieldk merged commit c90c2d1 into main May 19, 2026
69 of 70 checks passed
@danieldk danieldk deleted the ops-names-check branch May 19, 2026 16:10
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.

3 participants