]> git.djapps.eu Git - pkg/ggml/sources/ggml/log
pkg/ggml/sources/ggml
3 weeks agovulkan: fix command buffer corruption in ggml_backend_vk_event_wait (llama/18302)
Jeff Bolz [Wed, 24 Dec 2025 11:36:34 +0000 (05:36 -0600)]
vulkan: fix command buffer corruption in ggml_backend_vk_event_wait (llama/18302)

3 weeks agoCANN : refactor ACL graph cache (llama/17752)
Wang Weixuan [Wed, 24 Dec 2025 09:50:24 +0000 (17:50 +0800)]
CANN : refactor ACL graph cache (llama/17752)

Move the graph property checking code into methods of LRU cache.

Signed-off-by: Wang Weixuan <redacted>
3 weeks agovulkan: use fewer FA rows for small cache runs (llama/18280)
Ruben Ortlam [Wed, 24 Dec 2025 07:59:14 +0000 (08:59 +0100)]
vulkan: use fewer FA rows for small cache runs (llama/18280)

3 weeks agoCANN: Uses yarn_ramp cache in ROPE (llama/17725)
TianHao324 [Wed, 24 Dec 2025 06:55:33 +0000 (14:55 +0800)]
CANN: Uses yarn_ramp cache in ROPE (llama/17725)

3 weeks agorpc : add check for rpc buffer type (llama/18242)
Chris Rohlf [Tue, 23 Dec 2025 09:56:49 +0000 (04:56 -0500)]
rpc : add check for rpc buffer type (llama/18242)

3 weeks agoggml-hexagon: create generalized functions for cpu side op (llama/17500)
nullname [Tue, 23 Dec 2025 07:13:24 +0000 (15:13 +0800)]
ggml-hexagon: create generalized functions for cpu side op (llama/17500)

* refactor: replace ggml_hexagon_mul_mat with template-based binary operation for improved flexibility

* refactor: replace ggml_hexagon_mul_mat_id with template-based binary operation for improved flexibility

* refactor: initialize buffer types and streamline dspqueue_buffers_init calls for clarity

* add comment

* refactor: remove redundant buffer checks in hexagon supported operations

* wip

* add missing include to fix weak symbol warning

* add ggml_hexagon_op_generic

* refactor: simplify tensor operation initialization and buffer management in hexagon implementation

* refactor: streamline hexagon operation initialization and buffer management

* refactor: update function signatures and streamline request handling in hexagon operations

* wip

* ggml-hexagon: clean up code formatting and improve unary operation handling

* wip

* rename

* fix: add support for permuted F16 tensors and enhance quantization checks in matrix operations

* refactor: replace ggml_hexagon_mul_mat with template-based binary operation for improved flexibility

refactor: replace ggml_hexagon_mul_mat_id with template-based binary operation for improved flexibility

refactor: initialize buffer types and streamline dspqueue_buffers_init calls for clarity

refactor: remove redundant buffer checks in hexagon supported operations

add missing include to fix weak symbol warning

add ggml_hexagon_op_generic

refactor: simplify tensor operation initialization and buffer management in hexagon implementation

refactor: streamline hexagon operation initialization and buffer management

refactor: update function signatures and streamline request handling in hexagon operations

ggml-hexagon: clean up code formatting and improve unary operation handling

fix: add support for permuted F16 tensors and enhance quantization checks in matrix operations

# Conflicts:
# ggml/src/ggml-hexagon/ggml-hexagon.cpp

* hexagon: fix merge conflicts

* hexagon: minor cleanup for buffer support checks

* hexagon: factor out op_desc and the overal op logging

* hexagon: further simplify and cleanup op dispatch logic

* snapdragon: update adb scripts to use llama-cli and llama-completion

* fix pipeline failure

---------

Co-authored-by: Max Krasnyansky <redacted>
3 weeks agoggml-hexagon: gelu optimization (llama/18151)
Shouyu [Mon, 22 Dec 2025 18:56:52 +0000 (13:56 -0500)]
ggml-hexagon: gelu optimization (llama/18151)

* feat: working gelu with src0 put on vtcm

* feat: gelu ping-pong for both in and out

* fix: fixu compile error

* break: distinguish dma ddr->vtcm and vtcm->ddr operation

* fix: fix dma queue size

* break: update dma api to either pop src or dst ptr

* fix: fix activation vtcm allocation issue for src1 when swapperd

* refactor: ping-pong gelu logic to avoid unnecessary if else

* dma: improved queue interface and prefetch handling

* gelu: fix N+2 block prefetch

---------

Co-authored-by: Max Krasnyansky <redacted>
3 weeks agollamafile: add rvv support for sgemm kernels (llama/18199)
Taimur Ahmad [Mon, 22 Dec 2025 18:20:23 +0000 (23:20 +0500)]
llamafile: add rvv support for sgemm kernels (llama/18199)

Co-authored-by: Rehan Qasim <redacted>
3 weeks agoopencl: unpack q4_0 for adreno in get_tensor (llama/18278)
lhez [Mon, 22 Dec 2025 18:19:01 +0000 (10:19 -0800)]
opencl: unpack q4_0 for adreno in get_tensor (llama/18278)

3 weeks agovulkan: Extend rope fusions to allow mrope (llama/18264)
Jeff Bolz [Mon, 22 Dec 2025 17:03:13 +0000 (11:03 -0600)]
vulkan: Extend rope fusions to allow mrope (llama/18264)

Extend the test-backend-ops tests as well.

3 weeks agovulkan: Implement set_tensor_async and the event interfaces (llama/18047)
Jeff Bolz [Sun, 21 Dec 2025 20:52:09 +0000 (14:52 -0600)]
vulkan: Implement set_tensor_async and the event interfaces (llama/18047)

The goal is to enable the async loading code paths in
llama_model_loader::load_all_data, originally from #7896. This works and the
loads themselves are faster, but with host visible vidmem I think the cost of
allocating/mapping vidmem moves and becomes more expensive, and I don't see a
benefit by default. But with GGML_VK_DISABLE_HOST_VISIBLE_VIDMEM=1 I do see a
significant improvement in model loading time.

3 weeks agollama: fix RPC for -fit on (llama/18233)
Johannes Gäßler [Sun, 21 Dec 2025 18:33:08 +0000 (19:33 +0100)]
llama: fix RPC for -fit on (llama/18233)

3 weeks agovulkan: fix im2col overflowing maxworkgroupcount (llama/18180)
Jeff Bolz [Sun, 21 Dec 2025 09:32:58 +0000 (03:32 -0600)]
vulkan: fix im2col overflowing maxworkgroupcount (llama/18180)

3 weeks agovulkan/cuda: fix topk_moe with exp_probs_b (llama/18071)
Jeff Bolz [Sun, 21 Dec 2025 09:27:34 +0000 (03:27 -0600)]
vulkan/cuda: fix topk_moe with exp_probs_b (llama/18071)

I updated test_topk_moe to more closely match llm_graph_context::build_moe_ffn
and added coverage for exp_probs_b and some other missing combinations. This
exposed a bug in both CUDA and Vulkan backends where they were assuming the
input to argsort and the input to get_rows are the same. I'd like to optimize
this graph in another change, but for now just get it functional.

CUDA also had a bug where it got n_experts from the wrong place, leading to
GGML_ASSERT failures in some of the new tests.

3 weeks agovulkan: support GGML_UNARY_OP_XIELU (llama/18062)
Jeff Bolz [Sun, 21 Dec 2025 09:17:58 +0000 (03:17 -0600)]
vulkan: support GGML_UNARY_OP_XIELU (llama/18062)

3 weeks agovulkan: in graph_optimize, try to group ADD operations (llama/18060)
Jeff Bolz [Sun, 21 Dec 2025 09:05:08 +0000 (03:05 -0600)]
vulkan: in graph_optimize, try to group ADD operations (llama/18060)

I saw the adds not staying together in the new nemotron 3 nano model.

3 weeks agoVulkan: some improvement on mul_mat_iq2_xs (llama/18031)
lovedheart [Sun, 21 Dec 2025 08:59:52 +0000 (09:59 +0100)]
Vulkan: some improvement on mul_mat_iq2_xs (llama/18031)

* Some improvement on mul_mat_iq2_xs

Refactor calculations for db values and grid data to optimize performance and reduce redundancy.

* Fix trailing whitespace

3 weeks agotests: Avoid floating point precision false positives in SUM (llama/17471)
Jeff Bolz [Sat, 20 Dec 2025 19:46:46 +0000 (13:46 -0600)]
tests: Avoid floating point precision false positives in SUM (llama/17471)

* tests: Avoid floating point precision false positives in SUM

* also apply to test_mean

