Skip to content

Conversation

@ggerganov
Copy link
Member

@ggerganov ggerganov commented Sep 14, 2025

Major refactoring of the Metal backend to make the implementation safer and more manageable:

  • Add ggml-metal-device.h and move device code there
  • Add ggml-metal-context.h and move backend context code there
  • Migrate most kernels to inference-time compilation
  • Split ggml_metal_encode_node into per-op functions and move them to separate sources
  • Apply typedef struct ggml_mem_ranges * ggml_mem_ranges_t;

@github-actions github-actions bot added ggml changes relating to the ggml tensor library for machine learning Apple Metal https://en.wikipedia.org/wiki/Metal_(API) devops improvements to build systems and github actions labels Sep 14, 2025
@ggerganov ggerganov force-pushed the gg/metal-refactor-and-optimize-v2 branch 3 times, most recently from c02fbab to 9b0d50c Compare September 16, 2025 12:56
@github-actions github-actions bot added the testing Everything test related label Sep 16, 2025
@ggerganov ggerganov force-pushed the gg/metal-refactor-and-optimize-v2 branch from a771b14 to 716a3d3 Compare September 16, 2025 18:25
@ggerganov ggerganov marked this pull request as ready for review September 16, 2025 21:01
@ggerganov ggerganov force-pushed the gg/metal-refactor-and-optimize-v2 branch from b01f087 to bef9295 Compare September 16, 2025 21:10
@ggerganov ggerganov merged commit 0320ac5 into master Sep 17, 2025
53 of 54 checks passed
@ggerganov ggerganov deleted the gg/metal-refactor-and-optimize-v2 branch September 17, 2025 17:38
yael-works pushed a commit to yael-works/llama.cpp that referenced this pull request Oct 15, 2025
* metal : improve naming

* metal : refactor device

ggml-ci

* cont : props

ggml-ci

* metal : apply ggml_mem_ranges_t

ggml-ci

* metal : remove GGML_METAL_USE_BF16

ggml-ci

* metal : refactor device buffer

ggml-ci

* cont : fix naming

* metal : sync before destroying the backend

ggml-ci

* metal : refactor context

ggml-ci

* metal : migrate ggml-metal.m to ggml-metal.cpp

ggml-ci

* metal : adjust ops API

ggml-ci

* metal : use C++ to store piplienes

ggml-ci

* metal : migrate ops to separate functions

ggml-ci

* metal : add ggml_metal_library_t

ggml-ci

* metal : improve naming

ggml-ci

* metal : cleanp

ggml-ci

* metal : add support for GGML_OP_LOG

ggml-ci

* metal : fix error handling

ggml-ci
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Apple Metal https://en.wikipedia.org/wiki/Metal_(API) devops improvements to build systems and github actions ggml changes relating to the ggml tensor library for machine learning testing Everything test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants