Skip to content

Add windows to the CI - #98

Merged
ggerganov merged 1 commit into
ggml-org:masterfrom
etra0:windows-ci
Mar 13, 2023
Merged

ggerganov merged 1 commit into
ggml-org:masterfrom
etra0:windows-ci

Conversation

@etra0

@etra0 etra0 commented Mar 13, 2023

Copy link
Copy Markdown
Contributor

No description provided.

@ggerganov
ggerganov merged commit 2f700a2 into ggml-org:master Mar 13, 2023
blackhole89 pushed a commit that referenced this pull request Mar 15, 2023
jesusmb1995 pushed a commit to jesusmb1995/llama.cpp that referenced this pull request Feb 20, 2026
* ggml-vulkan: Add TQ2_0 dequantize and mul_mat vec

* ggml-vulkan: Enable coopmat support for Android

* ggml-vulkan: Add mul_mm path for TQ2_0

* SET_ROWS and GET_ROWS has no TQ2_0 support yet.

Signed-off-by: Marcus Edel <[email protected]>

* Vulkan: Fix TQ2_0 mul_mm pipeline

* Add support for microsoft/bitnet-b1.58-2B-4T (HF to GGUF).

Signed-off-by: Marcus Edel <[email protected]>

* Vulkan: TQ2_0 x Q8_1 MUL_MAT perf improvements

* Vulkan: Add TQ1_0 infra

* Vulkan: Add MUL_MAT_MAT and MUL_MAT_VEC support for TQ1

* Make sure we report the supported ops + datatypes.

Signed-off-by: Marcus Edel <[email protected]>

---------

Signed-off-by: Marcus Edel <[email protected]>
Co-authored-by: vineet <[email protected]>
Co-authored-by: Marcus Edel <[email protected]>
Co-authored-by: Italo Nicola <[email protected]>
jesusmb1995 pushed a commit to jesusmb1995/llama.cpp that referenced this pull request Mar 4, 2026
* ggml-vulkan: Add TQ2_0 dequantize and mul_mat vec

* ggml-vulkan: Enable coopmat support for Android

* ggml-vulkan: Add mul_mm path for TQ2_0

* SET_ROWS and GET_ROWS has no TQ2_0 support yet.

Signed-off-by: Marcus Edel <[email protected]>

* Vulkan: Fix TQ2_0 mul_mm pipeline

* Add support for microsoft/bitnet-b1.58-2B-4T (HF to GGUF).

Signed-off-by: Marcus Edel <[email protected]>

* Vulkan: TQ2_0 x Q8_1 MUL_MAT perf improvements

* Vulkan: Add TQ1_0 infra

* Vulkan: Add MUL_MAT_MAT and MUL_MAT_VEC support for TQ1

* Make sure we report the supported ops + datatypes.

Signed-off-by: Marcus Edel <[email protected]>

---------