3 weeks agotest-backend-ops: improve msvc build time (llama/18209)
Jeff Bolz [Sat, 20 Dec 2025 19:45:45 +0000 (13:45 -0600)]
test-backend-ops: improve msvc build time (llama/18209)

3 weeks agoAdded comments explaining thread block size selection logic based on row count and...
Aadeshveer Singh [Sat, 20 Dec 2025 11:28:57 +0000 (16:58 +0530)]
Added comments explaining thread block size selection logic based on row count and column size, derived from historical commit context (llama/18212)

3 weeks agoggml-hexagon: Implement true Q8_0 quantization on Hexagon NPU for more accurate mixed...
Alfred [Fri, 19 Dec 2025 17:42:28 +0000 (12:42 -0500)]
ggml-hexagon: Implement true Q8_0 quantization on Hexagon NPU for more accurate mixed-precision matmul operations (llama/17977)

* feat: implement real Q8_0

* feat: adding cmake option for configuring FP32 quantize group size

* typo: set() shall be used

---------

Co-authored-by: ngdxzy <redacted>
3 weeks agovulkan: Add perf logger mode with concurrency (llama/17944)
Jeff Bolz [Fri, 19 Dec 2025 05:36:46 +0000 (23:36 -0600)]
vulkan: Add perf logger mode with concurrency (llama/17944)

This implements a variation of the perf logger where rather than timing each
operation individually with effectively a barrier in between, we put the
timing boundaries where we already synchronize and time the groups of work
that normally overlap. This can be useful to help understand whether
individual operations need to be optimized, or if the group is already running
efficiently.

GGML_VK_PERF_LOGGER_CONCURRENT=1 enables the new mode (when
GGML_VK_PERF_LOGGER is also set).

GGML_VK_SYNC_LOGGER=1 replaces the ENABLE_SYNC_LOGGING compile time switch.

3 weeks agomodel : add ASR support for LFM2-Audio-1.5B (conformer) (llama/18106)
Xuan-Son Nguyen [Thu, 18 Dec 2025 23:18:01 +0000 (00:18 +0100)]
model : add ASR support for LFM2-Audio-1.5B (conformer) (llama/18106)

* ASR with LFM2-Audio-1.5B

* Set rope_theta

* Fix comment

* Remove rope_theta setting

* Address PR feedback

* rename functions to conformer

* remove some redundant ggml_cont

* fix missing tensor

* add prefix "a." for conv tensors

* remove redundant reshape

* clean up

* add test model

---------

Co-authored-by: Tarek Dakhran <redacted>
3 weeks agoggml-cpu: extend support for RVV floating-point kernels (llama/17318)
Taimur Ahmad [Thu, 18 Dec 2025 14:02:09 +0000 (19:02 +0500)]
ggml-cpu: extend support for RVV floating-point kernels (llama/17318)

* cmake: add BF16 RVV flag for ggml-cpu

* ggml-cpu: add floating-point conversion kernels

* ggml: add floating-point kernels

Co-authored-by: Rehan Qasim <redacted>
* ggml-cpu: fix lmul in vec_dot_bf16

* ggml-cpu: change redsum to lmul 4, fix leftover

---------

Co-authored-by: Rehan Qasim <redacted>
3 weeks agoremove i_major_dual (llama/18157)
yulo [Thu, 18 Dec 2025 11:50:56 +0000 (19:50 +0800)]
remove i_major_dual (llama/18157)

Co-authored-by: zhang hui <redacted>
3 weeks agoggml-hexagon: swiglu_oai operation (llama/18114)
Shouyu [Wed, 17 Dec 2025 21:38:21 +0000 (16:38 -0500)]
ggml-hexagon: swiglu_oai operation (llama/18114)

* snapshot: debug ggml-hexagon swiglu-oai

* fix: fix hvx_min_scalar_f32

* feat: working swiglu-oai

* chore: fix formating isue

3 weeks agoggml-hexagon: gelu operation (llama/17921)
Shouyu [Wed, 17 Dec 2025 18:39:32 +0000 (13:39 -0500)]
ggml-hexagon: gelu operation (llama/17921)

* feat: inital support for gelu using sigmoid approximation

* snapshot: faster gelu using polynomial approximation

* test: disable l2-block prefetch in polynomail approximation

* Revert "test: disable l2-block prefetch in polynomail approximation"

This reverts commit 72339994d45b2bed887e79994403c378d90b62b5.

* Revert "snapshot: faster gelu using polynomial approximation"

This reverts commit 2a787a61d11f9e63e5943a2e6d134b2f0c402ace.

* debug: temporarily disable unnecessary log message for debug purpose

* Feat: optiized unaligned sigmoid_f32

* Feat: larger l2prefetch block

* feat: apply unaligned-load optimization on mul and mul_scalar

* Revert "debug: temporarily disable unnecessary log message for debug purpose"

This reverts commit 84f2f23aa9f17e2fa826db969cd825d0ab192995.

* refactor: cleanup commented unused code

* chore: reformat code with clang-formatter to pass cli test

* Revert "chore: reformat code with clang-formatter to pass cli test"

This reverts commit 952877ec24732b12010c7fa7ed3fc8de4b74e718.

* fix: fix loop overflow

* chore: fix formating ci error

3 weeks agoggml-cpu: ARM64: repack version of q8_0 (dotprod and i8mm) (llama/18096)
Alberto Cabrera Pérez [Wed, 17 Dec 2025 11:39:13 +0000 (11:39 +0000)]
ggml-cpu: ARM64: repack version of q8_0 (dotprod and i8mm) (llama/18096)

* wip: skeleton for q8_0 repack

* q8_0 repack GEMV implementations

* GEMM implementations

* Formatting

* Fixed format consistency of repack gemm and gemv declarations

* gemv and gemm generic location consistent with declarations

* Removed non-correct unused variables statements

* Cleanup, consistent style

* Missing generic fallbacks for x86 and powerpc

3 weeks agoHIP: Refactor mma for RDNA and CDNA (llama/17990)
yulo [Wed, 17 Dec 2025 08:34:54 +0000 (16:34 +0800)]
HIP: Refactor mma for RDNA and CDNA (llama/17990)

* mma.cuh for rdna4

* mma for rdna3

* mmq for rdna4

* mmq for rdna3

* align i-major and j-major

* cdna

* fix cuda error

* add missing tile of mfma

* fix j-major wrong ne on CDNA

* fix gramma and empty spaces

---------

Co-authored-by: zhang hui <redacted>
5 weeks agosync : llama.cpp upstream/0.9.4.395
Georgi Gerganov [Wed, 17 Dec 2025 08:16:23 +0000 (10:16 +0200)]
sync : llama.cpp

5 weeks agollama.android : Rewrite Android binding (w/o cpu_features dep) (llama/17413)
Naco Siren [Wed, 17 Dec 2025 08:14:47 +0000 (00:14 -0800)]
llama.android : Rewrite Android binding (w/o cpu_features dep) (llama/17413)

* UI: implement basic UI components

* util: implement performance monitor; wrap it with a viewmodel

* util: implement user preferences utility

* UI: implement core flow's screens

* UI: add a new MainActivity; update manifest

* [WIP] DI: implement simple local vm factory provider

* UI: disable triggering drawer via gesture; enable alert dialog on back navigation inside conversation and benchmark

* UI: allow drawer's gesture control only on Home and Settings screens; enable alert dialog on back navigation inside conversation and benchmark

* UI: split a nested parent settings screen into separate child settings screens

* UI: polish system prompt setup UI

* Deps: bump Kotlin plugin; introduce KSP; apply in :app subproject

* DB: setup Room database

* data: introduce repo for System Prompt; flow data from Room to VM

* bugfix: properly handle user's quitting conversation screen while tokens in generation

* UI: rename `ModeSelection` to `ModelLoading` for better clarity

* UI: update app name to be more Arm

* UI: polish conversation screen

* data: code polish

* UI: code polish

* bugfix: handle user quitting on model loading

* UI: locks user in alert dialog when model is unloading

* vm: replace token metrics stubs with actual implementation

* UI: refactor top app bars

* nit: combine temperatureMetrics and useFahrenheit

* DI: introduce Hilt plugin + processor + lib dependencies

* DI: make app Hilt injectable

* DI: make viewmodels Hilt injectable

* DI: replace manual DI with Hilt DI

* UI: optimize AppContent's composing

* bugfix: wait for model to load before navigating to benchmark screen; use NavigationActions instead of raw navController

* UI: navigation with more natural animated transitions

* DI: Optimize AppModule

* Feature: Introduce ModelRepository and ModelsManagementViewModel; update AppModule

* UI: polish UI for ModelsManagementScreen; inject ModelsManagementVieModel

* DI: abstract the protocol of SystemPromptRepository; update AppModule

