From f571b275773aeb28a88389c33fc12faebe7183d7 Mon Sep 17 00:00:00 2001 From: Andrei Onel Date: Wed, 14 Jan 2026 18:46:50 +0000 Subject: [PATCH 1/2] Update docs/source/layers.md --- docs/source/layers.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/docs/source/layers.md b/docs/source/layers.md index 99629e8..d629f8d 100644 --- a/docs/source/layers.md +++ b/docs/source/layers.md @@ -348,7 +348,7 @@ a kernel to a range of ROCm capabilities. ### Loading from a local repository for testing -The `LocalLayerRepository` class is provided to load a repository from +The `LocalLayerRepository` class is provided to load a layer repository from a local directory. For example: ```python @@ -366,3 +366,28 @@ with use_kernel_mapping( ): kernelize(linear, mode=Mode.INFERENCE) ``` + +Similarly, `LocalFuncRepository` can be used to load a function repository from +a local directory for testing. This is useful when developing or testing kernel +functions locally before publishing them to the Hub: + +```python +with use_kernel_mapping( + { + "silu_and_mul": { + "cuda": LocalFuncRepository( + repo_path="/home/daniel/kernels/activation", + package_name="activation", + func_name="silu_and_mul", + ) + } + }, + inherit_mapping=False, +): + kernelize(model, mode=Mode.INFERENCE) +``` + +The parameters are: +- `repo_path`: Path to the local kernel repository directory +- `package_name`: The Python package name of the kernel +- `func_name`: The name of the function within the kernel repository From e9e0be6d96d0cd5944516cd894369abc8a07845f Mon Sep 17 00:00:00 2001 From: Andrei Onel Date: Thu, 15 Jan 2026 00:54:05 +0000 Subject: [PATCH 2/2] Update docs/source/locking.md --- docs/source/locking.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/source/locking.md b/docs/source/locking.md index cb4b125..0ad6f48 100644 --- a/docs/source/locking.md +++ b/docs/source/locking.md @@ -44,6 +44,28 @@ kernel_layer_mapping = { register_kernel_mapping(kernel_layer_mapping) ``` +### Locked kernel functions + +Locked functions can also be used with `LockedFuncRepository`. This is useful for stateless +layers or functions that were converted with `use_kernel_func_from_hub`: + +```python +from kernels import LockedFuncRepository, use_kernel_mapping + +kernel_func_mapping = { + "silu_and_mul": { + "cuda": LockedFuncRepository( + repo_id="kernels-community/activation", + func_name="silu_and_mul", + ) + } +} + +with use_kernel_mapping(kernel_func_mapping): + # Your model code here + model = kernelize(model, device="cuda", mode=Mode.INFERENCE) +``` + ## Pre-downloading locked kernels Locked kernels can be pre-downloaded by running `kernels download .` in your