The llama.cpp project has consolidated its Metal backend's operation fusion patterns into a single table, shared by both the graph optimizer and op encoders. This change also corrects a bug in absolute output indices that was causing a ~5% regression in token generation speed.
- All fusable op patterns are now declared once in ggml-metal-fuse.cpp, ensuring consistency between optimization and compute phases.
- A fix for absolute graph node indices prevents the last node of fusion patterns from being incorrectly subjected to use-count checks, restoring norm/MUL fusion.
- New support allows gating_delta_net kernels to fuse with cache copy operations, writing snapshots directly into the KV cache buffer.
- The 'raw' fusion flag has been renamed to 'unsafe' to clarify that pattern-specific callbacks serve as the sole safety validator.
- A new ad-hoc API provides backend-agnostic fusion statistics for testing, including a regression test suite comparing fused and unfused logits via NMSE.
These updates improve code maintainability by unifying fusion logic and restore performance losses caused by silent fusion failures in previous versions.