* data: [WIP] prepare for ModelRepository refactor & impl

* data: introduce Model entity and DAO; update DI module

* UI: replace Models Management screen's stubbing with instrumentation

* UI: polish sort order menu

* data: import local model with file picker

* bugfix: use List instead of Collection for ModelDao's deletion

* data: add a util file for extracting file name & size and model metadata

* UI: enrich ModelManagementState; extract filename to show correct importing UI

* UI: implement multiple models deletion; update Models Management screen

* UI: handle back navigation when user is in multi-selection mode

* util: extract file size formatting into ModelUtils

* UI: add a confirmation step when user picks a file; refactor model import overlay into AlertDialog

* UI: extract a shared ModelCard component

* UI: replace model selection screen's data stubbing; add empty view

* nit: tidy SystemPromptViewModel

* Util: split FileUtils from ModelUtils; extract copy methods into FileUtils

* data: pass through getModelById from ModelDao into ModelRepository

* core: extract conversation and benchmark logics into InferenceManager; add logs and missing state updates in stub InferenceEngine

* vm: split mono MainViewModel into separate individual ViewModels

* vm: merge SystemPromptViewModel into ModelLoadingViewModel

* core: break down InferenceManager due to Interface Segregation Principle

* UI: show model card in Model Loading screen

* UI: show model card in Conversation screen

* UI: unify Model Card components

* core: swap in LLamaAndroid and mark stub engine for testing only

* data: allow canceling the ongoing model import

* UI: update UI ongoing model import's cancellation

* LLama: update engine state after handling the cancellation of sendUserPrompt

* VM: handle the cancellation of ongoing token generation

* LLama: refactor loadModel by splitting the system prompt setting into a separate method

* feature: check for available space before copying local model

* UI: centralize the AppScaffold and modularize its configs

* UI: refactor BottomBarConfig.ModelsManagement APIs

* UI: combine TopBarConfig and BottomBarConfig into each route's ScaffoldConfig

* UI: replace ugly optional as casts in AppScaffold with extension functions

* UI: fix the typo `totalGb` in `StorageMetrics`

* UI: remove code duplication in sort menu

* LLama: add ModelUnloadingState to engine State; add missing state checks in stub engine; fix instrumentation engine's error messages

* UI: refactor back handling by removing centralized BackHandlerSetup and UnloadModelConfirmationDialog from AppContent

* UI: implement BenchmarkScreen's individual back handling

* LLama: add a new Initializing state; ; add two extension properties; rename LibraryLoaded state to Initialized

* UI: Introduce an abstract ViewModel to handle additional model unloading logics

* UI: expose a single facade ModelUnloadDialogHandler; move UnloadModelState into ModelUnloadingViewModel.kt

* UI: migrate ModelLoadingScreen onto ModelLoadingViewModel; update & refine ModelLoadingScreen

* UI: migrate ConversationViewModel onto ModelLoadingViewModel; update & refine ConversationScreen

* nit: extract app name into a constant value; remove unused onBackPressed callbacks

* UI: update AppContent to pass in correct navigation callbacks

* nit: polish ModelLoadingScreen UI

* core: throw Exception instead of returning null if model fails to load

* navigation: sink model loading state management from AppContent down into ModelLoadingScreen; pass ModelLoadingMetrics to Benchmark and Conversation screens

* gguf: add GGUF metadata data holder and its corresponding extractor implementation

* DB: introduce Kotlin serialization extension's library and plugin; add Room runtime library

* GGUF: make GgufMetadata serializable in order to be compatible with Room

* nit: refactor data.local package structure

* nit: rename lastUsed field to dateLastUsed; add dateAdded field

* UI: refactor ModelCard UI to show GGUF metadata

* UI: update ModelSelectionScreen with a preselect mechanism

* UI: polish model card

* nit: allow deselect model on Model Selection screen

* nit: revert accidental committing of debug code

* UI: polish ModelLoading screen

* util: extract formatting helper functions from FileUtils into a new FormatUtils

* UI: polish model cards on Benchmark and Conversation screens to show model loading metrics

* UI: show a Snack bar to warn user that system prompt is not always supported

* UI: handle back press on Model Selection screen

* UI: finally support theme modes; remove hardcoded color schemes, default to dynamic color scheme implementation

* feature: support searching on Model Selection screen

* nit: move scaffold related UI components into a separate package

* UI: extract InfoView out into a separate file for reusability

* data: move Model related actions (query, filter, sort) into ModelInfo file

* UI: animate FAB on model preselection states

* feature: support filtering in Model Management screen

* ui: show empty models info in Model Management screen

* ui: add filter off icon to "Clear filters" menu item

* [WIP] ui: polish Benchmark screen; implement its bottom app bar

* ui: polish Benchmark screen; implement its bottom app bar's rerun and share

* nit: disable mode selection's radio buttons when loading model

* feature: implement Conversation screen's bottom app bar

* pkg: restructure BottomAppBars into separate files in a child package

* pkg: restructure TopBarApps into separate files in a child package

* pkg: restructure system metrics into a separate file

* UI: polish Conversation screen

* data: update system prompt presets

* UI: allow hide or show model card on Conversation & Benchmark screens; fix message arrangement

* data: update & enhance system prompt presets

* deps: introduce Retrofit2

* data: implement HuggingFace data model, data source with Retrofit API

* data: update Model data repository to support fetching HuggingFace models

* [WIP] UI: replace the HuggingFace stub in Model Management screen with actual API call

* UI: map language codes into country Emojis

* ui: add "clear results" action to Benchmark screen

* nit: print current pp & tg in llama-bench

* UI: disable landscape mode; prevent duplicated benchmark running

* llama: migrate C/CXX flags into CMakeList

* [WIP] llama: ABI split builds five .so artifacts.

However, all .so are performing on SVE level

* [WIP] llama: ABI split where five tiers are built sequentially.

* [WIP] llama: disable OpenMP in ABI split since most SoCs are big.LITTLE

* [WIP] llama: enable KleidiAI and disable tier 4 due to `+sve+sve2` bug caused by `ggml_add_cpu_backend_variant_impl` as explained below

```CMake
if (NOT SME_ENABLED MATCHES -1)
...
    set(PRIVATE_ARCH_FLAGS "-fno-tree-vectorize;${PRIVATE_ARCH_FLAGS}+sve+sve2")
...
```

* core: add Google's cpu_features as a submodule

* core: implement cpu_detector native lib

* core: swap out hardcoded LlamaAndroid library loading

* core: add back OpenMP due to huge perf loss on TG128

* misc: reorg the pkg structure

* misc: rename LlamaAndroid related class to InferenceEngine prefixes

* [WIP] lib: move GgufMetadata into the lib submodule

* lib: expose GgufMetadataReader as interface only

* lib: replace the naive & plain SharedPreferences with DataStore implementation

* lib: hide the internal implementations, only expose a facade and interfaces

* lib: expose Arm features

* di: add a stub TierDetection; provide both actual impl and stub in AppModule

* UI: add visualizer UI for Arm features

* misc: UI polish

* lib: refactored InferenceEngineLoader; added a `NONE` Llama Tier

* UI: support `NONE` Llama Tier in general settings

* lib: optimize engine loader; always perform a fresh detection when cache is null

* remote: add HuggingFaceModelDetails data class

* remote: refine HuggingFaceModel data class

* nit: remove `trendingScore` field from HuggingFace model entities, weird...

* remote: refactor HuggingFaceApiService; implement download feature in HuggingFaceRemoteDataSource

* remote: fix the incorrect parse of HuggingFace's inconsistent & weird JSON response

* UI: scaffold Models Management screen and view model

* UI: implement a dialog UI to show fetched HuggingFace models.

* UI: use a broadcast receiver to listen for download complete events and show local import dialog.

* data: handle network exceptions elegantly

* pkg: restructure `data`'s packages

* data: extract local file info, copy and cleanup logics into LocalFileDataSource

* nit: minor UI patch; add missing comments

* bugfix: tapping "Home" in navigation drawer should simply close it without any navigation action.

* UI: improve autoscroll during token generation

* lib: tested on JFrog Artifactory for Maven publishing

* UI: show RAM warning if model too large

* UI: polish model management screen's error dialog

* util: add more items into the mapping table of ISO 639-1 language code to ISO 3166-1 country code

* llm: properly propagate error to UI upon failing to load selected model

* UI: avoid duplicated calculation of token metrics

* lib: read & validate the magic number from the picked source file before executing the import

* UI: add "Learn More" hyperlinks to Error dialog upon model import failures

* lib: refactor the GgufMetadataReader to take  InputStream instead of absolute path as argument

* lib: fix the `SIMD` typo in Tier description

* core: verify model file path is readable

* lib: add UnsupportedArchitectureException for triaged error message

