llama.cpp icon indicating copy to clipboard operation
llama.cpp copied to clipboard

Eval bug: llama server crashes(fattn.cu:579: fatal error) after editing system message when using Gemma 4 31B with MTP and -sm tensor

Open Cyrus-Hei opened this issue 5 months ago • 11 comments

Name and Version

llama-server.exe --version version: 9589 (fb83cc9a0) built with Clang 20.1.8 for Windows x86_64

Operating systems

Windows

GGML backends

CUDA

Hardware

2x RTX3090

Models

Gemma 4 31B(https://huggingface.co/bartowski/google_gemma-4-31B-it-GGUF/blob/main/google_gemma-4-31B-it-Q8_0.gguf) Gemma 4 31B assistant(https://huggingface.co/am17an/Gemma4-31B-it-GGUF/blob/main/mtp-gemma-4-31B-it.gguf)

Problem description & steps to reproduce

llama server crashes after editing system message when using Gemma 4 31B with MTP and split mode tensor. Repro steps:

  1. start server with gemma 4 31B with MTP and -sm tensor
  2. start a chat in llama-ui
  3. edit system message
  4. regenerate message leads to fattn.cu:579: fatal error

(also crashes in multi-turn chat if any previous turn assistant messages are modified)

First Bad Commit

first build with the crash: b9589(fb83cc9) last good build: b9587(d2e22ed)

Relevant log output

Logs
llama-server.exe -m E:\GGUF\31B-google_gemma-4-31B-it-Q8_0.gguf --port 5001 --host 0.0.0.0 -t 7 -c 32000 --no-mmap -b 2048 -ub 2048 -fa on -sm tensor -ngl 999 --jinja -np 1 -md E:\GGUF\mtp-gemma-4-31B-it.gguf --spec-type draft-mtp --spec-draft-n-max 4
0.00.097.119 I log_info: verbosity = 3 (adjust with the `-lv N` CLI arg)
0.00.097.126 I device_info:
0.00.192.446 I   - CUDA0   : NVIDIA GeForce RTX 3090 (24575 MiB, 23332 MiB free)
0.00.268.978 I   - CUDA1   : NVIDIA GeForce RTX 3090 (24575 MiB, 23336 MiB free)
0.00.268.986 I   - CPU     : 12th Gen Intel(R) Core(TM) i5-12600K (65305 MiB, 33440 MiB free)
0.00.269.053 I system_info: n_threads = 7 (n_threads_batch = 7) / 16 | CUDA : ARCHS = 750,800,860,890,900,1200,1210 | USE_GRAPHS = 1 | PEER_MAX_BATCH_SIZE = 128 | CPU : SSE3 = 1 | SSSE3 = 1 | AVX = 1 | AVX_VNNI = 1 | AVX2 = 1 | F16C = 1 | FMA = 1 | BMI2 = 1 | LLAMAFILE = 1 | OPENMP = 1 | REPACK = 1 |
0.00.269.088 I srv          init: running without SSL
0.00.269.118 I srv          init: using 15 threads for HTTP server
0.00.269.219 I srv         start: binding port with default address family
0.00.273.715 I srv  llama_server: loading model
0.00.273.724 I srv    load_model: loading model 'E:\GGUF\31B-google_gemma-4-31B-it-Q8_0.gguf'
0.01.545.276 E llama_init_from_model: failed to initialize the context: Gemma4Assistant requires ctx_other to be set (this is normal during memory fitting)
0.01.598.643 W srv    load_model: [spec] failed to measure draft model memory: failed to create llama_context from model
0.01.598.674 I common_init_result: fitting params to device memory ...
0.01.598.674 I common_init_result: (for bugs during this step try to reproduce them with -fit off, or provide --verbose logs if the bug only occurs with -fit on)
0.01.598.694 W common_fit_params: failed to fit params to free device memory: llama_params_fit is not implemented for SPLIT_MODE_TENSOR, abort
0.02.330.966 W load: override 'tokenizer.ggml.add_bos_token' to 'true' for Gemma4
0.02.360.330 W load: control-looking token:     50 '<|tool_response>' was not control-type; this is probably a bug in the model. its type will be overridden
0.02.360.748 W load: control-looking token:    212 '</s>' was not control-type; this is probably a bug in the model. its type will be overridden
0.02.399.737 W load: special_eog_ids contains '<|tool_response>', removing '</s>' token from EOG list
0.36.862.915 W llama_context: n_ctx_seq (32000) < n_ctx_train (262144) -- the full capacity of the model will not be utilized
0.37.193.543 I common_init_from_params: warming up the model with an empty run - please wait ... (--no-warmup to disable)
0.37.392.340 I srv    load_model: loading draft model 'E:\GGUF\mtp-gemma-4-31B-it.gguf'
0.37.837.077 W load: control-looking token:     50 '<|tool_response>' was not control-type; this is probably a bug in the model. its type will be overridden
0.37.837.576 W load: control-looking token:    212 '</s>' was not control-type; this is probably a bug in the model. its type will be overridden
0.37.880.135 W load: special_eog_ids contains '<|tool_response>', removing '</s>' token from EOG list
0.38.408.455 W llama_context: n_ctx_seq (32000) < n_ctx_train (262144) -- the full capacity of the model will not be utilized
0.38.418.522 W llama_kv_cache: layer   3: sharing with layer 59. k = 2000000000000000, v = 2000000000000000
0.38.418.548 W llama_kv_cache: layer   0: sharing with layer 58. k = 2000000000000000, v = 2000000000000000
0.38.418.549 W llama_kv_cache: layer   1: sharing with layer 58. k = 2000000000000000, v = 2000000000000000
0.38.418.549 W llama_kv_cache: layer   2: sharing with layer 58. k = 2000000000000000, v = 2000000000000000
0.38.463.234 I srv    load_model: initializing slots, n_slots = 1
0.38.526.189 I common_speculative_impl_draft_mtp: adding speculative implementation 'draft-mtp'
0.38.526.200 I common_speculative_impl_draft_mtp: - n_max=4, n_min=0, p_min=0.00, n_embd=5376, backend_sampling=1
0.38.526.202 I common_speculative_impl_draft_mtp: - gpu_layers=-1, cache_k=f16, cache_v=f16, ctx_tgt=yes, ctx_dft=yes, devices=[default]
0.38.526.456 W set_sampler: backend sampling not supported with SPLIT_MODE_TENSOR; using CPU
0.38.526.457 W common_speculative_impl_draft_mtp: backend offload failed for seq_id=0; using CPU sampler
0.38.557.815 I srv    load_model: speculative decoding context initialized
0.38.557.822 I slot   load_model: id  0 | task -1 | new slot, n_ctx = 32000
0.38.557.909 I srv    load_model: prompt cache is enabled, size limit: 8192 MiB
0.38.557.910 I srv    load_model: use `--cache-ram 0` to disable the prompt cache
0.38.557.910 I srv    load_model: for more info see https://github.com/ggml-org/llama.cpp/pull/16391
0.38.557.911 I srv    load_model: context checkpoints enabled, max = 32, min spacing = 256
0.38.558.605 I srv          init: idle slots will be saved to prompt cache upon starting a new task
0.38.573.105 I init: chat template, example_format: '<|turn>system
<|think|>
You are a helpful assistant<turn|>
<|turn>user
Hello<turn|>
<|turn>model
Hi there<turn|>
<|turn>user
How are you?<turn|>
<|turn>model
'
0.38.574.158 I srv          init: init: chat template, thinking = 1
0.38.574.608 I srv  llama_server: model loaded
0.38.574.612 I srv  llama_server: server is listening on http://0.0.0.0:5001
0.38.574.621 I srv  update_slots: all slots are idle
0.50.475.536 I srv  params_from_: Chat format: peg-gemma4
0.50.476.319 I slot get_availabl: id  0 | task -1 | selected slot by LRU, t_last = -1
0.50.476.322 I srv  get_availabl: updating prompt cache
0.50.476.328 I srv          load:  - looking for better prompt, base f_keep = -1.000, sim = 0.000
0.50.476.505 I srv        update:  - cache state: 0 prompts, 0.000 MiB (limits: 8192.000 MiB, 32000 tokens, 8589934592 est)
0.50.476.507 I srv  get_availabl: prompt cache update took 0.18 ms
0.50.476.696 I reasoning-budget: activated, budget=2147483647 tokens
0.50.476.698 I reasoning-budget: deactivated (natural end)
0.50.476.712 I slot launch_slot_: id  0 | task 0 | processing task, is_child = 0
0.51.074.243 I slot create_check: id  0 | task 0 | created context checkpoint 1 of 32 (pos_min = 0, pos_max = 18, n_tokens = 19, size = 14.845 MiB)
0.51.340.356 I slot print_timing: id  0 | task 0 | prompt eval time =     723.83 ms /    32 tokens (   22.62 ms per token,    44.21 tokens per second)
0.51.340.361 I slot print_timing: id  0 | task 0 |        eval time =     139.76 ms /    10 tokens (   13.98 ms per token,    71.55 tokens per second)
0.51.340.362 I slot print_timing: id  0 | task 0 |       total time =     863.59 ms /    42 tokens
0.51.340.362 I slot print_timing: id  0 | task 0 |    graphs reused =          2
0.51.340.364 I slot print_timing: id  0 | task 0 | draft acceptance = 1.00000 (    8 accepted /     8 generated)
0.51.340.383 I statistics        draft-mtp: #calls(b,g,a) =    1      2      2, #gen drafts =      2, #acc drafts =     2, #gen tokens =      8, #acc tokens =     8, dur(b,g,a) = 0.002, 23.400, 0.006 ms
0.51.340.398 I slot      release: id  0 | task 0 | stop processing: n_tokens = 42, truncated = 0
0.51.340.405 I srv  update_slots: all slots are idle
1.01.597.446 I srv  params_from_: Chat format: peg-gemma4
1.01.597.584 I slot get_availabl: id  0 | task -1 | selected slot by LCP similarity, sim_best = 1.000 (> 0.100 thold), f_keep = 0.762
1.01.597.616 I reasoning-budget: activated, budget=2147483647 tokens
1.01.597.617 I reasoning-budget: deactivated (natural end)
1.01.597.968 I slot launch_slot_: id  0 | task 6 | processing task, is_child = 0
1.01.597.981 I slot update_slots: id  0 | task 6 | Checking checkpoint with [0, 18] against 0...
1.01.617.261 W slot update_slots: id  0 | task 6 | restored context checkpoint (pos_min = 0, pos_max = 18, n_tokens = 19, n_past = 18, size = 14.845 MiB)
D:\a\llama.cpp\llama.cpp\ggml\src\ggml-cuda\fattn.cu:579: fatal error

Cyrus-Hei avatar Jun 10 '26 22:06 Cyrus-Hei

I believe this is the same issue as #24324. I've posted a Fable-derived fix there.

philpax avatar Jun 12 '26 23:06 philpax

Gemma 4 31B(https://huggingface.co/bartowski/google_gemma-4-31B-it-GGUF/blob/main/google_gemma-4-31B-it-Q8_0.gguf) Gemma 4 31B assistant(https://huggingface.co/am17an/Gemma4-31B-it-GGUF/blob/main/mtp-gemma-4-31B-it.gguf)

@Cyrus-Hei make sure you use the MTP file from the same repo as the main model

OPS-NeoRetro avatar Jun 13 '26 12:06 OPS-NeoRetro

Gemma 4 31B(https://huggingface.co/bartowski/google_gemma-4-31B-it-GGUF/blob/main/google_gemma-4-31B-it-Q8_0.gguf) Gemma 4 31B assistant(https://huggingface.co/am17an/Gemma4-31B-it-GGUF/blob/main/mtp-gemma-4-31B-it.gguf)

@Cyrus-Hei make sure you use the MTP file from the same repo as the main model

This is not the cause of the issue and the crash persisted with any assistant model used and any gemma 4 models with -sm tensor, while at and before b9587(https://github.com/ggml-org/llama.cpp/commit/d2e22ed975e3464ff8108542c840733b488f165f) there was no such crashes.

Cyrus-Hei avatar Jun 16 '26 08:06 Cyrus-Hei

How to fix "requires ctx_other to be set" this in Ollama, which uses llama.cpp?

Snegovik avatar Jul 10 '26 13:07 Snegovik

I'm getting an extremely similar error but with Gemma 4 26B A4B QAT at UD-Q4_K_XL, on latest build (>= b10075); dug into the code, it seems a ggml_tensor * is being handed to CUDA with operation GGML_OP_FLASH_ATTN_EXT but mismatched K tensor dimensions. Would appreciate if you could run GDB and see if the error is similar.

uteki-rain avatar Jul 29 '26 12:07 uteki-rain

Can you see if my patch fixes it for you?

philpax avatar Jul 29 '26 16:07 philpax

Can you see if my patch fixes it for you?

Your patch works for me! Did not crash and MTP looks to be working. I hope this fix can make it into the main repo soon.

$ llama-server --version version: 10357 (689e227db) built with GNU 16.2.1 for Linux x86_64

Stats below from Gemma 4 31B Q6 w/ 2x P100 with a prediction friendly prompt.

sm tensor MTP without patch: llama.cpp/ggml/src/ggml-cuda/fattn.cu:574: fatal error

sm tensor MTP with patch: 1.34.309.779 I slot print_timing: id 3 | task 3 | n_decoded = 101, tg = 20.49 t/s, tg_3s = 20.49 t/s

sm tensor: 10.01.355.652 I slot print_timing: id 3 | task 1624 | n_decoded = 100, tg = 12.76 t/s, tg_3s = 12.76 t/s

xifer avatar Sep 07 '26 03:09 xifer

Just to reiterate that this bug still exists. I am encountering the same bug with MTP and tensor parallelism.

Build 11221 GPU: 2xR9700 CPU: Ryzen R9 9900X Ubuntu 26.04 inside an LXC on proxmox 8.4.21 rocm 7.2.4

My startup options are:

/usr/local/bin/llama-server \
    -sm tensor \
    -a Gemma4-26B-A4B-Q8_K_XL \
    -b 2048 \
    -c 262144 \
    --cache-type-k q8_0 --cache-type-v q8_0 \
    -m /mnt/models/hf/gemma-4-26B-A4B-it-UD-Q8_K_XL.gguf \
    --mmproj /mnt/models/hf/gemma4-mmproj-BF16.gguf \
    --model-draft /mnt/models/hf/mtp-gemma-4-26B-A4B-it-Q8_0.gguf \
    --spec-draft-device ROCm0,ROCm1 --spec-type draft-mtp --spec-draft-n-max 2 \
    --host 0.0.0.0 --port 80 \
    --batch-size 4096 --ubatch_size 1024 \
    -ngl all \
    --tools all \
    --load-mode none \
    --metrics \
    --device ROCm0,ROCm1 --jinja

Build options:

HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -R)" \
    cmake -S . -B build -DGGML_HIP=ON -DGGML_HIP_ROCWMMA_FATTN=ON -DGGML_HIP_RCCL=ON -DGPU_TARGETS=gfx1201 -DCMAKE_BUILD_TYPE=Release \
    && cmake --build build --config Release -- -j 8

If I disable MTP, by removing the following part of my startup line

#    --model-draft /mnt/models/hf/mtp-gemma-4-26B-A4B-it-Q8_0.gguf \
#    --spec-draft-device ROCm0,ROCm1 --spec-type draft-mtp --spec-draft-n-max 2 \

The crashes don't happen. I tried disabling cuda graphs, but this did not change anything. So the combination of tensor + MTP seems to be the problem. I have yet to try the aforementioned patch. This crash seems to happen randomly, however I've found it to happen more frequently on larger context sizes.

Crash log:

Sep 27 17:13:40 llamacpp llama-server[43574]: 4.49.183.440 I slot release: id 3 | task 356 | stop processing: n_tokens = 44357, truncated = 0
Sep 27 17:13:40 llamacpp llama-server[43574]: 4.49.983.945 I slot get_availabl: id 3 | task -1 | selected slot by LCP similarity, f_sim_best = 0.980 (> 0.100 thold), f_keep = 0.978
Sep 27 17:13:40 llamacpp llama-server[43574]: 4.49.984.139 I slot launch_slot_: id 3 | task 753 | processing task, is_child = 0
Sep 27 17:13:44 llamacpp llama-server[43574]: 4.53.610.001 I slot print_timing: id 3 | task 753 | n_gen = 296, tg = 98.33 t/s, tg_3s = 98.66 t/s 
Sep 27 17:13:47 llamacpp llama-server[43574]: 4.56.419.305 I slot print_timing: id 3 | task 753 | prompt eval time = 625.17 ms / 896 tokens ( 0.70 ms per token, 1433.20 tokens per second) 
Sep 27 17:13:47 llamacpp llama-server[43574]: 4.56.419.308 I slot print_timing: id 3 | task 753 | eval time = 5809.53 ms / 555 tokens ( 10.49 ms per token, 95.36 tokens per second) 
Sep 27 17:13:47 llamacpp llama-server[43574]: 4.56.419.308 I slot print_timing: id 3 | task 753 | total time = 6434.70 ms / 1451 tokens Sep 27 17:13:47 llamacpp llama-server[43574]: 4.56.419.309 I slot print_timing: id 3 | task 753 | graphs reused = 921 
Sep 27 17:13:47 llamacpp llama-server[43574]: 4.56.419.311 I slot print_timing: id 3 | task 753 | draft acceptance = 0.77294 ( 337 accepted / 436 generated), mean len = 2.55 
Sep 27 17:13:47 llamacpp llama-server[43574]: 4.56.420.485 I slot release: id 3 | task 753 | stop processing: n_tokens = 44812, truncated = 0 
Sep 27 17:21:41 llamacpp llama-server[43574]: 12.50.275.637 I slot get_availabl: id 3 | task -1 | selected slot by LCP similarity, f_sim_best = 0.921 (> 0.100 thold), f_keep = 0.923
Sep 27 17:21:41 llamacpp llama-server[43574]: 12.50.275.842 I slot launch_slot_: id 3 | task 1006 | processing task, is_child = 0
Sep 27 17:21:43 llamacpp llama-server[43574]: /root/llama.cpp/ggml/src/ggml-cuda/fattn.cu:762: fatal error 
Sep 27 17:21:43 llamacpp llama-server[43731]: /usr/local/lib/libggml-base.so.0(+0x1b236) [0x778b35744236] 
Sep 27 17:21:43 llamacpp llama-server[43731]: /usr/local/lib/libggml-base.so.0(ggml_print_backtrace+0x20d) [0x778b357446bd] 
Sep 27 17:21:43 llamacpp llama-server[43731]: /usr/local/lib/libggml-base.so.0(ggml_abort+0x166) [0x778b357448a6] 
Sep 27 17:21:43 llamacpp llama-server[43731]: /usr/local/lib/libggml-hip.so.0(_Z24ggml_cuda_flash_attn_extR25ggml_backend_cuda_contextP11ggml_tensor+0x1c47) [0x778b341eac47] 
Sep 27 17:21:43 llamacpp llama-server[43731]: /usr/local/lib/libggml-hip.so.0(+0x3e2f698) [0x778b34237698] 
Sep 27 17:21:43 llamacpp llama-server[43731]: /usr/local/lib/libggml-hip.so.0(+0x3e29c99) [0x778b34231c99] 
Sep 27 17:21:43 llamacpp llama-server[43731]: /usr/local/lib/libggml-base.so.0(+0x507a5) [0x778b357797a5] 
Sep 27 17:21:43 llamacpp llama-server[43731]: /usr/local/lib/libggml-base.so.0(ggml_backend_sched_graph_compute_async+0x8af) [0x778b35763a4f] 
Sep 27 17:21:43 llamacpp llama-server[43731]: /usr/local/lib/libllama.so.0(_ZN13llama_context13graph_computeEP11ggml_cgraphb+0xa0) [0x778b35a11ed0] 
Sep 27 17:21:43 llamacpp llama-server[43731]: /usr/local/lib/libllama.so.0(_ZN13llama_context14process_ubatchERK12llama_ubatch14llm_graph_typeP22llama_memory_context_iR11ggml_status+0x133) [0x778b35a15b53] 
Sep 27 17:21:43 llamacpp llama-server[43731]: /usr/local/lib/libllama.so.0(_ZN13llama_context6decodeERK15llama_batch_ext+0x45a) [0x778b35a1e33a] 
Sep 27 17:21:43 llamacpp llama-server[43731]: /usr/local/lib/libllama.so.0(_ZN13llama_context6decodeERK11llama_batch+0x37) [0x778b35a1f9e7] 
Sep 27 17:21:43 llamacpp llama-server[43731]: /usr/local/lib/libllama.so.0(llama_decode+0x12) [0x778b35a1fa32] 
Sep 27 17:21:43 llamacpp llama-server[43731]: /usr/local/lib/libllama-common.so.0(_ZN33common_speculative_impl_draft_mtp5draftERSt6vectorI31common_speculative_draft_paramsSaIS1_EE+0x37a) [0x778b360fe4ba] 
Sep 27 17:21:43 llamacpp llama-server[43731]: /usr/local/lib/libllama-common.so.0(_Z24common_speculative_draftP18common_speculative+0xe2) [0x778b360ed162] 
Sep 27 17:21:43 llamacpp llama-server[43731]: /usr/local/lib/libllama-server-impl.so(_ZN12server_queue14yield_to_queueEOSt8functionIFvvEE+0xa9) [0x778b368d2fb9]
Sep 27 17:21:43 llamacpp llama-server[43731]: /usr/local/lib/libllama-server-impl.so(_ZN19server_context_impl10pre_decodeEv+0x226) [0x778b36928136] Sep 27 17:21:43 llamacpp llama-server[43731]: /usr/local/lib/libllama-server-impl.so(_ZN19server_context_impl12update_slotsEv+0x26e) [0x778b369338ee] 
Sep 27 17:21:43 llamacpp llama-server[43731]: /usr/local/lib/libllama-server-impl.so(_ZN12server_queue10start_loopEl+0x138) [0x778b368d6df8] 
Sep 27 17:21:43 llamacpp llama-server[43731]: /usr/local/lib/libllama-server-impl.so(_Z12llama_serverR13common_paramsiPPc+0x45f9) [0x778b36886269] 
Sep 27 17:21:43 llamacpp llama-server[43731]: /usr/local/lib/libllama-server-impl.so(_Z12llama_serveriPPc+0x112e) [0x778b36887e0e] 
Sep 27 17:21:43 llamacpp llama-server[43731]: /usr/lib/x86_64-linux-gnu/libc.so.6(+0x2a601) [0x778b362e9601] 
Sep 27 17:21:43 llamacpp llama-server[43731]: /usr/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x88) [0x778b362e9718] 
Sep 27 17:21:43 llamacpp llama-server[43731]: /usr/local/bin/llama-server(+0x1325) [0x5c963eace325]

bogie avatar Sep 28 '26 17:09 bogie

I am also getting this error.

OS: Windows 10 GPUs: RTX 4060Ti 16GB + RTX 5060Ti 16GB Version: 11298 (22bdcc4cd) Model: gemma-4-31B-it-qat-UD-Q4_K_XL.gguf (https://huggingface.co/unsloth/gemma-4-31B-it-qat-GGUF/blob/main/gemma-4-31B-it-qat-UD-Q4_K_XL.gguf) MTP model: mtp-gemma-4-31B-it-Q4_0.gguf (https://huggingface.co/unsloth/gemma-4-31B-it-qat-GGUF/blob/main/MTP/mtp-gemma-4-31B-it-Q4_0.gguf)

Startup options:

./llama serve -m "C:\gemma-4-31B-it-qat-UD-Q4_K_XL.gguf" \
    --spec-type draft-mtp \
    --model-draft "C:\mtp\mtp-gemma-4-31B-it-Q4_0.gguf" \
    -c 70000 \
    --load-mode none \
    --log-colors off \
    --ctx-checkpoints 256 \
    --checkpoint-min-step 128 \
    --cache-ram 18000 \
    --split-mode tensor  \
    -device CUDA1,CUDA0 \
    --tensor-split 150,150 \
    -ngl all \
    -ngld all \
    --flash-attn on \
    --main-gpu 1 \
    --batch-size 10000

Build options:

cmake -B build -DGGML_CUDA=ON -A x64 -DGGML_CUDA_NCCL=ON -DNCCL_INCLUDE_DIR="C:\nccl\nccl-windows\install\include" -DNCCL_LIBRARY="C:\nccl\nccl-windows\install\lib\nccl.lib" -DCMAKE_CUDA_ARCHITECTURES="89-real;120a-real"

Setting $env:LLAMA_GRAPH_REUSE_DISABLE = "1" seems to fix the issue, but as other have mentioned, the performance does appear slower.

I have been unsuccessful in integrating previously mentioned patches, but after some back and forth I was able to discover a seemingly working fix that doesn't degrade my performance (keep in mind this is AI generated and I have not seriously tested it outside of my own build/configuration):

tensor-split-meta-graph-owned-view-lifetime.patch

Dani-Myking avatar Oct 06 '26 00:10 Dani-Myking

tensor-split-meta-graph-owned-view-lifetime_2.patch

@Dani-Myking Thanks a lot! Your patch fixed the issues I was struggling with (#29419, #29418).

If anyone needs SYCL and Vulkan workarounds, feel free to use my patches (mentioned in the issues above).

The patch provided by @Dani-Myking in #24440 works well on commits prior to October 1st. However, due to subsequent changes in the codebase, a slight adjustment is required for post-October 1st commits:

  1. In unpin_compute_container, the assertions are replaced with boundary checks to prevent runtime crashes.
  2. In pin_compute_container, buf_ctx->stc_compute_index is updated to buf_ctx->stc_compute_index_next to align with the latest context structure.

Required Changes

--- a/ggml/src/ggml-backend-meta.cpp
+++ b/ggml/src/ggml-backend-meta.cpp
@@ -522,7 +522,9 @@ struct ggml_backend_meta_buffer_context {
     void unpin_compute_container(size_t index) {
-        GGML_ASSERT(index < stc_compute_pins.size());
-        GGML_ASSERT(stc_compute_pins[index] > 0);
-        stc_compute_pins[index]--;
+        if (index < stc_compute_pins.size() && stc_compute_pins[index] > 0) {
+            stc_compute_pins[index]--;
+        }
     }
@@ -1894,7 +1896,7 @@ struct ggml_backend_meta_context {
     void pin_compute_container(ggml_backend_meta_buffer_context * buf_ctx) {
-        const size_t index = buf_ctx->stc_compute_index;
+        const size_t index = buf_ctx->stc_compute_index_next;
         buf_ctx->pin_compute_container(index);
         compute_container_pins.push_back({buf_ctx, index});
     }

oerisen avatar Oct 12 '26 13:10 oerisen

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Nov 27 '26 00:11 github-actions[bot]