/mach-ggml

Primary LanguageZigOtherNOASSERTION

mach/ggml: ggml using WebGPU compute

SUPER EXPERIMENTAL, not working yet.

Experimental

This is an experimental Mach library, according to our stability guarantees:

Experimental libraries may have their APIs change without much notice, and you may have to look at recent changes in order to update your code.

Why this library is not declared stable yet

Getting started

Adding dependency

Create a build.zig.zon file in your project (replace $LATEST_COMMIT with the latest commit hash):

.{
    .name = "mypkg",
    .version = "0.1.0",
    .dependencies = .{
        .mach_ggml = .{
            .url = "https://github.com/hexops/mach-ggml/archive/$LATEST_COMMIT.tar.gz",
        },
    },
}

Run zig build in your project, and the compiler instruct you to add a .hash = "..." field next to .url.

Then use the dependency in your build.zig:

...
pub fn build(b: *Build) void {
    ...
    exe.addModule("mach-ggml", b.dependency("mach_ggml", .{
        .target = target,
        .optimize = optimize,
    }).module("mach-ggml"));
}

You may then const ggml = @import("mach-ggml); and use it.

Usage

For usage, see example/main.zig

Developing

git clone https://github.com/hexops/mach-ggml
cd mach-ggml/
zig build run

example/main.zig contains a minimal example application which uses the mach-ggml library; while src/ contains the mach-ggml library itself.

Join the community

Join the Mach community on Discord to discuss this project, ask questions, get help, etc.

Issues

Issues are tracked in the main Mach repository.

Contributing

Contributions are very welcome. Pull requests must be sent to the main repository to avoid some complex merge conflicts we'd get by accepting contributions in both repositories. Once the changes are merged there, they'll get sync'd to this repository automatically.