ollama/llama
Jeffrey Morgan ef00199fb4
Update vendor ggml code to a5bb8ba4 (#13832)
Co-authored-by: Daniel Hiltgen <daniel@ollama.com>
Co-authored-by: Gabe Goodhart <ghart@us.ibm.com>
Co-authored-by: Shalini Salomi Bodapati <Shalini.Salomi.Bodapati@ibm.com>
2026-02-02 17:31:59 -08:00
..
llama.cpp Update vendor ggml code to a5bb8ba4 (#13832) 2026-02-02 17:31:59 -08:00
patches Update vendor ggml code to a5bb8ba4 (#13832) 2026-02-02 17:31:59 -08:00
.gitignore Re-introduce the llama package (#5034) 2024-10-08 08:53:54 -07:00
build-info.cpp Update vendor ggml code to a5bb8ba4 (#13832) 2026-02-02 17:31:59 -08:00
build-info.cpp.in chore: update gitattributes (#8860) 2025-02-05 16:37:18 -08:00
llama.go GGML update to ec98e2002 (#13451) 2025-12-17 13:13:55 -08:00
llama_test.go llama: test case typo and readability improvements (#13078) 2025-11-15 18:54:27 -08:00
README.md Update vendor ggml code to a5bb8ba4 (#13832) 2026-02-02 17:31:59 -08:00
sampling_ext.cpp Update vendor ggml code to a5bb8ba4 (#13832) 2026-02-02 17:31:59 -08:00
sampling_ext.h api: remove unused sampling parameters (#10581) 2025-05-08 08:31:08 -07:00

llama

This package provides Go bindings to llama.cpp.

Vendoring

Ollama vendors llama.cpp and ggml. While we generally strive to contribute changes back upstream to avoid drift, we carry a small set of patches which are applied to the tracking commit.

If you update the vendoring code, start by running the following command to establish the tracking llama.cpp repo in the ./vendor/ directory.

make -f Makefile.sync apply-patches

Updating Base Commit

To update to a new base commit:

  1. Update FETCH_HEAD in Makefile.sync to the new commit hash.

  2. Check for upstreamed patches: Before applying, review if any patches have been merged upstream. Remove those patches from ./patches/ to avoid conflicts.

  3. Apply patches:

    make -f Makefile.sync apply-patches
    
  4. Resolve conflicts (if any): When git am fails on a patch:

    • Fix conflicts in ./vendor/
    • Stage the resolved files: git -C llama/vendor add <file>
    • Continue: git -C llama/vendor am --continue
    • Re-run: make -f Makefile.sync apply-patches
    • Repeat until all patches are applied.
  5. Regenerate patches and sync:

    make -f Makefile.sync format-patches sync
    

Generating Patches

When working on new fixes or features that impact vendored code, use the following model. First get a clean tracking repo with all current patches applied:

make -f Makefile.sync clean apply-patches

Iterate until you're ready to submit PRs. Once your code is ready, commit a change in the ./vendor/ directory, then generate the patches for ollama with

make -f Makefile.sync format-patches

In your ./vendor/ directory, create a branch, and cherry-pick the new commit to that branch, then submit a PR upstream to llama.cpp.

Commit the changes in the ollama repo and submit a PR to Ollama, which will include the vendored code update with your change, along with the patches.

After your PR upstream is merged, follow the Updating Base Commit instructions above, however first remove your patch before running apply-patches since the new base commit contains your change already.