Signed-off-by: Marcus Edel <[email protected]>
Co-authored-by: vineet <[email protected]>
Co-authored-by: Marcus Edel <[email protected]>
Co-authored-by: Italo Nicola <[email protected]>
jesusmb1995 added a commit to jesusmb1995/llama.cpp that referenced this pull request Mar 20, 2026
* Fix lib name resolution (ggml-org#95)

* Update backend filename prefix for Windows and Linux to use 'qvac-ggml-'

* fix cmake exports

* add macro guards to prevent dlopen when dynamic backends disabled

* Update README.md

* metal : remove BF16 x F16 kernels (ggml-org#18456) (ggml-org#97)

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

* QVAC-13378: Model Metadata from .gguf without full loading (#100)

* add metadata helper

* improve_meta_handle

* improve_ptrs

* bugfix

* fixupIncrementalLoadingDupTensors

* fixupNamespaceDeletedMistake

* optimizeKvOnly

* attemptFixCi

* fixupEnumPollution

---------

Co-authored-by: gianni-cor <[email protected]>

* meta_get_str (ggml-org#101)

* Update linux runner for ubuntu-24-cmake-vulkan

* Update build.yml

* LoRA Finetuning (ggml-org#99)

* Add TQ2_0 and TQ1_0 support to the Metal backend. (ggml-org#85)

* Add TQ2_0 and TQ1_0 support to the Metal backend.

Signed-off-by: Marcus Edel <[email protected]>

* Add tq2_0/q8_0 fallback aliases for loongarch/riscv.

Signed-off-by: Marcus Edel <[email protected]>

* Resolve macro function for tq2_0/q8_0/q8_1 and split into two seperate functions.

Signed-off-by: Marcus Edel <[email protected]>

* Add missing backslash to fix the macOS CI workflow.

Signed-off-by: Marcus Edel <[email protected]>

* The Metal compiler doesn't allow constant address space on local variables.

Signed-off-by: Marcus Edel <[email protected]>

* Fix visionOS builds with LLAMA_HTTPLIB=OFF.

Signed-off-by: Marcus Edel <[email protected]>

* Fix WASM WebGPU builds with DLLAMA_BUILD_TOOLS=OFF.

Signed-off-by: Marcus Edel <[email protected]>

---------

Signed-off-by: Marcus Edel <[email protected]>

* Add inference support for BitNet models using Vulkan (ggml-org#98)

* ggml-vulkan: Add TQ2_0 dequantize and mul_mat vec

* ggml-vulkan: Enable coopmat support for Android

* ggml-vulkan: Add mul_mm path for TQ2_0

* SET_ROWS and GET_ROWS has no TQ2_0 support yet.

Signed-off-by: Marcus Edel <[email protected]>

* Vulkan: Fix TQ2_0 mul_mm pipeline

* Add support for microsoft/bitnet-b1.58-2B-4T (HF to GGUF).

Signed-off-by: Marcus Edel <[email protected]>

* Vulkan: TQ2_0 x Q8_1 MUL_MAT perf improvements

* Vulkan: Add TQ1_0 infra

* Vulkan: Add MUL_MAT_MAT and MUL_MAT_VEC support for TQ1

* Make sure we report the supported ops + datatypes.

Signed-off-by: Marcus Edel <[email protected]>

---------

Signed-off-by: Marcus Edel <[email protected]>
Co-authored-by: vineet <[email protected]>
Co-authored-by: Marcus Edel <[email protected]>
Co-authored-by: Italo Nicola <[email protected]>

* Ignore GGML_OP_SET_ROWS parameters during gradient calculation, since there is no effect on the output gradients.

Signed-off-by: Marcus Edel <[email protected]>

* Add lora finetuning from adapter

* Add: create new lora adapter for target modules to finetune if no lora is provided

* Fix identical loss over epochs; fix garbage lora initization

Signed-off-by: vineet <[email protected]>

* Remove lora training from finetune.cpp

Signed-off-by: vineet <[email protected]>

* Add adapter saving & other lora target modules

Signed-off-by: vineet <[email protected]>

* Add finetune-lora for lora finetuning in examples

Signed-off-by: vineet <[email protected]>

* Update README with finetune-lora

Signed-off-by: vineet <[email protected]>

* Add dequantization to out_prod cuda kernel

Signed-off-by: vineet <[email protected]>

* CPU: add support for fp16_fp32 OUT_PROD op

* Remove unused variable val_split.

Signed-off-by: Marcus Edel <[email protected]>

* Explicitly define the optimizer, to fix missing initializer for member issue.

Signed-off-by: Marcus Edel <[email protected]>

* finetune-lora: Add checkpoint saving & resuming from saved checkpoint
This commit adds checkpointing for fine-tuning:
- Add checkpoint saving every N steps with --checkpoint-save-steps
- Save complete training state: model weights, optimizer state, metadata
- Implement two-phase optimizer state loading to avoid memory issues
- Add --resume-from and --auto-resume functionality
- Store optimizer momentum/variance tensors in GGUF format
- Add checkpoint validation for rank, alpha, and target modules
- Update README.md with checkpointing documentation

The optimizer state loading: iteration count is loaded during initialization,
while tensor data (grad_m, grad_v) is loaded after ggml_opt_alloc creates
the proper tensor structures.

* Add simple test to choose the right datatype based on the supported OUT_PROD datatype implementation.

Signed-off-by: Marcus Edel <[email protected]>

* Add OUT_PROD, RMS_NORM_BACK, SILU_BACK metal shader.

Signed-off-by: Marcus Edel <[email protected]>

* lora: Fix LoRA K/V gradient flow with gradient-connected kv cache retrieval

Add get_k_lora() and get_v_lora() methods that use concatenation

instead of ggml_view_4d to maintain gradient connectivity during

training. This ensures LoRA K/V parameters receive proper gradients

while preserving causal attention behavior.

* lora: Add Instruction Finetuning support

- Add masked loss computation on assistant responses only

- Implement Vulkan masked cross-entropy loss shader & count_equal shader
- Support default ChatML template & custom jinja chat templates

* Add SOFT_MAX_BACK metal kernel.

Signed-off-by: Marcus Edel <[email protected]>

* Extend swift example app with finetuning support.

Signed-off-by: Marcus Edel <[email protected]>

* Fix Q4 OUT_PROD iq upper handling.

Signed-off-by: Marcus Edel <[email protected]>

* Add learning rate scheduler: constant (default), linear, and cosine.

Signed-off-by: Marcus Edel <[email protected]>

* Add warmup-ratio parameter to match HF training.

Signed-off-by: Marcus Edel <[email protected]>

* lora: Fix lr assertion on step 0

* lora: Fix training start from step 2

* Added

* Updating code to enable mid-epoch cancellation

* cpp lint applied

* Fix geglu_back implementation

- Fix CPU implementation: now correctly computes gelu_backward(gate, grad) instead of
splitting computation across two halves
- Update Vulkan shader to match corrected implementation with proper gelu_backward
- Add a test for geglu_back op

The previous implementation incorrectly assumed geglu_back operated on concatenated
tensors and split them. The correct implementation computes the GELU backward pass
element-wise on the gate values.

* Gemma Chat Template Support for LoRA Finetuning

- Add auto-detection for Gemma format (<start_of_turn>model\n...<end_of_turn>)
- Falls back to ChatML format for other models
- Uses models default chat-template i.e. no need for jinja chat-template

This enables instruction finetuning on any model.

* Fixed ibatch Mismatch in llama_opt_epoch Resume

* CPP lint ran

* lora: Update readme; add architecture overview

* Add guide about how to support a new model.

Signed-off-by: Marcus Edel <[email protected]>

* Simplify main README to focus on LoRA finetuning. (ggml-org#71)

Signed-off-by: Marcus Edel <[email protected]>

* Vulkan: add support for fp32 OUT_PROD op

* Vulkan: add support for f16_f32 OUT_PROD op

* Vulkan: Add Q4_0/Q8_0 OUT_PROD Vulkan support

* vulkan: Add initial cross entropy loss backward shader

Signed-off-by: vineet <[email protected]>

* vulkan: Fix cross-entropy-loss-back dispatch size and wg denominator

Signed-off-by: vineet <[email protected]>

* vulkan: Change uint32 cast to int32 for outprod; allows android compilation

Signed-off-by: vineet <[email protected]>

* vulkan: Set specialization constants to { 0 } for out_prod

This fixes the vkDeviceLostError on Mali

* vulkan: Set out_prod pipeline disable_robustness to true

* Fix out_prod; vulkan ci issues

* Add GEGLU backward (Vulkan) to enable Gemma training.

* Vulkan: Clean up OUT_PROD shader and pipelines

Shouldn't change any behavior since currently nb00 is always 1.
Robustness is usually disabled for Q8/Q4 shaders since having it enabled
impacts performance more significantly for those types than F16/F32.

* Vulkan: Improve Q8 OUT_PROD performance

Increase OUT_PROD Q8 performance through improving memory locality.

* metal: port OUT_PROD, SILU_BACK, SOFT_MAX_BACK, RMS_NORM_BACK ops to split architecture

* Backport shader.

Signed-off-by: Marcus Edel <[email protected]>

* Initialize sin_sign in rope kargs to fix broken positional encoding.

Signed-off-by: Marcus Edel <[email protected]>

* Fix Windows build by using path::string() for wchar_t conversion

Signed-off-by: Marcus Edel <[email protected]>

* Fix format specifiers for int64_t portability.

Signed-off-by: Marcus Edel <[email protected]>

* Add missing resume_from_batch arg to llama_opt_epoch call.

Signed-off-by: Marcus Edel <[email protected]>

* Fix TQ2_0 dequantization.

Signed-off-by: Marcus Edel <[email protected]>

* Fix slow ReBAR reads on discrete GPUs and relax contiguity checks for backward pass.

Signed-off-by: Marcus Edel <[email protected]>

* Use VMA random-access host alloc, skip n_ctx padding and host-buft override during training.

Signed-off-by: Marcus Edel <[email protected]>

* Fix loss calculation and TQ2_0 dequantization.

Signed-off-by: Marcus Edel <[email protected]>

* ggml-vulkan: workaround for Adreno MUL_MAT Q6_K

* ggml-vulkan: workaround for Adreno MUL_MAT TQ1

* vulkan: revert graph_optimize skip for prompt processing

* vulkan: ensure host coherent memory on UMA devices

Signed-off-by: vineet <[email protected]>

* ggml-vulkan: fix GGML_VULKAN_CHECK_RESULTS

* ggml-vulkan: skip CROSS_ENTROPY_LOSS_MASKED for check_results

* ggml-vulkan: skip COUNT_EQUAL_MASKED for check_results

* ggml-vulkan: improve OUT_PROD Q4 performance

* Fix LLAMA_LORA_TARGET_ALL bitmask

Signed-off-by: makaveli10 <[email protected]>

* Preserve C API compatibility for llama_opt_epoch

Add llama_opt_epoch_resume function for the resume-from-batch
use case and update callers accordingly.

Signed-off-by: makaveli10 <[email protected]>

* lora: enhance LoRA init safety and simplify caller

- Add overflow and error checks for snprintf when generating LoRA tensor names
- Encapsulate tensor pointer validation within llama_lora_init_tensor_weights()
  and return bool to simplify the caller

Signed-off-by: makaveli10 <[email protected]>

* training: add llama_opt_default_params and use it in examples

Signed-off-by: makaveli10 <[email protected]>

* training: add reproducible seed, improve safety and style in LoRA training

Signed-off-by: makaveli10 <[email protected]>

* training: refactor LoRA tensor init to use exceptions

Signed-off-by: makaveli10 <[email protected]>

* ggml-opt: refactor batch memory copying to use lambda

Signed-off-by: makaveli10 <[email protected]>

* fix: typo in ggml.c & README

Signed-off-by: makaveli10 <[email protected]>

* training: document masking constraints and fix metadata extension

Signed-off-by: makaveli10 <[email protected]>

* tests: add ops tests for cross_entropy_loss_masked

Signed-off-by: makaveli10 <[email protected]>

* Add bounds check for --chat-template argument parsing & remove stray backslash

Signed-off-by: makaveli10 <[email protected]>

* training: add TODO for refactoring CLI argument parsing

Signed-off-by: makaveli10 <[email protected]>

* training: add a comment about dropout not being used yet

Signed-off-by: makaveli10 <[email protected]>

* training: add static_assert to catch llama_layer padding issues

Signed-off-by: makaveli10 <[email protected]>

* graph: restore ggml_view_4d for non-contiguous Q tensor support

Signed-off-by: makaveli10 <[email protected]>

* ggml-vulkan: Add buffer sync to cross_entropy_loss_masked_back op

* ggml-vulkan: add support for tiling as a workaround for memory issues

* The Metal ADD shader already uses strides for indexing, so non-contiguous tensors work correctly.

Signed-off-by: Marcus Edel <[email protected]>

* Wrap tensor and make it contiguous.

Signed-off-by: Marcus Edel <[email protected]>

* Add comment on graph_max_nodes bump for LoRA finetuning.

Signed-off-by: Marcus Edel <[email protected]>

* fix: resume_from_batch=0 incorrectly treated as no-resume in opt_epoch

llama_opt_epoch_resume accepts a resume_from_batch parameter where -1
means "no resume, start from the beginning." However, opt_epoch used
`resume_from_batch > 0` to distinguish resume from non-resume, which
means resume_from_batch=0 (a valid value meaning "batch 0 was the last
completed, start from batch 1") was silently treated as no-resume,
causing the entire epoch to replay from the start.

This affects any caller that pauses training after the first batch of
an epoch (globalStep=1, or any globalStep that is a multiple of
stepsPerEpoch + 1), since the computed resume batch offset modulo
stepsPerEpoch is 0.

Fix: change `> 0` to `>= 0` in both the idata start position and the
idata_in_loop calculation, so that -1 remains the only sentinel for
"no resume."

Made-with: Cursor

* Fix memory leak in optimizer state loading.

Signed-off-by: Marcus Edel <[email protected]>

* Disable command-buffer concurrency by default on iOS.

Signed-off-by: Marcus Edel <[email protected]>

* Override and default to n_cb=2 on iOS.

Signed-off-by: Marcus Edel <[email protected]>

* fix: restore context state for inference after training cleanup

Save and restore n_ctx_train in opt_init/opt_cleanup to prevent
training from permanently modifying the model's context length.
Reset the scheduler and clear the previous graph result in opt_cleanup
so the context can be reused for inference after finetuning.

Made-with: Cursor

* Add @autoreleasepool to encode_async block to prevent ObjC object accumulation on GCD worker threads.

Signed-off-by: Marcus Edel <[email protected]>

* fix: keep output tensor on CPU for iOS to avoid Metal buffer limits

On iOS, cap GPU-offloaded layers at n_layer (excluding the output layer)
to prevent exceeding Metal memory constraints on mobile devices.

Made-with: Cursor

* Remove unused variable 'tensor_name'.

Signed-off-by: Marcus Edel <[email protected]>

* training: fix LLAMA_LORA_TARGET_ALL for ISO C compliance

Signed-off-by: makaveli10 <[email protected]>

* ci: disable native CPU optimizations for x64-cpu-low-perf builds

Signed-off-by: makaveli10 <[email protected]>

* ci: increase timeout for ubuntu-24-cmake-vulkan tests

Signed-off-by: makaveli10 <[email protected]>

* Add resume-from-checkpoint support to Metal LoRA fine-tuning

Signed-off-by: makaveli10 <[email protected]>

* Fix missing parameters for llama_swift_finetune_options

Signed-off-by: Italo Nicola <[email protected]>

* tests: disable TQ2_0 tests in test-backend-ops due to llvmpipe bug

Temporarily disable TQ2_0 quantization tests to work around a bug in
llvmpipe. Tests pass successfully on all real Vulkan hardware
(Nvidia, ARM GPUs) but fail on llvmpipe with high error values.

Signed-off-by: makaveli10 <[email protected]>

* Enable the tests again.

Signed-off-by: Marcus Edel <[email protected]>

---------

Signed-off-by: Marcus Edel <[email protected]>
Signed-off-by: vineet <[email protected]>
Signed-off-by: makaveli10 <[email protected]>
Signed-off-by: Italo Nicola <[email protected]>
Co-authored-by: gianni <[email protected]>
Co-authored-by: vineet <[email protected]>
Co-authored-by: Italo Nicola <[email protected]>
Co-authored-by: Nidhin <[email protected]>
Co-authored-by: Alexandros Frantzis <[email protected]>
Co-authored-by: gianni-cor <[email protected]>

---------

Signed-off-by: Marcus Edel <[email protected]>
Signed-off-by: vineet <[email protected]>
Signed-off-by: makaveli10 <[email protected]>
Signed-off-by: Italo Nicola <[email protected]>
Co-authored-by: Georgi Gerganov <[email protected]>
Co-authored-by: Jesús <[email protected]>
Co-authored-by: Marcus Edel <[email protected]>
Co-authored-by: vineet <[email protected]>
Co-authored-by: Italo Nicola <[email protected]>
Co-authored-by: Nidhin <[email protected]>
Co-authored-by: Alexandros Frantzis <[email protected]>
jesusmb1995 pushed a commit to jesusmb1995/llama.cpp that referenced this pull request Mar 23, 2026
* Add TQ2_0 and TQ1_0 support to the Metal backend. (ggml-org#85)

* Add TQ2_0 and TQ1_0 support to the Metal backend.

Signed-off-by: Marcus Edel <[email protected]>

* Add tq2_0/q8_0 fallback aliases for loongarch/riscv.

Signed-off-by: Marcus Edel <[email protected]>

* Resolve macro function for tq2_0/q8_0/q8_1 and split into two seperate functions.

Signed-off-by: Marcus Edel <[email protected]>

* Add missing backslash to fix the macOS CI workflow.

Signed-off-by: Marcus Edel <[email protected]>

* The Metal compiler doesn't allow constant address space on local variables.

Signed-off-by: Marcus Edel <[email protected]>

* Fix visionOS builds with LLAMA_HTTPLIB=OFF.

Signed-off-by: Marcus Edel <[email protected]>

* Fix WASM WebGPU builds with DLLAMA_BUILD_TOOLS=OFF.

Signed-off-by: Marcus Edel <[email protected]>

---------

Signed-off-by: Marcus Edel <[email protected]>

* Add inference support for BitNet models using Vulkan (ggml-org#98)

* ggml-vulkan: Add TQ2_0 dequantize and mul_mat vec

* ggml-vulkan: Enable coopmat support for Android

* ggml-vulkan: Add mul_mm path for TQ2_0

* SET_ROWS and GET_ROWS has no TQ2_0 support yet.

Signed-off-by: Marcus Edel <[email protected]>

* Vulkan: Fix TQ2_0 mul_mm pipeline

* Add support for microsoft/bitnet-b1.58-2B-4T (HF to GGUF).

Signed-off-by: Marcus Edel <[email protected]>

* Vulkan: TQ2_0 x Q8_1 MUL_MAT perf improvements

* Vulkan: Add TQ1_0 infra

* Vulkan: Add MUL_MAT_MAT and MUL_MAT_VEC support for TQ1

* Make sure we report the supported ops + datatypes.

Signed-off-by: Marcus Edel <[email protected]>

---------

Signed-off-by: Marcus Edel <[email protected]>
Co-authored-by: vineet <[email protected]>
Co-authored-by: Marcus Edel <[email protected]>
Co-authored-by: Italo Nicola <[email protected]>

* Ignore GGML_OP_SET_ROWS parameters during gradient calculation, since there is no effect on the output gradients.

Signed-off-by: Marcus Edel <[email protected]>

* Add lora finetuning from adapter

* Add: create new lora adapter for target modules to finetune if no lora is provided

* Fix identical loss over epochs; fix garbage lora initization

Signed-off-by: vineet <[email protected]>

* Remove lora training from finetune.cpp

Signed-off-by: vineet <[email protected]>

* Add adapter saving & other lora target modules

Signed-off-by: vineet <[email protected]>

* Add finetune-lora for lora finetuning in examples

Signed-off-by: vineet <[email protected]>

* Update README with finetune-lora

Signed-off-by: vineet <[email protected]>

* Add dequantization to out_prod cuda kernel

Signed-off-by: vineet <[email protected]>

* CPU: add support for fp16_fp32 OUT_PROD op

* Remove unused variable val_split.

Signed-off-by: Marcus Edel <[email protected]>

* Explicitly define the optimizer, to fix missing initializer for member issue.

Signed-off-by: Marcus Edel <[email protected]>

* finetune-lora: Add checkpoint saving & resuming from saved checkpoint
This commit adds checkpointing for fine-tuning:
- Add checkpoint saving every N steps with --checkpoint-save-steps
- Save complete training state: model weights, optimizer state, metadata
- Implement two-phase optimizer state loading to avoid memory issues
- Add --resume-from and --auto-resume functionality
- Store optimizer momentum/variance tensors in GGUF format
- Add checkpoint validation for rank, alpha, and target modules
- Update README.md with checkpointing documentation

The optimizer state loading: iteration count is loaded during initialization,
while tensor data (grad_m, grad_v) is loaded after ggml_opt_alloc creates
the proper tensor structures.

* Add simple test to choose the right datatype based on the supported OUT_PROD datatype implementation.

Signed-off-by: Marcus Edel <[email protected]>

* Add OUT_PROD, RMS_NORM_BACK, SILU_BACK metal shader.

Signed-off-by: Marcus Edel <[email protected]>

* lora: Fix LoRA K/V gradient flow with gradient-connected kv cache retrieval

Add get_k_lora() and get_v_lora() methods that use concatenation

instead of ggml_view_4d to maintain gradient connectivity during

training. This ensures LoRA K/V parameters receive proper gradients

while preserving causal attention behavior.

* lora: Add Instruction Finetuning support

- Add masked loss computation on assistant responses only

- Implement Vulkan masked cross-entropy loss shader & count_equal shader
- Support default ChatML template & custom jinja chat templates

* Add SOFT_MAX_BACK metal kernel.

Signed-off-by: Marcus Edel <[email protected]>

* Extend swift example app with finetuning support.

Signed-off-by: Marcus Edel <[email protected]>

* Fix Q4 OUT_PROD iq upper handling.

Signed-off-by: Marcus Edel <[email protected]>

* Add learning rate scheduler: constant (default), linear, and cosine.

Signed-off-by: Marcus Edel <[email protected]>

* Add warmup-ratio parameter to match HF training.

Signed-off-by: Marcus Edel <[email protected]>

* lora: Fix lr assertion on step 0

* lora: Fix training start from step 2

* Added

* Updating code to enable mid-epoch cancellation

* cpp lint applied

* Fix geglu_back implementation

- Fix CPU implementation: now correctly computes gelu_backward(gate, grad) instead of
splitting computation across two halves
- Update Vulkan shader to match corrected implementation with proper gelu_backward
- Add a test for geglu_back op

The previous implementation incorrectly assumed geglu_back operated on concatenated
tensors and split them. The correct implementation computes the GELU backward pass
element-wise on the gate values.

* Gemma Chat Template Support for LoRA Finetuning

- Add auto-detection for Gemma format (<start_of_turn>model\n...<end_of_turn>)
- Falls back to ChatML format for other models
- Uses models default chat-template i.e. no need for jinja chat-template

This enables instruction finetuning on any model.

* Fixed ibatch Mismatch in llama_opt_epoch Resume

* CPP lint ran

* lora: Update readme; add architecture overview

* Add guide about how to support a new model.

Signed-off-by: Marcus Edel <[email protected]>

* Simplify main README to focus on LoRA finetuning. (ggml-org#71)

Signed-off-by: Marcus Edel <[email protected]>

* Vulkan: add support for fp32 OUT_PROD op

* Vulkan: add support for f16_f32 OUT_PROD op

* Vulkan: Add Q4_0/Q8_0 OUT_PROD Vulkan support

* vulkan: Add initial cross entropy loss backward shader

Signed-off-by: vineet <[email protected]>

* vulkan: Fix cross-entropy-loss-back dispatch size and wg denominator

Signed-off-by: vineet <[email protected]>

* vulkan: Change uint32 cast to int32 for outprod; allows android compilation

Signed-off-by: vineet <[email protected]>

* vulkan: Set specialization constants to { 0 } for out_prod

This fixes the vkDeviceLostError on Mali

* vulkan: Set out_prod pipeline disable_robustness to true

* Fix out_prod; vulkan ci issues

* Add GEGLU backward (Vulkan) to enable Gemma training.

* Vulkan: Clean up OUT_PROD shader and pipelines

Shouldn't change any behavior since currently nb00 is always 1.
Robustness is usually disabled for Q8/Q4 shaders since having it enabled
impacts performance more significantly for those types than F16/F32.

* Vulkan: Improve Q8 OUT_PROD performance

Increase OUT_PROD Q8 performance through improving memory locality.

* metal: port OUT_PROD, SILU_BACK, SOFT_MAX_BACK, RMS_NORM_BACK ops to split architecture

* Backport shader.

Signed-off-by: Marcus Edel <[email protected]>

* Initialize sin_sign in rope kargs to fix broken positional encoding.

Signed-off-by: Marcus Edel <[email protected]>

* Fix Windows build by using path::string() for wchar_t conversion

Signed-off-by: Marcus Edel <[email protected]>

* Fix format specifiers for int64_t portability.

Signed-off-by: Marcus Edel <[email protected]>

* Add missing resume_from_batch arg to llama_opt_epoch call.

Signed-off-by: Marcus Edel <[email protected]>

* Fix TQ2_0 dequantization.

Signed-off-by: Marcus Edel <[email protected]>

* Fix slow ReBAR reads on discrete GPUs and relax contiguity checks for backward pass.

Signed-off-by: Marcus Edel <[email protected]>

* Use VMA random-access host alloc, skip n_ctx padding and host-buft override during training.

Signed-off-by: Marcus Edel <[email protected]>

* Fix loss calculation and TQ2_0 dequantization.

Signed-off-by: Marcus Edel <[email protected]>

* ggml-vulkan: workaround for Adreno MUL_MAT Q6_K

* ggml-vulkan: workaround for Adreno MUL_MAT TQ1

* vulkan: revert graph_optimize skip for prompt processing

* vulkan: ensure host coherent memory on UMA devices

Signed-off-by: vineet <[email protected]>

* ggml-vulkan: fix GGML_VULKAN_CHECK_RESULTS

* ggml-vulkan: skip CROSS_ENTROPY_LOSS_MASKED for check_results

* ggml-vulkan: skip COUNT_EQUAL_MASKED for check_results

* ggml-vulkan: improve OUT_PROD Q4 performance

* Fix LLAMA_LORA_TARGET_ALL bitmask

Signed-off-by: makaveli10 <[email protected]>

* Preserve C API compatibility for llama_opt_epoch

Add llama_opt_epoch_resume function for the resume-from-batch
use case and update callers accordingly.

Signed-off-by: makaveli10 <[email protected]>

* lora: enhance LoRA init safety and simplify caller

- Add overflow and error checks for snprintf when generating LoRA tensor names
- Encapsulate tensor pointer validation within llama_lora_init_tensor_weights()
  and return bool to simplify the caller

Signed-off-by: makaveli10 <[email protected]>

* training: add llama_opt_default_params and use it in examples

Signed-off-by: makaveli10 <[email protected]>

* training: add reproducible seed, improve safety and style in LoRA training

Signed-off-by: makaveli10 <[email protected]>

* training: refactor LoRA tensor init to use exceptions

Signed-off-by: makaveli10 <[email protected]>

* ggml-opt: refactor batch memory copying to use lambda

Signed-off-by: makaveli10 <[email protected]>

* fix: typo in ggml.c & README

Signed-off-by: makaveli10 <[email protected]>

* training: document masking constraints and fix metadata extension

Signed-off-by: makaveli10 <[email protected]>

* tests: add ops tests for cross_entropy_loss_masked

Signed-off-by: makaveli10 <[email protected]>

* Add bounds check for --chat-template argument parsing & remove stray backslash

Signed-off-by: makaveli10 <[email protected]>

* training: add TODO for refactoring CLI argument parsing

Signed-off-by: makaveli10 <[email protected]>

* training: add a comment about dropout not being used yet

Signed-off-by: makaveli10 <[email protected]>

* training: add static_assert to catch llama_layer padding issues

Signed-off-by: makaveli10 <[email protected]>

* graph: restore ggml_view_4d for non-contiguous Q tensor support

Signed-off-by: makaveli10 <[email protected]>

* ggml-vulkan: Add buffer sync to cross_entropy_loss_masked_back op

* ggml-vulkan: add support for tiling as a workaround for memory issues

* The Metal ADD shader already uses strides for indexing, so non-contiguous tensors work correctly.

Signed-off-by: Marcus Edel <[email protected]>

* Wrap tensor and make it contiguous.

Signed-off-by: Marcus Edel <[email protected]>

* Add comment on graph_max_nodes bump for LoRA finetuning.

Signed-off-by: Marcus Edel <[email protected]>

* fix: resume_from_batch=0 incorrectly treated as no-resume in opt_epoch

llama_opt_epoch_resume accepts a resume_from_batch parameter where -1
means "no resume, start from the beginning." However, opt_epoch used
`resume_from_batch > 0` to distinguish resume from non-resume, which
means resume_from_batch=0 (a valid value meaning "batch 0 was the last
completed, start from batch 1") was silently treated as no-resume,
causing the entire epoch to replay from the start.

This affects any caller that pauses training after the first batch of
an epoch (globalStep=1, or any globalStep that is a multiple of
stepsPerEpoch + 1), since the computed resume batch offset modulo
stepsPerEpoch is 0.

Fix: change `> 0` to `>= 0` in both the idata start position and the
idata_in_loop calculation, so that -1 remains the only sentinel for
"no resume."

Made-with: Cursor

* Fix memory leak in optimizer state loading.

Signed-off-by: Marcus Edel <[email protected]>

* Disable command-buffer concurrency by default on iOS.

Signed-off-by: Marcus Edel <[email protected]>

* Override and default to n_cb=2 on iOS.

Signed-off-by: Marcus Edel <[email protected]>

* fix: restore context state for inference after training cleanup

Save and restore n_ctx_train in opt_init/opt_cleanup to prevent
training from permanently modifying the model's context length.
Reset the scheduler and clear the previous graph result in opt_cleanup
so the context can be reused for inference after finetuning.

Made-with: Cursor

* Add @autoreleasepool to encode_async block to prevent ObjC object accumulation on GCD worker threads.

Signed-off-by: Marcus Edel <[email protected]>

* fix: keep output tensor on CPU for iOS to avoid Metal buffer limits

On iOS, cap GPU-offloaded layers at n_layer (excluding the output layer)
to prevent exceeding Metal memory constraints on mobile devices.

Made-with: Cursor

* Remove unused variable 'tensor_name'.

Signed-off-by: Marcus Edel <[email protected]>

* training: fix LLAMA_LORA_TARGET_ALL for ISO C compliance

Signed-off-by: makaveli10 <[email protected]>

* ci: disable native CPU optimizations for x64-cpu-low-perf builds

Signed-off-by: makaveli10 <[email protected]>

* ci: increase timeout for ubuntu-24-cmake-vulkan tests

Signed-off-by: makaveli10 <[email protected]>

* Add resume-from-checkpoint support to Metal LoRA fine-tuning

Signed-off-by: makaveli10 <[email protected]>

* Fix missing parameters for llama_swift_finetune_options

Signed-off-by: Italo Nicola <[email protected]>

* tests: disable TQ2_0 tests in test-backend-ops due to llvmpipe bug

Temporarily disable TQ2_0 quantization tests to work around a bug in
llvmpipe. Tests pass successfully on all real Vulkan hardware
(Nvidia, ARM GPUs) but fail on llvmpipe with high error values.

Signed-off-by: makaveli10 <[email protected]>

* Enable the tests again.

Signed-off-by: Marcus Edel <[email protected]>

---------

Signed-off-by: Marcus Edel <[email protected]>
Signed-off-by: vineet <[email protected]>
Signed-off-by: makaveli10 <[email protected]>
Signed-off-by: Italo Nicola <[email protected]>
Co-authored-by: gianni <[email protected]>
Co-authored-by: vineet <[email protected]>
Co-authored-by: Italo Nicola <[email protected]>
Co-authored-by: Nidhin <[email protected]>
Co-authored-by: Alexandros Frantzis <[email protected]>
Co-authored-by: gianni-cor <[email protected]>
jesusmb1995 pushed a commit to jesusmb1995/llama.cpp that referenced this pull request Apr 8, 2026
* Add TQ2_0 and TQ1_0 support to the Metal backend. (ggml-org#85)

* Add TQ2_0 and TQ1_0 support to the Metal backend.

Signed-off-by: Marcus Edel <[email protected]>

* Add tq2_0/q8_0 fallback aliases for loongarch/riscv.

Signed-off-by: Marcus Edel <[email protected]>

* Resolve macro function for tq2_0/q8_0/q8_1 and split into two seperate functions.

Signed-off-by: Marcus Edel <[email protected]>

* Add missing backslash to fix the macOS CI workflow.

Signed-off-by: Marcus Edel <[email protected]>

* The Metal compiler doesn't allow constant address space on local variables.

Signed-off-by: Marcus Edel <[email protected]>

* Fix visionOS builds with LLAMA_HTTPLIB=OFF.

Signed-off-by: Marcus Edel <[email protected]>

* Fix WASM WebGPU builds with DLLAMA_BUILD_TOOLS=OFF.

Signed-off-by: Marcus Edel <[email protected]>

---------

Signed-off-by: Marcus Edel <[email protected]>

* Add inference support for BitNet models using Vulkan (ggml-org#98)

* ggml-vulkan: Add TQ2_0 dequantize and mul_mat vec

* ggml-vulkan: Enable coopmat support for Android

* ggml-vulkan: Add mul_mm path for TQ2_0

* SET_ROWS and GET_ROWS has no TQ2_0 support yet.

Signed-off-by: Marcus Edel <[email protected]>

* Vulkan: Fix TQ2_0 mul_mm pipeline

* Add support for microsoft/bitnet-b1.58-2B-4T (HF to GGUF).

Signed-off-by: Marcus Edel <[email protected]>

* Vulkan: TQ2_0 x Q8_1 MUL_MAT perf improvements

* Vulkan: Add TQ1_0 infra

* Vulkan: Add MUL_MAT_MAT and MUL_MAT_VEC support for TQ1

* Make sure we report the supported ops + datatypes.

Signed-off-by: Marcus Edel <[email protected]>

---------

Signed-off-by: Marcus Edel <[email protected]>
Co-authored-by: vineet <[email protected]>
Co-authored-by: Marcus Edel <[email protected]>
Co-authored-by: Italo Nicola <[email protected]>

* Ignore GGML_OP_SET_ROWS parameters during gradient calculation, since there is no effect on the output gradients.

Signed-off-by: Marcus Edel <[email protected]>

* Add lora finetuning from adapter

* Add: create new lora adapter for target modules to finetune if no lora is provided

* Fix identical loss over epochs; fix garbage lora initization

Signed-off-by: vineet <[email protected]>

* Remove lora training from finetune.cpp

Signed-off-by: vineet <[email protected]>

* Add adapter saving & other lora target modules

Signed-off-by: vineet <[email protected]>

* Add finetune-lora for lora finetuning in examples

Signed-off-by: vineet <[email protected]>

* Update README with finetune-lora

Signed-off-by: vineet <[email protected]>

* Add dequantization to out_prod cuda kernel

Signed-off-by: vineet <[email protected]>

* CPU: add support for fp16_fp32 OUT_PROD op

* Remove unused variable val_split.

Signed-off-by: Marcus Edel <[email protected]>

* Explicitly define the optimizer, to fix missing initializer for member issue.

Signed-off-by: Marcus Edel <[email protected]>

* finetune-lora: Add checkpoint saving & resuming from saved checkpoint
This commit adds checkpointing for fine-tuning:
- Add checkpoint saving every N steps with --checkpoint-save-steps
- Save complete training state: model weights, optimizer state, metadata
- Implement two-phase optimizer state loading to avoid memory issues
- Add --resume-from and --auto-resume functionality
- Store optimizer momentum/variance tensors in GGUF format
- Add checkpoint validation for rank, alpha, and target modules
- Update README.md with checkpointing documentation

The optimizer state loading: iteration count is loaded during initialization,
while tensor data (grad_m, grad_v) is loaded after ggml_opt_alloc creates
the proper tensor structures.

* Add simple test to choose the right datatype based on the supported OUT_PROD datatype implementation.

Signed-off-by: Marcus Edel <[email protected]>

* Add OUT_PROD, RMS_NORM_BACK, SILU_BACK metal shader.

Signed-off-by: Marcus Edel <[email protected]>

* lora: Fix LoRA K/V gradient flow with gradient-connected kv cache retrieval

Add get_k_lora() and get_v_lora() methods that use concatenation

instead of ggml_view_4d to maintain gradient connectivity during

training. This ensures LoRA K/V parameters receive proper gradients

while preserving causal attention behavior.

* lora: Add Instruction Finetuning support

- Add masked loss computation on assistant responses only

- Implement Vulkan masked cross-entropy loss shader & count_equal shader
- Support default ChatML template & custom jinja chat templates

* Add SOFT_MAX_BACK metal kernel.

Signed-off-by: Marcus Edel <[email protected]>

* Extend swift example app with finetuning support.

Signed-off-by: Marcus Edel <[email protected]>

* Fix Q4 OUT_PROD iq upper handling.

Signed-off-by: Marcus Edel <[email protected]>

* Add learning rate scheduler: constant (default), linear, and cosine.

Signed-off-by: Marcus Edel <[email protected]>

* Add warmup-ratio parameter to match HF training.

Signed-off-by: Marcus Edel <[email protected]>

* lora: Fix lr assertion on step 0

* lora: Fix training start from step 2

* Added

* Updating code to enable mid-epoch cancellation

* cpp lint applied

* Fix geglu_back implementation

- Fix CPU implementation: now correctly computes gelu_backward(gate, grad) instead of
splitting computation across two halves
- Update Vulkan shader to match corrected implementation with proper gelu_backward
- Add a test for geglu_back op

The previous implementation incorrectly assumed geglu_back operated on concatenated
tensors and split them. The correct implementation computes the GELU backward pass
element-wise on the gate values.

* Gemma Chat Template Support for LoRA Finetuning

- Add auto-detection for Gemma format (<start_of_turn>model\n...<end_of_turn>)
- Falls back to ChatML format for other models
- Uses models default chat-template i.e. no need for jinja chat-template

This enables instruction finetuning on any model.

* Fixed ibatch Mismatch in llama_opt_epoch Resume

* CPP lint ran

* lora: Update readme; add architecture overview

* Add guide about how to support a new model.

Signed-off-by: Marcus Edel <[email protected]>

* Simplify main README to focus on LoRA finetuning. (ggml-org#71)

Signed-off-by: Marcus Edel <[email protected]>

* Vulkan: add support for fp32 OUT_PROD op

* Vulkan: add support for f16_f32 OUT_PROD op

* Vulkan: Add Q4_0/Q8_0 OUT_PROD Vulkan support

* vulkan: Add initial cross entropy loss backward shader

Signed-off-by: vineet <[email protected]>

* vulkan: Fix cross-entropy-loss-back dispatch size and wg denominator

Signed-off-by: vineet <[email protected]>

* vulkan: Change uint32 cast to int32 for outprod; allows android compilation

Signed-off-by: vineet <[email protected]>

* vulkan: Set specialization constants to { 0 } for out_prod

This fixes the vkDeviceLostError on Mali

* vulkan: Set out_prod pipeline disable_robustness to true

* Fix out_prod; vulkan ci issues

* Add GEGLU backward (Vulkan) to enable Gemma training.

* Vulkan: Clean up OUT_PROD shader and pipelines

Shouldn't change any behavior since currently nb00 is always 1.
Robustness is usually disabled for Q8/Q4 shaders since having it enabled
impacts performance more significantly for those types than F16/F32.

* Vulkan: Improve Q8 OUT_PROD performance

Increase OUT_PROD Q8 performance through improving memory locality.

* metal: port OUT_PROD, SILU_BACK, SOFT_MAX_BACK, RMS_NORM_BACK ops to split architecture

* Backport shader.

Signed-off-by: Marcus Edel <[email protected]>

* Initialize sin_sign in rope kargs to fix broken positional encoding.

Signed-off-by: Marcus Edel <[email protected]>

* Fix Windows build by using path::string() for wchar_t conversion

Signed-off-by: Marcus Edel <[email protected]>

* Fix format specifiers for int64_t portability.

Signed-off-by: Marcus Edel <[email protected]>

* Add missing resume_from_batch arg to llama_opt_epoch call.

Signed-off-by: Marcus Edel <[email protected]>

* Fix TQ2_0 dequantization.

Signed-off-by: Marcus Edel <[email protected]>

* Fix slow ReBAR reads on discrete GPUs and relax contiguity checks for backward pass.

Signed-off-by: Marcus Edel <[email protected]>

* Use VMA random-access host alloc, skip n_ctx padding and host-buft override during training.

Signed-off-by: Marcus Edel <[email protected]>

* Fix loss calculation and TQ2_0 dequantization.

Signed-off-by: Marcus Edel <[email protected]>

* ggml-vulkan: workaround for Adreno MUL_MAT Q6_K

* ggml-vulkan: workaround for Adreno MUL_MAT TQ1

* vulkan: revert graph_optimize skip for prompt processing

* vulkan: ensure host coherent memory on UMA devices

Signed-off-by: vineet <[email protected]>

* ggml-vulkan: fix GGML_VULKAN_CHECK_RESULTS

* ggml-vulkan: skip CROSS_ENTROPY_LOSS_MASKED for check_results

* ggml-vulkan: skip COUNT_EQUAL_MASKED for check_results

* ggml-vulkan: improve OUT_PROD Q4 performance

* Fix LLAMA_LORA_TARGET_ALL bitmask

Signed-off-by: makaveli10 <[email protected]>

* Preserve C API compatibility for llama_opt_epoch

Add llama_opt_epoch_resume function for the resume-from-batch
use case and update callers accordingly.

Signed-off-by: makaveli10 <[email protected]>

* lora: enhance LoRA init safety and simplify caller

- Add overflow and error checks for snprintf when generating LoRA tensor names
- Encapsulate tensor pointer validation within llama_lora_init_tensor_weights()
  and return bool to simplify the caller

Signed-off-by: makaveli10 <[email protected]>

* training: add llama_opt_default_params and use it in examples

Signed-off-by: makaveli10 <[email protected]>

* training: add reproducible seed, improve safety and style in LoRA training

Signed-off-by: makaveli10 <[email protected]>

* training: refactor LoRA tensor init to use exceptions

Signed-off-by: makaveli10 <[email protected]>

* ggml-opt: refactor batch memory copying to use lambda

Signed-off-by: makaveli10 <[email protected]>

* fix: typo in ggml.c & README

Signed-off-by: makaveli10 <[email protected]>

* training: document masking constraints and fix metadata extension

Signed-off-by: makaveli10 <[email protected]>

* tests: add ops tests for cross_entropy_loss_masked

Signed-off-by: makaveli10 <[email protected]>

* Add bounds check for --chat-template argument parsing & remove stray backslash

Signed-off-by: makaveli10 <[email protected]>

* training: add TODO for refactoring CLI argument parsing

Signed-off-by: makaveli10 <[email protected]>

* training: add a comment about dropout not being used yet

Signed-off-by: makaveli10 <[email protected]>

* training: add static_assert to catch llama_layer padding issues

Signed-off-by: makaveli10 <[email protected]>

* graph: restore ggml_view_4d for non-contiguous Q tensor support

Signed-off-by: makaveli10 <[email protected]>

* ggml-vulkan: Add buffer sync to cross_entropy_loss_masked_back op

* ggml-vulkan: add support for tiling as a workaround for memory issues

* The Metal ADD shader already uses strides for indexing, so non-contiguous tensors work correctly.

Signed-off-by: Marcus Edel <[email protected]>

* Wrap tensor and make it contiguous.

Signed-off-by: Marcus Edel <[email protected]>

* Add comment on graph_max_nodes bump for LoRA finetuning.

Signed-off-by: Marcus Edel <[email protected]>

* fix: resume_from_batch=0 incorrectly treated as no-resume in opt_epoch

llama_opt_epoch_resume accepts a resume_from_batch parameter where -1
means "no resume, start from the beginning." However, opt_epoch used
`resume_from_batch > 0` to distinguish resume from non-resume, which
means resume_from_batch=0 (a valid value meaning "batch 0 was the last
completed, start from batch 1") was silently treated as no-resume,
causing the entire epoch to replay from the start.

This affects any caller that pauses training after the first batch of
an epoch (globalStep=1, or any globalStep that is a multiple of
stepsPerEpoch + 1), since the computed resume batch offset modulo
stepsPerEpoch is 0.

Fix: change `> 0` to `>= 0` in both the idata start position and the
idata_in_loop calculation, so that -1 remains the only sentinel for
"no resume."

Made-with: Cursor

* Fix memory leak in optimizer state loading.

Signed-off-by: Marcus Edel <[email protected]>

* Disable command-buffer concurrency by default on iOS.

Signed-off-by: Marcus Edel <[email protected]>

* Override and default to n_cb=2 on iOS.

Signed-off-by: Marcus Edel <[email protected]>

* fix: restore context state for inference after training cleanup

Save and restore n_ctx_train in opt_init/opt_cleanup to prevent
training from permanently modifying the model's context length.
Reset the scheduler and clear the previous graph result in opt_cleanup
so the context can be reused for inference after finetuning.

Made-with: Cursor

* Add @autoreleasepool to encode_async block to prevent ObjC object accumulation on GCD worker threads.

Signed-off-by: Marcus Edel <[email protected]>

* fix: keep output tensor on CPU for iOS to avoid Metal buffer limits

On iOS, cap GPU-offloaded layers at n_layer (excluding the output layer)
to prevent exceeding Metal memory constraints on mobile devices.

Made-with: Cursor

* Remove unused variable 'tensor_name'.

Signed-off-by: Marcus Edel <[email protected]>

* training: fix LLAMA_LORA_TARGET_ALL for ISO C compliance

Signed-off-by: makaveli10 <[email protected]>

* ci: disable native CPU optimizations for x64-cpu-low-perf builds

Signed-off-by: makaveli10 <[email protected]>

* ci: increase timeout for ubuntu-24-cmake-vulkan tests

Signed-off-by: makaveli10 <[email protected]>

* Add resume-from-checkpoint support to Metal LoRA fine-tuning

Signed-off-by: makaveli10 <[email protected]>

* Fix missing parameters for llama_swift_finetune_options

Signed-off-by: Italo Nicola <[email protected]>

* tests: disable TQ2_0 tests in test-backend-ops due to llvmpipe bug

Temporarily disable TQ2_0 quantization tests to work around a bug in
llvmpipe. Tests pass successfully on all real Vulkan hardware
(Nvidia, ARM GPUs) but fail on llvmpipe with high error values.

Signed-off-by: makaveli10 <[email protected]>

* Enable the tests again.

Signed-off-by: Marcus Edel <[email protected]>

---------

Signed-off-by: Marcus Edel <[email protected]>
Signed-off-by: vineet <[email protected]>
Signed-off-by: makaveli10 <[email protected]>
Signed-off-by: Italo Nicola <[email protected]>
Co-authored-by: gianni <[email protected]>
Co-authored-by: vineet <[email protected]>
Co-authored-by: Italo Nicola <[email protected]>
Co-authored-by: Nidhin <[email protected]>
Co-authored-by: Alexandros Frantzis <[email protected]>
Co-authored-by: gianni-cor <[email protected]>
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
phuongncn pushed a commit to phuongncn/llama.cpp-gx10-dgx-sparks-deepseekv4 that referenced this pull request Apr 28, 2026
Introduces caching of GGML graph to avoid unnecessary full rebuild between each token.
KV cache parameters, which change with each token, are updated directly in cached GGML
graph. Can be disabled with GGML_DISABLE_GRAPH_CACHING environment variable.
phuongncn pushed a commit to phuongncn/llama.cpp-gx10-dgx-sparks-deepseekv4 that referenced this pull request Apr 28, 2026
* Adapting iq2_bn to work without separate scale tensors

Why? It is becoming burdensome to maintain the special Bitnet
conversion in convert_hf_to_gguf.py, so I thnk it is better
to make iq1_bn and iq2_bn just work with the mainline
conversion script (which does not generate scales).

* Adapting iq1_bn to work without separate scale tensors

* Adapting iq2_bn: CUDA dequantize

* Adapting iq2_bn: CUDA works

* Adapting iq1_bn: CUDA works

* Adapting iq1_bn, iq2_bn: NEON

* Adapting iq1_bn, iq2_bn: Metal

Dequantize works, but there is still something wrong
with the dot products.

* WIP

Absoolutely don't see what is wrong with the iq1_bn and iq2_bn
vector dot product kernels.

* Remove iq1_tn and iq2_tn - Part 1

Now that iq1_bn and iq2_bn have per row scales, there is no
reason to also have iq1_tn and iq2_tn.

* Remove iq1_tn and iq2_tn - Part 2

* Bitnet: use the standard llm_build_kv to build self attention

My main motivation was to enable FA. But FA does not work anyway
because head size is 100 for the Botnet ternary models
(and I had forgotten this little detail).

* Revert "Avoid rebuild of GGML graph for each token (ggml-org#98)"

This reverts commit f2d315b.
As far as I can tell, the commit breaks Metal TG.

---------

Co-authored-by: Iwan Kawrakow <[email protected]>
ljubomirj pushed a commit to ljubomirj/llama.cpp that referenced this pull request May 6, 2026
SimonTeixidor pushed a commit to SimonTeixidor/llama.cpp that referenced this pull request Sep 30, 2026
server : preserve context checkpoints across slot save/restore
abeloin added a commit to abeloin/llama.cpp-mix that referenced this pull request Nov 24, 2026
…rafasmour ggml-org#73/ggml-org#98 réintégrés

Les merges r3 de unslothai#401 (clip L2 des rangées), ggml-org#414
(depth mix) et la sélection rafasmour (ggml-org#73 état de conv dans le concat,
ggml-org#98 deux portes delta-net en un lancement) avaient conservé le côté mix
de tests/test-backend-ops.cpp (conflit d'ajouts au même endroit) : les
noyaux fusionnés correspondants n'avaient plus de cas de test.

Blocs repris verbatim des commits sources, sans adaptation :
- 95a0c50, e418bb2, a185601, 6c0e84d (ggml-org#401, test_clip_rows_fuse)
- 03af137, f766457 (ggml-org#414, test_depth_mix_fuse)
- 7a0f09e (rafasmour ggml-org#73, conv state), e3a7e9c (rafasmour ggml-org#98, portes delta-net)
Structures insérées après leur ancre d'origine (ou avant
make_test_cases_eval quand l'ancre est absente du mix), enregistrements
avant « return test_cases; » ; les correctifs suivants appliqués par
git apply -3 sans conflit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QBjnvFeJ4P7Jp71oC6pzWf
abeloin added a commit to abeloin/llama.cpp-mix that referenced this pull request Nov 24, 2026
…c/tests-r3)

- tests: cas de test des pins ggml-org#401/ggml-org#414 et des commits rafasmour ggml-org#73/ggml-org#98,
  perdus aux conflits de r3, réintégrés verbatim depuis leurs commits
  d'origine (95a0c50, e418bb2, a185601, 6c0e84d, 03af137,
  f766457, 7a0f09e, e3a7e9c).
- mix: ggml-cpu accepte FLASH_ATTN_EXT avec biais indexé — calque à nous
  (lève le refus de ggml-org#32740 ; noyau CPU de référence déjà
  présent). Les 24 cas de biais indexé ne sont plus sautés
  (« not supported [CPU] ») : test-backend-ops ROCm0 vs CPU 21634/21634,
  dont 24/24 biais indexé. À retirer si l'amont lève le refus.

Banc r11 (Inkling UD-Q4_K_XL, offload partiel : 49/49 couches, experts de
47 couches en mémoire hôte) : attention toujours au GPU, splits 95/96 des
deux côtés, prefill 249.9 vs 250.1, tg 9.96 vs 10.10 — aucun effet à
l'exécution, aucun NaN. Approuvé par le propriétaire le 2026-11-24.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QBjnvFeJ4P7Jp71oC6pzWf

* banc/tests-r3:
  mix: ggml-cpu : accepter FLASH_ATTN_EXT avec biais indexé (calque à nous ; lève le refus ajouté par ggml-org#32740, commit 2392423)
  tests: cas de test des pins ggml-org#401/ggml-org#414 et des commits rafasmour ggml-org#73/ggml-org#98 réintégrés
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.

2 participants