Instructions to use replicate/gpt-oss-metal-kernels with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Kernels
How to use replicate/gpt-oss-metal-kernels with Kernels:
# !pip install kernels from kernels import get_kernel # a version (or an explicit revision) is required; see the "Files and versions" tab for the available ones kernel = get_kernel("replicate/gpt-oss-metal-kernels", version=1) - Notebooks
- Google Colab
- Kaggle
Download gptoss_kernels/source/include/internal/math.h from replicate/gpt-oss-metal-kernels: direct link, hf CLI and curl.
- Browser
- Download file 920 Bytes
-
https://huggingface.co/replicate/gpt-oss-metal-kernels/resolve/main/gptoss_kernels/source/include/internal/math.h
- Command line
-
hf download hf://replicate/gpt-oss-metal-kernels/gptoss_kernels/source/include/internal/math.h
-
curl -L -o math.h https://huggingface.co/replicate/gpt-oss-metal-kernels/resolve/main/gptoss_kernels/source/include/internal/math.h
920 Bytes
| inline static size_t math_ceil_div(size_t numer, size_t denom) { | |
| return (numer + denom - 1) / denom; | |
| } | |
| inline static size_t math_max(size_t a, size_t b) { | |
| return a >= b ? a : b; | |
| } | |
| inline static size_t math_min(size_t a, size_t b) { | |
| return a < b ? a : b; | |
| } | |
| inline static size_t math_sub_sat(size_t a, size_t b) { | |
| return a > b ? a - b : 0; | |
| } | |
| static size_t math_round_down_po2(size_t number, size_t multiple) { | |
| assert(multiple != 0); | |
| assert((multiple & (multiple - 1)) == 0); | |
| return number & -multiple; | |
| } | |
| static size_t math_round_up_po2(size_t number, size_t multiple) { | |
| assert(multiple != 0); | |
| assert((multiple & (multiple - 1)) == 0); | |
| const size_t multiple_mask = multiple - 1; | |
| if ((number & multiple_mask) != 0) { | |
| number |= multiple_mask; | |
| number += 1; | |
| } | |
| return number; | |
| } | |