Skip to content

Conversation

@DajanaV
Copy link
Collaborator

@DajanaV DajanaV commented Oct 31, 2025

Mirrored from ggml-org/llama.cpp#16891

Add support for ggml_interpolate with GGML_SCALE_MODE_BICUBIC in CPU backend. Spline parameters are chosen to match PyTorch results.

Will add Vulkan implementation in a follow-up PR.

CISC and others added 30 commits September 30, 2025 21:41
* fix ccache key for ubuntu-cpu-cmake

* set it for release as well [no ci]
…#16359)

* Make a few GLM tensors not required

layer.nextn.shared_head_head and layer.nextn.embed_tokens are both excluded from GLM 4.6 resulting in the model not loading after conversion/quantization, this marks those tensors as not required which makes it work

* Update llama-model.cpp

layer.nextn.shared_head_norm also not required in case of future models
…(#16345)

* make ggml_vk_default_dispatcher support older vulkan headers

* simpilfy with using
* feat: Add a setting to include model name used to generate the message

* feat: UI improvements

* feat: Save model info along with the database message entry creation

* chore: Build webui static output
* feat: Improve code block theming

* chore: update webui build output

* chore: Update webui static build
…onditional rendering for Actions Dropdown for Chat Conversation Items (#16369)

* fix: Render Conversation action dialogs as singletons from Chat Sidebar level

* chore: update webui build output

* fix: Render Actions Dropdown conditionally only when user hovers conversation item + remove unused markup

* chore: Update webui static build

* fix: Always truncate conversation names

* chore: Update webui static build
* common: introduce http.h for httplib-based client

This change moves cpp-httplib based URL parsing and client setup into
a new header `common/http.h`, and integrates it in `arg.cpp` and `run.cpp`.

It is an iteration towards removing libcurl, while intentionally
minimizing changes to existing code to guarantee the same behavior when
`LLAMA_CURL` is used.

Signed-off-by: Adrien Gallouët <[email protected]>

* tools : add missing WIN32_LEAN_AND_MEAN

Signed-off-by: Adrien Gallouët <[email protected]>

---------

Signed-off-by: Adrien Gallouët <[email protected]>
Signed-off-by: Adrien Gallouët <[email protected]>
* CI: Properly install rocwmma for hip builds

on windows we now windows install rocwmma from ubuntu pacakges

* CI: update linux rocm docker build to use rocm 7.0
…16075)

* Fix to use hidden_size_per_head

* Fix num heads

* Fix array

* Fix loading weights

* Support old GGUF converted by the previous version of llama.cpp

* Update src/llama-model.cpp

Co-authored-by: Sigbjørn Skjæret <[email protected]>

* Move shared parameter definitions to the outside of loop

* Not calculating n_embd_head_k,v by n_embd / n_head

---------

Co-authored-by: Sigbjørn Skjæret <[email protected]>
…0 (#16221)

* HIP: Disable ROCWMMA fatt on CDNA when compiled against ROCWMMA 2.0.0

rocwmma 2.0.0 includes a bug in the code fakeing fp16 accumulation on CDNA

* CUDA: Fix volta condition in ggml_cuda_should_use_wmma_fattn
* update oneapi to 2025.2, use deep-learning-essentials to replace base-tool

* update to 2025.2 use deeplearn essi to replace base toolkit

* add missed dll

* add deep learning essentials

* add sycl-ls

---------

Co-authored-by: Zhang Jianyu <[email protected]>
* First attempt

* No permute during convert (fixes qk tensors), proper norm application.

* RoPE = NeoX

* Coherence!

* Migrate xielu params from tensors to hyperparameters

* Simple CUDA kernel

* Revert stupid LLM refactorings

* Chat template support

* configchecker / flake8 errors

* Reorder unary.cu

* I do conclude that LLMs are, in fact, stupid.

* Fix after merge

* Final newline

* Make xIELU an UNARY_OP

* Final newline

* Correctly account for parameter shift

* Argh.

* Update ggml/src/ggml-cpu/unary-ops.cpp

Co-authored-by: Georgi Gerganov <[email protected]>

* Refactor: remove unused methods, inline and factorize softplus, add const modifiers

* Revert CUDA changes, implement xIELU as a separate OP

* Pesky newline

* Add float2half / half2float for F16 inputs/outputs

* CUDA variants, attempt 2

* Actually, attempt 3

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

Co-authored-by: Johannes Gäßler <[email protected]>

* Missing convert header

* Proper formula and reference for xIELU in the comments.

* Modify unary-ops.cpp to add the functor-based logic besides the template system to retain optimizations

* Apply suggestions from code review

Co-authored-by: Sigbjørn Skjæret <[email protected]>

* Add tensor mappings for Apertus to global list instead

* Fix lazy on scalars

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

Co-authored-by: Johannes Gäßler <[email protected]>

* Add comment about the constraints on positive/negative alpha

* Change `softplus` to `ggml_softplus`

---------

Co-authored-by: Georgi Gerganov <[email protected]>
Co-authored-by: Johannes Gäßler <[email protected]>
Co-authored-by: Sigbjørn Skjæret <[email protected]>
* Add inplace softmax

* Move rms_norm to split row approach

* Update debug for supports_op

* clean up debug statements

* Update tests/test-backend-ops.cpp

Co-authored-by: Georgi Gerganov <[email protected]>

---------

Co-authored-by: Georgi Gerganov <[email protected]>
…389)

* do not use more threads than physically available

* ensure n_threads > 0

Co-authored-by: Jeff Bolz <[email protected]>

---------

Co-authored-by: Jeff Bolz <[email protected]>
…rolling (#16356)

Use <svelte:window bind:innerHeight> instead of manual resize listener

Co-authored-by: Aleksander Grygier <[email protected]>
* fix: Include just the currently active message branches instead of all in chat completions request

* chore: Build webui static output

* chore: Formatting

* chore: update webui build output
…quest (#16405)

* feat: Capture model name only after first token (streaming) or completed request (non-streaming)

* chore: update webui build output

* chore: update webui build output
This commit updates the macos-13 runners to macos-15-intel.

The motivation for this changes is the macos-13 runners are scheduled
to be retired on 2025-12-04.

Refs: https://github.blog/changelog/2025-09-19-github-actions-macos-13-runner-image-is-closing-down/
When computing sinks, the cm1 shader was looping r from 0 to Br rather than
to rows_per_thread. I must have copied this from the scalar path (where it is
correct), and somehow it wasn't causing failures on current drivers.
…6354)

* vulkan: Replace uses of maxMemoryAllocationSize and VK_WHOLE_SIZE

Replace maxMemoryAllocationSize check with maxBufferSize when creating buffers.
The maxMemoryAllocationSize limit is a "soft" limit and allocations can succeed
beyond that limit. This allows > 4GB buffers to be allocated on some
implementations (e.g. NVIDIA) and tensors this large can be used for im2col
and mul_mat.

For temporary buffers (prealloc_x/y/etc) check against maxStorageBufferRange.
I'm not sure this check is ideal, but we always use these buffers as a single
full size binding and the limit may be smaller than maxMemoryAllocationSize
or maxBufferSize, so I think this is reasonable.

Replace descriptor range uses of VK_WHOLE_SIZE with a manually computed range.
The maxStorageBufferRange may be smaller than the maxBufferSize or
maxMemoryAllocationSize (and the Vulkan spec warns about this in a note) and
it's invalid usage if VK_WHOLE_SIZE computes a range larger than
maxStorageBufferRange.

With this change, it should be possible to generate videos using wan networks
in stable-diffusion.cpp.

* vulkan: Add env var GGML_VK_FORCE_MAX_BUFFER_SIZE and use stoull
* fix: resolve message disappearing issue when navigating between regenerated siblings by using current leaf nodes instead of cached sibling IDs

* chore: update webui build output

* chore: update webui build output
@loci-agentic-ai
Copy link

Access the complete analysis in the LOCI Dashboard

Performance Analysis Summary

Based on the analysis of version 296747b0-7085-4856-8739-61d7f83fe1f6 compared to baseline 07b56c89-7994-4194-a3c9-457b1a309ea8, the performance measurement tools indicate no significant changes in the critical inference functions.

Critical Functions Analysis

Core Inference Functions: No measurable performance changes detected in:

  • llama_decode() - Main token processing function
  • llama_encode() - Encoder model processing
  • llama_tokenize() - Text-to-token conversion
  • llama_detokenize() - Token-to-text conversion

Memory Management Functions: No performance impact detected in:

  • llama_memory_clear() - Memory clearing operations
  • llama_memory_seq_rm() - Sequence removal
  • llama_kv_cache_unified operations

Batch Processing Functions: No changes observed in:

  • llama_batch_init() - Batch initialization
  • llama_batch_get_one() - Single sequence batching

KPI Impact Analysis

1. Tokens Per Second

Status: No impact detected

  • Core Functions: llama_decode, llama_encode, llama_tokenize show no response time changes
  • Reference Impact: Based on the provided reference (smollm:135m on 12th Gen Intel i7-1255U), where 2ms slower llama_decode results in 7% tokens/sec reduction, no such degradation is present
  • Affected Functions: None identified with measurable changes

2. Power Consumption

Status: No measurable change

  • Binary Level Analysis: Power consumption analysis shows no significant changes between versions
  • Impacted Binaries: None detected with measurable power consumption changes
  • Cycle Count: No substantial increase in total throughput (cycle count) across binaries

3. Quantization Efficiency

Status: No impact on quantization functions

  • Quantization Functions: llama_model_quantize() shows no performance changes
  • Format Support: No changes detected in quantization format handling (Q4_0, Q4_1, Q8_0)
  • Memory Layout: Quantized model loading and processing remain unchanged

4. Memory Usage

Status: No significant memory management changes

  • KV Cache Operations: llama_kv_cache_unified and llama_memory_recurrent functions unchanged
  • Memory Allocation: GGML allocator functions show no performance impact
  • Memory Mapping: llama_mmap operations remain consistent

5. Batch Processing

Status: No batch processing performance changes

  • Batch Functions: llama_batch_init(), llama_batch_allocr operations unchanged
  • Parallel Processing: No changes in batch splitting or allocation efficiency
  • Context Parameters: n_batch and n_ubatch processing remains consistent

Code Changes Context

The changes in this version primarily involve:

  • Bicubic Interpolation Addition: New GGML_SCALE_MODE_BICUBIC mode in ggml_compute_forward_upscale_f32
  • Code Refactoring: Pixel offset calculation moved to shared scope
  • Algorithm Enhancement: Bicubic interpolation implementation for image processing operations

Action Items

Code Optimization

  • Interpolation Performance: Monitor bicubic interpolation usage in models that utilize upscaling operations
  • Memory Access Patterns: Verify cache efficiency in the new 4x4 pixel sampling pattern for bicubic mode
  • SIMD Opportunities: Consider vectorization of bicubic weight calculations for improved performance

Build Configuration

  • Compiler Optimizations: Ensure bicubic interpolation code benefits from compiler optimizations (-O3, -march=native)
  • Backend Selection: Verify CPU backend selection remains optimal for interpolation operations
  • Function Inlining: Check that lambda functions in bicubic implementation are properly inlined

Performance Validation

  • Interpolation Benchmarks: Test models using upscaling operations to measure bicubic vs bilinear performance
  • Memory Profiling: Validate that increased memory access in bicubic mode doesn't impact cache performance
  • Regression Testing: Confirm existing bilinear and nearest neighbor modes maintain performance

Conclusion

The version changes introduce new functionality (bicubic interpolation) without impacting the core inference pipeline performance. The critical functions responsible for token processing, memory management, and batch operations show no measurable performance degradation. The bicubic interpolation addition is isolated to specific upscaling operations and does not affect the primary inference KPIs.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.