* util: split FormatUtils into multiple utils for better readability

* UI: change benchmark screen from raw markdown to table view

* bugfix: reset preselection upon running the preselected model

* misc: linter issue

* bugfix: fix the malfunctioning monitoring switch

* UI: update Arm features indicator; fix the broken hyperlinks

* UI: add quick action buttons to benchmark screen's result card

* UI: hide share fab after clearing all benchmark results

* UI: fix the model unload dialog message; elevate the model card and hide it by default on Conversation screen;

* UI: hide the stubbing actions in Conversation screen

* UI: add show/hide stats control to conversation screen's assistant message bubble; fix placeholder

* UI: add a info button to explain token metrics

* misc: remove the redundant `Companion` added due to refactoring

* UI: show corresponding system metrics detailed info upon tapping RAM / storage / temperature indicator

* UI: add info button to System Prompt switch; expand the model card by default

* UI: disable tag & language chips; add section headers to explain what they are

* misc: replace top bar indicator's spacer with padding

* UI: merge the Model Selection and Model Management into a unified Models screen

* UI: split the ModelsManagementViewModel from a unified ModelsViewModel due to huge complexity

* UI: add model loading in progress view; polish the empty model info view

* UI: polish the bottom bars and info view when no models found; show loading in progress while fetching models

* build: [BREAKING] bump the versions of libraries and plugins

* UI: fix the breaking build

* UI: add Tooltip on Import FAB for user onboarding

* UI: adds AppPreferences to track user onboarding status

* UI: tracks user's first success on importing a model

* data: add hand crafted rules to filter the models fetched from HuggingFace API

* UI: update app name & about; polish top bars' indicators & buttons

* UI: polish Hugging Face download dialog UI

* UX: implement onboarding tooltips for model import and onboarding

* misc: use sentence case for CTA button labels

* [WIP] UI: add Arm color palette from Philip.Watson3

* UI: address Rojin's UX feedbacks

* UI: address Rojin's UX feedbacks - part 2

* UI: update Arm color palette from Philip.Watson3

* data: make sure fetch preselected models in the same order of their IDs

* UI: fix UI issues in the generic settings screen and navigation drawer

* nit: address Rojin's feedbacks on model import message again

* nit: append `®` to all `Arm` labels

* UI: extract a reusable InfoAlertDialog

* core: support GGML_CPU_ALL_VARIANTS on Android!

* core: restructure Kleidi-Llama library

* core: organizing cmake arguments

* data: sort preselected models according to device's available RAM

* app: update adaptive + themed + legacy icons and app name

* UI: fix the font size auto scaling for ArmFeaturesVisualizer

* core: further improve the performance on native methods

* UI: minor color palette changes; emphasize the bottom bar FABs; fix Settings Screen menu item label

* UI: make more room for assistant message bubble's width

* UI: better usage of tertiary colors to highlight model cards but not for warnings

* UI: fix the layout issue on large font sizes

* lib: support x86-64 by dynamically set Arm related definitions

* lib: replace the factory pattern for  deprecated tiered lib loading with single instance pattern

* llama: update the library name in JNI and CMake project

* llama: update the library's package name and namespace

* llama: update the app's package name and namespace

* app: bump ksp version

* app: remove deprecated SystemUIController from accompanist by migrating to EdgeToEdge

* app: extract AppContent from MainActivity to a separate file in ui package

* lib: add File version for GGUF Magic number verification

* lib: perform engine state check inclusively instead of exclusively

* lib: change `LlamaTier` to `ArmCpuTier`

* lib: remove kleidi-llama related namings

* cleanup: remove Arm AI Chat/Playground app source code; replace with the basic sample app from https://github.com/hanyin-arm/Arm-AI-Chat-Sample

Note: the full Google Play version of AI Chat app will be open will be open sourced in another repo soon, therefore didn't go through the trouble of pruning the history using `git filter-repo` here.

* [WIP] doc: update main and Android README docs; add self to code owners

* lib: revert System.load back to System.loadLibrary

* jni: introduce a logging util to filter different logging levels on different build types

* lib: enable app optimization

* doc: replace stub Google Play app URL with the actual link add screenshots; add my GitHub ID to maintainer list

* Remove cpu_features

* Fix linters issues in editorconfig-checker job

https://github.com/ggml-org/llama.cpp/actions/runs/19548770247/job/55974800633?pr=17413

* Remove unnecessary Android CMake flag

* purge include/cpu_features directory

---------

Co-authored-by: Han Yin <redacted>
5 weeks agoggml : use WARP_SIZE/2 for argmax reduction offset (llama/18092)
Aadeshveer Singh [Wed, 17 Dec 2025 03:47:01 +0000 (09:17 +0530)]
ggml : use WARP_SIZE/2 for argmax reduction offset (llama/18092)

5 weeks agoggml-hexagon: mm for mtmd (llama/17894)
Shouyu [Mon, 15 Dec 2025 18:53:56 +0000 (13:53 -0500)]
ggml-hexagon: mm for mtmd (llama/17894)

* feat: add run_mtmd script for hexagon

* fix: fix issue in fp16xfp32 mm

* fix: remove opt_experiment for fp16xfp32 mm

* fix: ggml-hexagon: matmul fp16xfp32 support non-contigious src0

* fix: fix syntax check for run-mtmd.sh for cli

5 weeks agometal: use shared buffers on eGPU (llama/17866)
Jeremy Demeule [Mon, 15 Dec 2025 14:14:49 +0000 (15:14 +0100)]
metal: use shared buffers on eGPU (llama/17866)

* metal: use shared buffers on eGPU

With #15906, I noticed on important regression when using metal backend on eGPU.
This commit restore the previous behavior and add an option to force its activation.

* metal: use shared buffers on eGPU

* metal: use shared buffers on eGPU

5 weeks agollama: automatically set parameters not set by the user in such a way that maximizes...
Johannes Gäßler [Mon, 15 Dec 2025 08:24:59 +0000 (09:24 +0100)]
llama: automatically set parameters not set by the user in such a way that maximizes GPU utilization (llama/16653)

* llama: automatically fit args to free memory

llama-fit-params tool

* fix CI

* hints for bug reports, ensure no reallocation

* fix segfault with Vulkan

* add llama-fit-params to CI

* fix CI

* fix CI

* fix CI

* minor adjustments

* fix assignment of 1 dense layer

* fix logger not being reset on model load failure

* remove --n-gpu-layer hint on model load failure

* fix llama-fit-params verbosity

* fix edge case

* fix typo [no ci]

5 weeks agoSupport gpt-oss by OPs add-id, mul_mat for mxfp4, swiglu_oai (llama/17826)
Neo Zhang Jianyu [Mon, 15 Dec 2025 02:35:15 +0000 (10:35 +0800)]
Support gpt-oss by OPs add-id, mul_mat for mxfp4, swiglu_oai (llama/17826)

* support gpt-oss GPU by OP add-id, mul_mat for mxfp4, swiglu_oai, fix warning

* fix fault ut case, update ops.md

* rebase, fix format issue

5 weeks agovulkan: fix mul_mat_vec_iq1_s formatting (llama/18026)
Ruben Ortlam [Sun, 14 Dec 2025 13:52:46 +0000 (14:52 +0100)]
vulkan: fix mul_mat_vec_iq1_s formatting (llama/18026)

6 weeks agosync : llama.cpp
Georgi Gerganov [Sun, 14 Dec 2025 08:08:45 +0000 (10:08 +0200)]
sync : llama.cpp

6 weeks agovulkan: Fix data race/hang in scalar/cm1 flash attention (llama/17887)
Jeff Bolz [Sun, 14 Dec 2025 08:00:00 +0000 (02:00 -0600)]
vulkan: Fix data race/hang in scalar/cm1 flash attention (llama/17887)

6 weeks agovulkan: improve mul_mat_vec_iq1_s speed (llama/17874)
lovedheart [Sun, 14 Dec 2025 07:47:49 +0000 (08:47 +0100)]
vulkan: improve mul_mat_vec_iq1_s speed (llama/17874)

6 weeks agovulkan: faster q6_k matmul (llama/17813)
Eve [Sun, 14 Dec 2025 07:29:37 +0000 (07:29 +0000)]
vulkan: faster q6_k matmul (llama/17813)

* q6_k faster mul mat

* 8 values

* fix comment

* switch to two at a time

* start ci for .glsl files

6 weeks agoggml : arm repack fix build (llama/0)
Georgi Gerganov [Sat, 13 Dec 2025 20:54:14 +0000 (22:54 +0200)]
ggml : arm repack fix build (llama/0)

6 weeks agovulkan: support get_rows for i32 (llama/17941)
Jeff Bolz [Sat, 13 Dec 2025 09:12:53 +0000 (03:12 -0600)]
vulkan: support get_rows for i32 (llama/17941)

6 weeks agovulkan: support GGML_OP_DIAG (llama/17893)
Jeff Bolz [Sat, 13 Dec 2025 09:07:49 +0000 (03:07 -0600)]
vulkan: support GGML_OP_DIAG (llama/17893)

6 weeks agovulkan: Multi-pass softmax for large number of cols (llama/17892)
Jeff Bolz [Sat, 13 Dec 2025 09:04:29 +0000 (03:04 -0600)]
vulkan: Multi-pass softmax for large number of cols (llama/17892)

When the number of cols is large, split each row across multiple workgroups.
There are three phases that communicate partial results through temp buffers:
(1) compute max partials
(2) take max of partials, compute sum(exp(x-max)) partials
(3) sum partials, compute scaled result

6 weeks agovulkan: Allow non-pow2 n_experts in topk_moe (llama/17872)
Jeff Bolz [Sat, 13 Dec 2025 07:40:04 +0000 (01:40 -0600)]
vulkan: Allow non-pow2 n_experts in topk_moe (llama/17872)

6 weeks agoCUDA: fix overflow in MMA kernel without stream-k (llama/17939)
Johannes Gäßler [Fri, 12 Dec 2025 16:43:58 +0000 (17:43 +0100)]
CUDA: fix overflow in MMA kernel without stream-k (llama/17939)

6 weeks agocann : fix ops broken by circular padding guard (llama/17825)
Sigbjørn Skjæret [Fri, 12 Dec 2025 14:49:27 +0000 (15:49 +0100)]
cann : fix ops broken by circular padding guard (llama/17825)

6 weeks agoggml-cpu : fix RISC-V Q4_0 repack select and RVV feature reporting (llama/17951)
ixgbe [Fri, 12 Dec 2025 14:26:03 +0000 (22:26 +0800)]
ggml-cpu : fix RISC-V Q4_0 repack select and RVV feature reporting (llama/17951)

* ggml-cpu:fix RISC-V Q4_0 repack select and RVV feature reporting

Signed-off-by: Wang Yang <redacted>
* using the name VLEN instead of CNT

* Update ggml/include/ggml-cpu.h

---------

Signed-off-by: Wang Yang <redacted>
Co-authored-by: Georgi Gerganov <redacted>
6 weeks agoHIP: enable mmf for RDNA3 (llama/17879)
yulo [Fri, 12 Dec 2025 10:34:33 +0000 (18:34 +0800)]
HIP: enable mmf for RDNA3 (llama/17879)

* enable mmf for RDNA3

* disable mmf for some shape

* move some mmvf to mmf

* more mmfv to mmf

* 3 is good in mmvf

---------

Co-authored-by: zhang hui <redacted>
6 weeks agoSOLVE_TRI extension to more dimensions (llama/17793)
Piotr Wilkin (ilintar) [Thu, 11 Dec 2025 16:20:43 +0000 (17:20 +0100)]
SOLVE_TRI extension to more dimensions (llama/17793)

* Extended TRI

* Fix whitespace

* chore: update webui build output

* Just use cuBLAS for everything...

* Merge both versions

* Remove incorrect imports causing failures for CI

* Still failing... remove all direct cublas imports and rely on common imports from "common.cuh"

* Defines for hipBlas

* Aaaand MUSA defines...

* I hate this job...

* Stupid typo...

* Update ggml/src/ggml-cuda/solve_tri.cu

Co-authored-by: Johannes Gäßler <redacted>
---------

Co-authored-by: Johannes Gäßler <redacted>
6 weeks agosync : whisper.cpp
Georgi Gerganov [Sat, 13 Dec 2025 07:39:30 +0000 (09:39 +0200)]
sync : whisper.cpp

6 weeks agoggml : arm repack fix build (whisper/0)
Georgi Gerganov [Sat, 13 Dec 2025 06:04:09 +0000 (08:04 +0200)]
ggml : arm repack fix build (whisper/0)

6 weeks agocmake : set `CMAKE_RUNTIME_OUTPUT_DIRECTORY` for non standalone build (#1394)
Congcong Cai [Fri, 12 Dec 2025 14:37:38 +0000 (22:37 +0800)]
cmake : set `CMAKE_RUNTIME_OUTPUT_DIRECTORY` for non standalone build (#1394)

Some backend depends on CMAKE_RUNTIME_OUTPUT_DIRECTORY to create temporary file like metal backened.
Missing CMAKE_RUNTIME_OUTPUT_DIRECTORY will cause some cmake error like permission denied (try to copy file to root).
This PR wants to setup a default path for CMAKE_RUNTIME_OUTPUT_DIRECTORY when it does not exist.

6 weeks agoci : remove retired macOS-13 runners from CI (#1397)
Copilot [Fri, 12 Dec 2025 14:36:22 +0000 (16:36 +0200)]
ci : remove retired macOS-13 runners from CI (#1397)

* Initial plan

* Remove retired macOS-13 runner from CI build matrix

Co-authored-by: ggerganov <redacted>
---------

Co-authored-by: copilot-swe-agent[bot] <redacted>
Co-authored-by: ggerganov <redacted>
6 weeks agosync : llama.cpp
Georgi Gerganov [Thu, 11 Dec 2025 13:33:05 +0000 (15:33 +0200)]
sync : llama.cpp

6 weeks agoggml-alloc : fix reuse-parent logic for misaligned sizes (llama/17884)
Georgi Gerganov [Thu, 11 Dec 2025 12:30:10 +0000 (14:30 +0200)]
ggml-alloc : fix reuse-parent logic for misaligned sizes (llama/17884)

6 weeks agoggml-hexagon: fix `rope` failure at `test-backend-ops` (llama/17565)
nullname [Wed, 10 Dec 2025 22:45:43 +0000 (06:45 +0800)]
ggml-hexagon: fix `rope` failure at `test-backend-ops` (llama/17565)

* fix test failure

* fix: correct scaling calculations in rope_cache_init

* fix: optimize element copying in rope_hex_f32 using memcpy

* fix: optimize loop boundaries in rope_hex_f32 for better performance

* feat: add profiling macros for performance measurement in operations

6 weeks agoFix race conditions in threadpool when dealing with dynamic/frequent n_threads change...
Max Krasnyansky [Wed, 10 Dec 2025 20:32:23 +0000 (12:32 -0800)]
Fix race conditions in threadpool when dealing with dynamic/frequent n_threads changes (llama/17748)

* tests: update barrier test to check for race condition in active threads

* cpu: combine n_graph and n_threads into a single atomic update

* tests: add multi-graph test for test_barrier

6 weeks agoggml : remove GGML_KQ_MASK_PAD constant (llama/17910)
Georgi Gerganov [Wed, 10 Dec 2025 18:53:16 +0000 (20:53 +0200)]
ggml : remove GGML_KQ_MASK_PAD constant (llama/17910)

* ggml : remove GGML_KQ_MASK_PAD constant

* cont : remove comment

6 weeks agocuda : add missing support check for xielu (llama/17895)
Sigbjørn Skjæret [Wed, 10 Dec 2025 15:16:20 +0000 (16:16 +0100)]
cuda : add missing support check for xielu (llama/17895)

6 weeks agoCUDA: fix unpadded strides in MMA FA kernel (llama/17891)
Johannes Gäßler [Wed, 10 Dec 2025 11:39:56 +0000 (12:39 +0100)]
CUDA: fix unpadded strides in MMA FA kernel (llama/17891)

6 weeks agofix softmax for iGPU (llama/17838)
Neo Zhang Jianyu [Wed, 10 Dec 2025 08:59:57 +0000 (16:59 +0800)]
fix softmax for iGPU (llama/17838)

6 weeks agometal: SSM kernel improvements (llama/17876)
Gabe Goodhart [Tue, 9 Dec 2025 19:30:02 +0000 (12:30 -0700)]
metal: SSM kernel improvements (llama/17876)

* feat: Add a batched version of ssm_conv

This was done using Claude Code. It found a number of optimizations around
how the threads were organized, resulting in a huge performance boost!

Branch: Mamba2SSD

Signed-off-by: Gabe Goodhart <redacted>
* feat: Optimized SSM_SCAN kernel for metal

This used Claude Code and resulted in a modest performance improvement
while maintaining correctness.

Branch: Mamba2SSD

Signed-off-by: Gabe Goodhart <redacted>
* test: Add test-backend-ops perf tests for SSM_CONV

Branch: SSMKernelImprovements

Signed-off-by: Gabe Goodhart <redacted>
* test: Real representitive tests for SSM_CONV

Branch: SSMKernelImprovements

Signed-off-by: Gabe Goodhart <redacted>
* refactor: Use function constant for ssm_conv batch size

Branch: SSMKernelImprovements

Signed-off-by: Gabe Goodhart <redacted>
* test: backend op tests for ssm_scan from granite4 1b-h

Branch: SSMKernelImprovements

Signed-off-by: Gabe Goodhart <redacted>
* style: remove commented out templates

Branch: SSMKernelImprovements

Signed-off-by: Gabe Goodhart <redacted>
* feat: float4 version of ssm_conv_batched

Branch: SSMKernelImprovements

Signed-off-by: Gabe Goodhart <redacted>
* fix: Add missing ggml_metal_cv_free

Signed-off-by: Gabe Goodhart <redacted>
Co-authored-by: Georgi Gerganov <redacted>
---------

Signed-off-by: Gabe Goodhart <redacted>
Co-authored-by: Georgi Gerganov <redacted>
6 weeks agoAdd DIAG for CUDA (llama/17873)
Piotr Wilkin (ilintar) [Tue, 9 Dec 2025 19:28:57 +0000 (20:28 +0100)]
Add DIAG for CUDA (llama/17873)

* Add DIAG for CUDA

* Refactor parameters

6 weeks agoggml : Provide macos-specific backtrace printing to avoid terminal death (llama/17869)
Gabe Goodhart [Tue, 9 Dec 2025 16:29:07 +0000 (09:29 -0700)]
ggml : Provide macos-specific backtrace printing to avoid terminal death (llama/17869)

* fix: Provide macos-specific backtrace printing to avoid terminal death

Branch: MacOSSafeBacktrace

Signed-off-by: Gabe Goodhart <redacted>
* fix: Add GGML_BACKTRACE_LLDB env var to enable using lldb for backtrace

Branch: MacOSSafeBacktrace

Signed-off-by: Gabe Goodhart <redacted>
---------

Signed-off-by: Gabe Goodhart <redacted>
6 weeks agometal : print node names for debugging (llama/17882)
Georgi Gerganov [Tue, 9 Dec 2025 13:25:49 +0000 (15:25 +0200)]
metal : print node names for debugging (llama/17882)

6 weeks agoggml : allow fill node alloc inplace (llama/17870)
Sigbjørn Skjæret [Tue, 9 Dec 2025 11:23:47 +0000 (12:23 +0100)]
ggml : allow fill node alloc inplace (llama/17870)

6 weeks agoCANN: add support for partial RoPE and Vision mode (llama/17543)
Chenguang Li [Tue, 9 Dec 2025 09:53:23 +0000 (17:53 +0800)]
CANN: add support for partial RoPE and Vision mode (llama/17543)

* cann: add support for partial RoPE and Vision mode

Add support for two important RoPE variants: partial rotation (rope_dims < ne0)
and Vision mode rotation.

1. Support for partial RoPE (rope_dims < ne0):
   - Split tensor into head (first rope_dims dimensions) and tail portions
   - Apply rotation only to head portion using RotaryPositionEmbedding operator
   - Copy unrotated tail portion directly from source to destination
   - Handle both contiguous and non-contiguous tensor layouts

2. Support for Vision mode (GGML_ROPE_TYPE_VISION):
   - Set rope_dims = ne0 for Vision mode to rotate entire tensor
   - Vision mode pairs dimension i with dimension i+n_dims (where n_dims = ne0/2)
   - No tail handling needed since entire tensor is rotated

Implementation details:
   - Use has_tail flag to determine execution path: head/tail splitting when
     rope_dims < ne0, or full tensor rotation when rope_dims == ne0
   - Support both F32 and F16 data types with intermediate F32 conversion
   - Copy non-contiguous tensors to contiguous buffers before calling
     RotaryPositionEmbedding operator for compatibility
   - Improve cache invalidation logic to include rope_dims and indep_sects
     parameters

These enhancements enable CANN backend to handle various RoPE configurations
used in modern vision-language models and models with partial rotation.

* cann: fix review comment

6 weeks agoCUDA: fix FP16 overflow in tile FA kernel (llama/17875)
Johannes Gäßler [Tue, 9 Dec 2025 08:34:02 +0000 (09:34 +0100)]
CUDA: fix FP16 overflow in tile FA kernel (llama/17875)

6 weeks agocuda : add FILL op support (llama/17851)
Jay Zenith [Mon, 8 Dec 2025 13:10:12 +0000 (05:10 -0800)]
cuda : add FILL op support (llama/17851)

* cuda : add FILL op support

* cuda : add missing FILL op files

6 weeks agocuda: optimize SOLVE_TRI using registers and FMAF (llama/17703)
wsbagnsv1 [Mon, 8 Dec 2025 09:41:08 +0000 (10:41 +0100)]
cuda: optimize SOLVE_TRI using registers and FMAF (llama/17703)

* ggml-cuda: optimize solve_tri_f32_fast and fix stride handling

- Switch from using shared memory for the RHS/solution matrix to a register-based approach (x_low, x_high), reducing shared memory pressure and bank conflicts.
- Implement explicit `fmaf` instructions for the reduction loop.
- Update kernel arguments to pass strides in bytes rather than elements to align with standard ggml tensor arithmetic (casting to `char *` before addition).
- Remove unused `MAX_K_FAST` definition.

* Small cleanup

* Remove comments in solve_tri.cu

* Update ggml/src/ggml-cuda/solve_tri.cu

Co-authored-by: Johannes Gäßler <redacted>
* Update ggml/src/ggml-cuda/solve_tri.cu

Co-authored-by: Johannes Gäßler <redacted>
* Update ggml/src/ggml-cuda/solve_tri.cu

Co-authored-by: Johannes Gäßler <redacted>
* Use const for variables in solve_tri.cu

* Replace fmaf with more readable code

* remove last fmaf

---------

Co-authored-by: Johannes Gäßler <redacted>
6 weeks agoggml-cpu: add ggml_thread_cpu_relax with Zihintpause support (llama/17784)
ixgbe [Mon, 8 Dec 2025 08:41:34 +0000 (16:41 +0800)]
ggml-cpu: add ggml_thread_cpu_relax with Zihintpause support (llama/17784)

* ggml-cpu: add ggml_thread_cpu_relax with Zihintpause support

Signed-off-by: Wang Yang <redacted>
* cmake: enable RISC-V zihintpause extension for Spacemit builds

* readme : add ZIHINTPAUSE support for RISC-V

---------

Signed-off-by: Wang Yang <redacted>
6 weeks agoVulkan: improve mul_mat_vec_iq1_m (llama/16907)
lovedheart [Sun, 7 Dec 2025 17:40:42 +0000 (18:40 +0100)]
Vulkan: improve mul_mat_vec_iq1_m (llama/16907)

* Optimize Vulkan shader for matrix-vector multiplication

* Revert changes on compute_outputs and main

Refactor compute_outputs to handle remaining rows correctly.

* Fix trailing whitespace

6 weeks agosycl: add missing BF16 conversion support for Intel oneAPI (llama/17780)
Law Po Ying [Sun, 7 Dec 2025 01:18:18 +0000 (09:18 +0800)]
sycl: add missing BF16 conversion support for Intel oneAPI (llama/17780)

* sycl: add missing BF16 conversion support for Intel oneAPI

* Fix Line 645: Trailing whitespace

6 weeks agovulkan: perf_logger improvements (llama/17672)
Jeff Bolz [Sat, 6 Dec 2025 17:46:46 +0000 (11:46 -0600)]
vulkan: perf_logger improvements (llama/17672)

* vulkan: perf_logger improvements

- Move perf_logger from device to ctx.
- Add an env var to control the frequency we dump the stats. If you set a very
large value, it just dumps when the ctx is destroyed.
- Add a fusion info string to the tracking, only log one item per fused op.
- Fix MUL_MAT_ID flops calculation.

* fix vector sizes

6 weeks agoggml-zendnn : add ZenDNN backend for AMD CPUs (llama/17690)
Vishal Singh [Sat, 6 Dec 2025 16:13:33 +0000 (21:43 +0530)]
ggml-zendnn : add ZenDNN backend for AMD CPUs (llama/17690)

* ggml-zennn: add ZenDNN backend support

* ggml-zendnn : address ZenDNN backend review fixes and suggestions

* docs : apply blockquote syntax to ZenDNN docs

---------

Co-authored-by: Manoj Kumar <redacted>
6 weeks agoggml : add circular tiling support to pad, for Vulkan, CUDA, and CPU (used for making...
Phylliida Dev [Sat, 6 Dec 2025 14:07:02 +0000 (06:07 -0800)]
ggml : add circular tiling support to pad, for Vulkan, CUDA, and CPU (used for making seamless textures) (llama/16985)

* Feat: Added vulkan circular tiling support

* Feat: Added cpu circular

* Feat: Added cuda kernels

* Added tests

* Added tests

* Removed non-pad operations

* Removed unneded changes

* removed backend non pad tests

* Update test-backend-ops.cpp

* Fixed comment on pad test

* removed trailing whitespace

* Removed unneded test in test-backend-ops

* Removed removed test from calls

* Update ggml/src/ggml-vulkan/vulkan-shaders/pad.comp

Co-authored-by: Ruben Ortlam <redacted>
* Fixed alignment

* Formatting

Co-authored-by: Aman Gupta <redacted>
* Format pad

* Format

* Clang format

* format

* format

* don't change so much stuff

* clang format and update to bool

* fix duplicates

* don't need to fix the padding

* make circular bool

* duplicate again

* rename vulkan to wrap around

* Don't need indent

* moved to const expr

* removed unneded extra line break

* More readable method calls

* Minor wording changes

* Added final newline

* Update ggml/include/ggml.h

Co-authored-by: Georgi Gerganov <redacted>
* Update ggml/include/ggml.h

Co-authored-by: Georgi Gerganov <redacted>
* Added circular pad ext tests

* Gate non circular pad devices

* Cleaned gating of non-circular pad devices

---------

Co-authored-by: Phylliida <redacted>
Co-authored-by: Ruben Ortlam <redacted>
Co-authored-by: Aman Gupta <redacted>
Co-authored-by: Georgi Gerganov <redacted>
6 weeks agoHIP: fix RDNA3 FP16/BF16 matrix multiplication (llama/17817)
Johannes Gäßler [Sat, 6 Dec 2025 12:45:36 +0000 (13:45 +0100)]
HIP: fix RDNA3 FP16/BF16 matrix multiplication (llama/17817)

6 weeks agoggml : improve error handling for search path existence checks (llama/17653)
Sky [Sat, 6 Dec 2025 11:28:16 +0000 (19:28 +0800)]
ggml : improve error handling for search path existence checks (llama/17653)

* Improve error handling for search path existence checks

Refactor existence checks for search paths using std::error_code to handle potential errors.

* Improve cache file existence check with error code

Update fs::exists to use std::error_code for error handling.

* Simplify existence check for search paths

Simplify existence check for search paths

* Fix logging path in error message for posix_stat

* Update ggml/src/ggml-backend-reg.cpp

Co-authored-by: Aman Gupta <redacted>
* Adapt to the coding standard

---------

Co-authored-by: Aman Gupta <redacted>
6 weeks agovulkan: Use one row per workgroup for f32 mmv (llama/17711)
Jeff Bolz [Sat, 6 Dec 2025 10:12:26 +0000 (04:12 -0600)]
vulkan: Use one row per workgroup for f32 mmv (llama/17711)

The MoE models have a mul_mat_vec with very small m (32, 64, 128) right before
the topk_moe selection. Running multiple rows per wg doesn't utilize the SMs
well. I think even for larger m, f32 is so bandwidth-limited that running
multiple rows doesn't help.

6 weeks agovulkan: support solve_tri with larger N/K values (llama/17781)
Jeff Bolz [Sat, 6 Dec 2025 07:56:45 +0000 (01:56 -0600)]
vulkan: support solve_tri with larger N/K values (llama/17781)

Split N into chunks to fit into shared memory.
If K > 128, use a larger workgroup with enough invocations.
Add perf tests matching qwen3next.

6 weeks agometal : fix build(#17799)
Georgi Gerganov [Sat, 6 Dec 2025 07:33:59 +0000 (09:33 +0200)]
metal : fix build(#17799)

* metal : fix build

* tests : fix context destruction

6 weeks agovulkan: Replace deprecated VK_EXT_validation_features (llama/17637)
Masato Nakasaka [Sat, 6 Dec 2025 05:39:42 +0000 (14:39 +0900)]
vulkan: Replace deprecated VK_EXT_validation_features (llama/17637)

* replaced deprecated VK_EXT_validation_features

* forgot to remove old code

6 weeks agovulkan: Fix mismatch in TOPK_MOE unit test (llama/17541)
Masato Nakasaka [Sat, 6 Dec 2025 05:23:30 +0000 (14:23 +0900)]
vulkan: Fix mismatch in TOPK_MOE unit test (llama/17541)

* Fix shader to support 2D workgroup mapping to a single subgroup

* Set required_subgroup_size

topk_moe shader requires static WARP_SIZE and actual subgroup size to match

6 weeks agovulkan: add more num_blocks instantiations in rms_norm (llama/17701)
Jeff Bolz [Fri, 5 Dec 2025 21:08:56 +0000 (15:08 -0600)]
vulkan: add more num_blocks instantiations in rms_norm (llama/17701)

6 weeks agovulkan: fix top_k bug when there are ties in the input (llama/17659)
Jeff Bolz [Fri, 5 Dec 2025 21:03:19 +0000 (15:03 -0600)]
vulkan: fix top_k bug when there are ties in the input (llama/17659)

* vulkan: Reduce temporary memory usage for TOP_K

- Compute row size for the temp buffer based on the output of the first pass.
- Update shader addressing math to use the output row size
- Pass the output row size as "ncols_output", what used to be "ncols_output" is now "k"

For the common case of K=40 and src0=(200000,1,1,1), this reduces the temporary buffer
from about 3.2MB to 500KB.

* vulkan: fix top_k bug when there are ties in the input

I noticed by inspection a bug in the vulkan top_k shader where if the least
value in the top_k appears multiple times we could end up writing those extra
copies out rather than some larger values (if the larger values are on higher
numbered threads).

I rewrote the test verification to handle this case, where the final index set
is not necessarily the same.

* Update tests/test-backend-ops.cpp

Co-authored-by: Georgi Gerganov <redacted>
---------

Co-authored-by: Georgi Gerganov <redacted>
6 weeks agovulkan : support conv-2d with large output size (llama/17685)
Acly [Fri, 5 Dec 2025 20:46:39 +0000 (21:46 +0100)]
vulkan : support conv-2d with large output size (llama/17685)

6 weeks agoggml webgpu: unary op suppport, code refactoring, ops support (llama/17764)
Reese Levine [Fri, 5 Dec 2025 20:25:51 +0000 (12:25 -0800)]
ggml webgpu: unary op suppport, code refactoring, ops support (llama/17764)

* Squashed commit of the following:

commit b3c6bf4b0450d8d452b934df27a0fb7cb53cd755
Author: Abhijit Ramesh <redacted>
Date:   Mon Dec 1 18:29:00 2025 -0800

    ggml webgpu: fix xielu parameter passing (llama/11)

    The XIELU operation was incorrectly using static_cast to convert
    float parameters to uint32_t, which converted numeric values instead
    of preserving IEEE 754 bit patterns. This caused incorrect values
    to be interpreted by the GPU shader.

    * Use reinterpret_cast to preserve float bit patterns when passing
      through uint32_t params buffer
    * Update WGSL shader parameter types from u32 to f32
    * Re-enable XIELU support (was disabled due to numerical issues)

    Fixes NMSE test failures for XIELU operation on WebGPU backend.

commit 5ca9b5e49ea7cddc9ab7c8b43a11a9c76a4dff4a
Author: neha-ha <redacted>
Date:   Tue Nov 18 12:17:00 2025 -0800

    Refactored pipelines and workgroup calculations (llama/10)

    * refactored pipelines

    * refactored workgroup calculation

    * removed commented out block of prior maps

    * Clean up ceiling division pattern

    ---------

Co-authored-by: Neha Abbas <redacted>
Co-authored-by: Reese Levine <redacted>
Author: James Contini <redacted>
Date:   Wed Oct 29 23:13:06 2025 -0700

    formatted embed wgsl and ggml-webgpu.cpp

commit e1f6baea31645e5d96ad53664acae856f74b96f4
Author: James Contini <redacted>
Date:   Wed Oct 29 23:08:37 2025 -0700

    implemented REPL_Template support and removed bug in unary operators kernel

commit 8c70b8fece445cdc9a8c660dbddbf201e52da2bb
Author: James Contini <redacted>
Date:   Wed Oct 15 16:14:20 2025 -0700

    responded and dealt with PR comments

commit f9282c660c10dec4487d434549bdb707a9cd9f37
Author: James Contini <redacted>
Date:   Sun Oct 12 13:41:41 2025 -0700

    removed unnecesarry checking if node->src[1] exists for unary operators

commit 4cf28d7dec41c29186d66152735b244c5699f9dc
Author: James Contini <redacted>
Date:   Sun Oct 12 13:32:45 2025 -0700

    All operators (inlcluding xielu) working

commit 74c6add1761a59d2c2ff60b60e8ad3c8300f6d3e
Author: James Contini <redacted>
Date:   Fri Oct 10 13:16:48 2025 -0700

    fixed autoconfig

commit 362749910be4f0120c8ffb21ceddeb7d2c088e51
Author: James Contini <redacted>
Date:   Fri Oct 10 13:10:46 2025 -0700

    removed vestigial files

commit cb0858333785757804c5104e59c4981843207c16
Author: James Contini <redacted>
Date:   Fri Oct 10 12:59:32 2025 -0700

    abides by editor-config

commit 5360e2852a4b51197d7d67d0a5d42e908b02d7ed
Author: James Contini <redacted>
Date:   Fri Oct 10 12:45:57 2025 -0700

    rms_norm double declaration bug atoned

commit 7b09baa4aa53711be5a126043670cc182c78bfcd
Merge: 8a6ec843 74b8fc17
Author: James Contini <redacted>
Date:   Fri Oct 10 11:50:03 2025 -0700

    resolving merge conflicts

commit 8a6ec843a50ab82f8cef59b4558eb63f318ba02d
Author: James Contini <redacted>
Date:   Wed Oct 8 18:06:47 2025 -0700

    unary operators pass ggml tests

commit c3ae38278a2db236adc5912c9140e4f0d63f2c19
Author: James Contini <redacted>
Date:   Wed Oct 1 16:22:40 2025 -0700

    neg passes backend test

commit aa1c9b2f8877a405470ca56709c42a1fd43713de
Author: James Contini <redacted>
Date:   Tue Sep 30 23:55:27 2025 -0700

    neg f16xf32xip builds and runs, havent actually ran a model that uses neg kernel yet though

Co-authored-by: James Contini <redacted>
Co-authored-by: Neha Abbas <redacted>
Co-authored-by: Abhijit Ramesh <redacted>
* Remove extra code and format

* Add ops documentation (finally)

* Update ggml/src/ggml-webgpu/wgsl-shaders/embed_wgsl.py

Co-authored-by: Sigbjørn Skjæret <redacted>
---------

Co-authored-by: James Contini <redacted>
Co-authored-by: Neha Abbas <redacted>
Co-authored-by: Abhijit Ramesh <redacted>
Co-authored-by: Sigbjørn Skjæret <redacted>
6 weeks agovulkan: enable mmvq for q2_k on NVIDIA (llama/17675)
Jeff Bolz [Fri, 5 Dec 2025 20:21:57 +0000 (14:21 -0600)]
vulkan: enable mmvq for q2_k on NVIDIA (llama/17675)

6 weeks agovulkan: set all memory allocations to high priority (llama/17624)
Jeff Bolz [Fri, 5 Dec 2025 20:21:04 +0000 (14:21 -0600)]
vulkan: set all memory allocations to high priority (llama/17624)

* vulkan: set all memory allocations to high priority

* gate by env var

6 weeks agorpc : fix alloc size logic (llama/17116)
Georgi Gerganov [Fri, 5 Dec 2025 17:39:04 +0000 (19:39 +0200)]
rpc : fix alloc size logic (llama/17116)

* rpc : fix alloc size logic

* rpc : bump version

6 weeks agometal : add residency sets keep-alive heartbeat (llama/17766)
Georgi Gerganov [Fri, 5 Dec 2025 17:38:54 +0000 (19:38 +0200)]
metal : add residency sets keep-alive heartbeat (llama/17766)

* examples : add idle

* metal : attach residency sets to queue

* idle : add link

* idle : adjust intervals

* metal : add residency sets keep-alive heartbeat

* cont : adjust default keep-alive time

6 weeks agoHIP : fix RDNA4 build (llama/17792)
Johannes Gäßler [Fri, 5 Dec 2025 12:47:52 +0000 (13:47 +0100)]
HIP : fix RDNA4 build (llama/17792)

6 weeks agoQ4/Q8 Tiled Gemm Optimization. (llama/16999)
shalinib-ibm [Fri, 5 Dec 2025 11:41:51 +0000 (17:11 +0530)]
Q4/Q8 Tiled Gemm Optimization. (llama/16999)

6 weeks agoCUDA: fix FA VKQ accumulator overflow (llama/17746)
Johannes Gäßler [Fri, 5 Dec 2025 08:18:10 +0000 (09:18 +0100)]
CUDA: fix FA VKQ accumulator overflow (llama/17746)

6 weeks agoHIP: enable WMMA-MMQ INT kernels for RDNA 3 (llama/17576)
Jiacheng (Jason) Chen [Fri, 5 Dec 2025 08:17:37 +0000 (03:17 -0500)]
HIP: enable WMMA-MMQ INT kernels for RDNA 3 (llama/17576)

* enabled wmma instructions for most quantizations other than q2k

* fixed the last q2_k test case failure

* address comments: fix out of bound write for RDNA4, add comments after #endif

* clean up rebase: fix ne error in half2

* fix the EditorConfig CI

6 weeks agoAdd support for CUMSUM and TRI for CUDA. (llama/17584)
Piotr Wilkin (ilintar) [Thu, 4 Dec 2025 21:19:51 +0000 (22:19 +0100)]
Add support for CUMSUM and TRI for CUDA. (llama/17584)

* Add support for CUMSUM and TRI for CUDA.

* Minor optimizations.

* Correct warp_prefix_inclusive_sum in float2 variant to return float2

* Optimize TRI

* Whitespace

* Fix strides.

* Implement double loop

* Whitespace

* Fix HIP compilation bugs

* Optimizations + big case performance tests

* Implement using CUB with fallback to custom kernel

* Remove error message.

* Fixes from code review

* Comment out CPU-unsupported F16/BF16 cases to fix CI

* Fine, you win :P

* Fix last cast, use NO_DEVICE_CODE and GGML_UNUSED_VARS

* Vary warp-size based on physical warp size

* Add GGML_UNUSED_VARS in tri as well

* Use constexpr and call prefix_inclusive with warp_size template param

* Update ggml/src/ggml-cuda/cumsum.cu

Co-authored-by: Johannes Gäßler <redacted>
* Apply suggestions from code review

Co-authored-by: Johannes Gäßler <redacted>
* Change to tid % warp_size

* Fix strides; hardcode mask; add ggml_lane_mask_t

* Missing renames, remove unused get_warp_mask(), explicit calls to ggml_cuda_info()

* Too hasty...

---------

Co-authored-by: Johannes Gäßler <redacted>
6 weeks agometal: TRI, FILL, EXPM1, SOFTPLUS (llama/16623)
Gabe Goodhart [Thu, 4 Dec 2025 17:12:19 +0000 (10:12 -0700)]
metal: TRI, FILL, EXPM1, SOFTPLUS (llama/16623)

* feat(wip): Port initial TRI impl from pervious work

The kernel does not work and is not optimized, but the
code compiles and runs, so this will be the starting point
now that the core op has been merged.

Branch: ggml-cumsum-tri

Signed-off-by: Gabe Goodhart <redacted>
* fix: Remove argument for constant val override

This was added in the original draft, but later removed. With this, the
kernel now passes tests.

Branch: ggml-cumsum-tri

Signed-off-by: Gabe Goodhart <redacted>
* feat: Move the ttype conditional to templating to avoid conditional in kernel

Branch: ggml-cumsum-tri

Signed-off-by: Gabe Goodhart <redacted>
* fix: Type fixes

Signed-off-by: Gabe Goodhart <redacted>
Co-authored-by: Georgi Gerganov <redacted>
Co-authored-by: Georgi Gerganov <redacted>
* feat: Add softplus for metal

Branch: ggml-cumsum-tri

Signed-off-by: Gabe Goodhart <redacted>
* feat: Add EXPM1 for metal

Branch: ggml-cumsum-tri

Signed-off-by: Gabe Goodhart <redacted>
* feat: Add FILL for metal

Branch: ggml-cumsum-tri

Signed-off-by: Gabe Goodhart <redacted>
* refactor: Branchless version of tri using _ggml_vec_tri_cmp as a mask

Branch: ggml-cumsum-tri

Signed-off-by: Gabe Goodhart <redacted>
* fix: Remove unused arguments

Branch: ggml-cumsum-tri

Signed-off-by: Gabe Goodhart <redacted>
* refactor: Use select instead of branch for softplus non-vec

Branch: ggml-cumsum-tri

Signed-off-by: Gabe Goodhart <redacted>
---------

Signed-off-by: Gabe Goodhart <redacted>
Co-authored-by: Georgi Gerganov <redacted>
6 weeks agoggml-cpu : remove asserts always evaluating to false (llama/17728)
Alberto Cabrera Pérez [Thu, 4 Dec 2025 12:16:38 +0000 (12:16 +0000)]
ggml-cpu : remove asserts always evaluating to false (llama/17728)