llama-rs 0.16.1

A high-performance Rust implementation of llama.cpp - LLM inference engine with full GGUF support
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <metal_stdlib>
using namespace metal;

kernel void silu_f32(
    device const float* x [[buffer(0)]],
    device float* result [[buffer(1)]],
    constant int& n [[buffer(2)]],
    uint idx [[thread_position_in_grid]]
) {
    if (idx < uint(n)) {
        float val = x[idx];
        result[idx] = val / (1.0f + exp(-val));
    }
}