Skip to content

Misc. bug: unsloth/GLM-4.7-Flash-UD-Q4_K_XL.gguf with CUDA error on --flash-attn=on #19169

@debutow

Description

@debutow

Name and Version

ggml_cuda_init: found 1 CUDA devices:
Device 0: NVIDIA GeForce RTX 3060 Laptop GPU, compute capability 8.6, VMM: yes
load_backend: loaded CUDA backend from D:\DeepSeek\llama-bin-win-cuda-x64\ggml-cuda.dll
load_backend: loaded RPC backend from D:\DeepSeek\llama-bin-win-cuda-x64\ggml-rpc.dll
load_backend: loaded CPU backend from D:\DeepSeek\llama-bin-win-cuda-x64\ggml-cpu-haswell.dll
version: 7865 (f6b533d)
built with Clang 19.1.5 for Windows x86_64

Operating systems

Windows

Which llama.cpp modules do you know to be affected?

llama-server

Command line

./llama-server --model ../GLM-4.7-Flash-UD-Q4_K_XL.gguf --port 10101 --threads 8 --n-gpu-layers 8 --ctx-size 8192 --temp 1.0 --top-p 0.95 --repeat-penalty 1.0 --min-p 0.01  --log-timestamps --jinja

Problem description & steps to reproduce

I try both CUDA 13.1 and CUDA 12.4 released zip files report the same error:
(but if use [--flash-attn off] it works)

srv update_slots: all slots are idle
srv params_from_: Chat format: GLM 4.5
slot get_availabl: id 3 | task -1 | selected slot by LRU, t_last = -1
slot launch_slot_: id 3 | task -1 | sampler chain: logits -> ?penalties -> ?dry -> ?top-n-sigma -> top-k -> ?typical -> top-p -> min-p -> ?xtc -> ?temp-ext -> dist
slot launch_slot_: id 3 | task 0 | processing task, is_child = 0
slot update_slots: id 3 | task 0 | new prompt, n_ctx_slot = 8192, n_keep = 0, task.n_tokens = 214
slot update_slots: id 3 | task 0 | n_tokens = 0, memory_seq_rm [0, end)
slot update_slots: id 3 | task 0 | prompt processing progress, n_tokens = 214, batch.n_tokens = 214, progress = 1.000000
slot update_slots: id 3 | task 0 | prompt done, n_tokens = 214, batch.n_tokens = 214
slot init_sampler: id 3 | task 0 | init sampler, took 0.02 ms, tokens: text = 214, total = 214
D:\a\llama.cpp\llama.cpp\ggml\src\ggml-cuda\fattn.cu:469: fatal error

First Bad Commit

No response

Relevant log output

Logs
ggml_cuda_init: found 1 CUDA devices:
  Device 0: NVIDIA GeForce RTX 3060 Laptop GPU, compute capability 8.6, VMM: yes
load_backend: loaded CUDA backend from D:\DeepSeek\llama-bin-win-cuda-x64\ggml-cuda.dll
load_backend: loaded RPC backend from D:\DeepSeek\llama-bin-win-cuda-x64\ggml-rpc.dll
load_backend: loaded CPU backend from D:\DeepSeek\llama-bin-win-cuda-x64\ggml-cpu-haswell.dll
main: n_parallel is set to auto, using n_parallel = 4 and kv_unified = true
build: 7865 (f6b533d89) with Clang 19.1.5 for Windows x86_64
system info: n_threads = 8, n_threads_batch = 8, total_threads = 16

system_info: n_threads = 8 (n_threads_batch = 8) / 16 | CUDA : ARCHS = 750,800,860,890,1200,1210 | USE_GRAPHS = 1 | PEER_MAX_BATCH_SIZE = 128 | CPU : SSE3 = 1 | SSSE3 = 1 | AVX = 1 | AVX2 = 1 | F16C = 1 | FMA = 1 | BMI2 = 1 | LLAMAFILE = 1 | OPENMP = 1 | REPACK = 1 |

Running without SSL
init: using 15 threads for HTTP server
start: binding port with default address family
main: loading model
srv    load_model: loading model '../GLM-4.7-Flash-UD-Q4_K_XL.gguf'
common_init_result: fitting params to device memory, for bugs during this step try to reproduce them with -fit off, or provide --verbose logs if the bug only occurs with -fit on
llama_params_fit_impl: projected to use 3177 MiB of device memory vs. 5118 MiB of free device memory
llama_params_fit_impl: will leave 1940 >= 1024 MiB of free device memory, no changes needed
llama_params_fit: successfully fit params to free device memory
llama_params_fit: fitting params to free memory took 0.52 seconds
llama_model_load_from_file_impl: using device CUDA0 (NVIDIA GeForce RTX 3060 Laptop GPU) (0000:01:00.0) - 5118 MiB free
llama_model_loader: loaded meta data with 59 key-value pairs and 844 tensors from ../GLM-4.7-Flash-UD-Q4_K_XL.gguf (version GGUF V3 (latest))
llama_model_loader: Dumping metadata keys/values. Note: KV overrides do not apply in this output.
llama_model_loader: - kv   0:                       general.architecture str              = deepseek2
llama_model_loader: - kv   1:                               general.type str              = model
llama_model_loader: - kv   2:                      general.sampling.temp f32              = 1.000000
llama_model_loader: - kv   3:                               general.name str              = Glm-4.7-Flash
llama_model_loader: - kv   4:                           general.basename str              = Glm-4.7-Flash
llama_model_loader: - kv   5:                       general.quantized_by str              = Unsloth
llama_model_loader: - kv   6:                         general.size_label str              = 64x2.6B
llama_model_loader: - kv   7:                            general.license str              = mit
llama_model_loader: - kv   8:                           general.repo_url str              = https://huggingface.co/unsloth
llama_model_loader: - kv   9:                   general.base_model.count u32              = 1
llama_model_loader: - kv  10:                  general.base_model.0.name str              = GLM 4.7 Flash
llama_model_loader: - kv  11:          general.base_model.0.organization str              = Zai Org
llama_model_loader: - kv  12:              general.base_model.0.repo_url str              = https://huggingface.co/zai-org/GLM-4....
llama_model_loader: - kv  13:                               general.tags arr[str,2]       = ["unsloth", "text-generation"]
llama_model_loader: - kv  14:                          general.languages arr[str,2]       = ["en", "zh"]
llama_model_loader: - kv  15:                      deepseek2.block_count u32              = 47
llama_model_loader: - kv  16:                   deepseek2.context_length u32              = 202752
llama_model_loader: - kv  17:                 deepseek2.embedding_length u32              = 2048
llama_model_loader: - kv  18:              deepseek2.feed_forward_length u32              = 10240
llama_model_loader: - kv  19:             deepseek2.attention.head_count u32              = 20
llama_model_loader: - kv  20:          deepseek2.attention.head_count_kv u32              = 1
llama_model_loader: - kv  21:                   deepseek2.rope.freq_base f32              = 1000000.000000
llama_model_loader: - kv  22: deepseek2.attention.layer_norm_rms_epsilon f32              = 0.000010
llama_model_loader: - kv  23:                deepseek2.expert_used_count u32              = 4
llama_model_loader: - kv  24:               deepseek2.expert_group_count u32              = 1
llama_model_loader: - kv  25:          deepseek2.expert_group_used_count u32              = 1
llama_model_loader: - kv  26:               deepseek2.expert_gating_func u32              = 2
llama_model_loader: - kv  27:        deepseek2.leading_dense_block_count u32              = 1
llama_model_loader: - kv  28:                       deepseek2.vocab_size u32              = 154880
llama_model_loader: - kv  29:            deepseek2.attention.q_lora_rank u32              = 768
llama_model_loader: - kv  30:           deepseek2.attention.kv_lora_rank u32              = 512
llama_model_loader: - kv  31:             deepseek2.attention.key_length u32              = 576
llama_model_loader: - kv  32:           deepseek2.attention.value_length u32              = 512
llama_model_loader: - kv  33:         deepseek2.attention.key_length_mla u32              = 256
llama_model_loader: - kv  34:       deepseek2.attention.value_length_mla u32              = 256
llama_model_loader: - kv  35:       deepseek2.expert_feed_forward_length u32              = 1536
llama_model_loader: - kv  36:                     deepseek2.expert_count u32              = 64
llama_model_loader: - kv  37:              deepseek2.expert_shared_count u32              = 1
llama_model_loader: - kv  38:             deepseek2.expert_weights_scale f32              = 1.800000
llama_model_loader: - kv  39:              deepseek2.expert_weights_norm bool             = true
llama_model_loader: - kv  40:             deepseek2.rope.dimension_count u32              = 64
llama_model_loader: - kv  41:                       tokenizer.ggml.model str              = gpt2
llama_model_loader: - kv  42:                         tokenizer.ggml.pre str              = glm4
llama_model_loader: - kv  43:                      tokenizer.ggml.tokens arr[str,154880]  = ["!", "\"", "#", "$", "%", "&", "'", ...
llama_model_loader: - kv  44:                  tokenizer.ggml.token_type arr[i32,154880]  = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
llama_model_loader: - kv  45:                      tokenizer.ggml.merges arr[str,321649]  = ["Ġ Ġ", "Ġ ĠĠĠ", "ĠĠ ĠĠ", "...
llama_model_loader: - kv  46:                tokenizer.ggml.eos_token_id u32              = 154820
llama_model_loader: - kv  47:            tokenizer.ggml.padding_token_id u32              = 154821
llama_model_loader: - kv  48:                tokenizer.ggml.bos_token_id u32              = 154822
llama_model_loader: - kv  49:                tokenizer.ggml.eot_token_id u32              = 154827
llama_model_loader: - kv  50:            tokenizer.ggml.unknown_token_id u32              = 154820
llama_model_loader: - kv  51:                tokenizer.ggml.eom_token_id u32              = 154829
llama_model_loader: - kv  52:                    tokenizer.chat_template str              = [gMASK]<sop>\n{%- if tools -%}\n<|syste...
llama_model_loader: - kv  53:               general.quantization_version u32              = 2
llama_model_loader: - kv  54:                          general.file_type u32              = 15
llama_model_loader: - kv  55:                      quantize.imatrix.file str              = GLM-4.7-Flash-GGUF/imatrix_unsloth.gguf
llama_model_loader: - kv  56:                   quantize.imatrix.dataset str              = unsloth_calibration_GLM-4.7-Flash.txt
llama_model_loader: - kv  57:             quantize.imatrix.entries_count u32              = 607
llama_model_loader: - kv  58:              quantize.imatrix.chunks_count u32              = 85
llama_model_loader: - type  f32:  281 tensors
llama_model_loader: - type  f16:    5 tensors
llama_model_loader: - type q8_0:  180 tensors
llama_model_loader: - type q4_K:  306 tensors
llama_model_loader: - type q5_K:   23 tensors
llama_model_loader: - type q6_K:   49 tensors
print_info: file format = GGUF V3 (latest)
print_info: file type   = Q4_K - Medium
print_info: file size   = 16.31 GiB (4.68 BPW)
load: 0 unused tokens
load: special_eot_id is not in special_eog_ids - the tokenizer config may be incorrect
�[0mload: special_eom_id is not in special_eog_ids - the tokenizer config may be incorrect
�[0mload: printing all EOG tokens:
load:   - 154820 ('<|endoftext|>')
load:   - 154827 ('<|user|>')
load:   - 154829 ('<|observation|>')
load: special tokens cache size = 36
load: token to piece cache size = 0.9811 MB
print_info: arch                  = deepseek2
print_info: vocab_only            = 0
print_info: no_alloc              = 0
print_info: n_ctx_train           = 202752
print_info: n_embd                = 2048
print_info: n_embd_inp            = 2048
print_info: n_layer               = 47
print_info: n_head                = 20
print_info: n_head_kv             = 1
print_info: n_rot                 = 64
print_info: n_swa                 = 0
print_info: is_swa_any            = 0
print_info: n_embd_head_k         = 576
print_info: n_embd_head_v         = 512
print_info: n_gqa                 = 20
print_info: n_embd_k_gqa          = 576
print_info: n_embd_v_gqa          = 512
print_info: f_norm_eps            = 0.0e+00
print_info: f_norm_rms_eps        = 1.0e-05
print_info: f_clamp_kqv           = 0.0e+00
print_info: f_max_alibi_bias      = 0.0e+00
print_info: f_logit_scale         = 0.0e+00
print_info: f_attn_scale          = 0.0e+00
print_info: n_ff                  = 10240
print_info: n_expert              = 64
print_info: n_expert_used         = 4
print_info: n_expert_groups       = 1
print_info: n_group_used          = 1
print_info: causal attn           = 1
print_info: pooling type          = 0
print_info: rope type             = 0
print_info: rope scaling          = linear
print_info: freq_base_train       = 1000000.0
print_info: freq_scale_train      = 1
print_info: n_ctx_orig_yarn       = 202752
print_info: rope_yarn_log_mul     = 0.0000
print_info: rope_finetuned        = unknown
print_info: model type            = 30B.A3B
print_info: model params          = 29.94 B
print_info: general.name          = Glm-4.7-Flash
print_info: n_layer_dense_lead    = 1
print_info: n_lora_q              = 768
print_info: n_lora_kv             = 512
print_info: n_embd_head_k_mla     = 256
print_info: n_embd_head_v_mla     = 256
print_info: n_ff_exp              = 1536
print_info: n_expert_shared       = 1
print_info: expert_weights_scale  = 1.8
print_info: expert_weights_norm   = 1
print_info: expert_gating_func    = sigmoid
print_info: vocab type            = BPE
print_info: n_vocab               = 154880
print_info: n_merges              = 321649
print_info: BOS token             = 154822 '[gMASK]'
print_info: EOS token             = 154820 '<|endoftext|>'
print_info: EOT token             = 154827 '<|user|>'
print_info: EOM token             = 154829 '<|observation|>'
print_info: UNK token             = 154820 '<|endoftext|>'
print_info: PAD token             = 154821 '[MASK]'
print_info: LF token              = 198 'Ċ'
print_info: FIM PRE token         = 154838 '<|code_prefix|>'
print_info: FIM SUF token         = 154840 '<|code_suffix|>'
print_info: FIM MID token         = 154839 '<|code_middle|>'
print_info: EOG token             = 154820 '<|endoftext|>'
print_info: EOG token             = 154827 '<|user|>'
print_info: EOG token             = 154829 '<|observation|>'
print_info: max token length      = 1024
load_tensors: loading model tensors, this can take a while... (mmap = true, direct_io = false)
load_tensors: offloading output layer to GPU
load_tensors: offloading 7 repeating layers to GPU
load_tensors: offloaded 8/48 layers to GPU
load_tensors:   CPU_Mapped model buffer size = 13915.96 MiB
load_tensors:        CUDA0 model buffer size =  2783.54 MiB
....................................................................................................
common_init_result: added <|endoftext|> logit bias = -inf
common_init_result: added <|user|> logit bias = -inf
common_init_result: added <|observation|> logit bias = -inf
llama_context: constructing llama_context
llama_context: n_seq_max     = 4
llama_context: n_ctx         = 8192
llama_context: n_ctx_seq     = 8192
llama_context: n_batch       = 2048
llama_context: n_ubatch      = 512
llama_context: causal_attn   = 1
llama_context: flash_attn    = enabled
llama_context: kv_unified    = true
llama_context: freq_base     = 1000000.0
llama_context: freq_scale    = 1
llama_context: n_ctx_seq (8192) < n_ctx_train (202752) -- the full capacity of the model will not be utilized
�[0mllama_context:  CUDA_Host  output buffer size =     2.36 MiB
llama_kv_cache:        CPU KV buffer size =   360.00 MiB
llama_kv_cache:      CUDA0 KV buffer size =    63.00 MiB
llama_kv_cache: size =  423.00 MiB (  8192 cells,  47 layers,  4/1 seqs), K (f16):  423.00 MiB, V (f16):    0.00 MiB
sched_reserve: reserving ...
sched_reserve:      CUDA0 compute buffer size =   330.88 MiB
sched_reserve:  CUDA_Host compute buffer size =    24.01 MiB
sched_reserve: graph nodes  = 3317
sched_reserve: graph splits = 797 (with bs=512), 2 (with bs=1)
sched_reserve: reserve took 22.30 ms, sched copies = 1
common_init_from_params: warming up the model with an empty run - please wait ... (--no-warmup to disable)
�[0msrv    load_model: initializing slots, n_slots = 4
no implementations specified for speculative decoding
�[0msrv    load_model: speculative decoding context not initialized
�[0mslot   load_model: id  0 | task -1 | new slot, n_ctx = 8192
no implementations specified for speculative decoding
�[0msrv    load_model: speculative decoding context not initialized
�[0mslot   load_model: id  1 | task -1 | new slot, n_ctx = 8192
no implementations specified for speculative decoding
�[0msrv    load_model: speculative decoding context not initialized
�[0mslot   load_model: id  2 | task -1 | new slot, n_ctx = 8192
no implementations specified for speculative decoding
�[0msrv    load_model: speculative decoding context not initialized
�[0mslot   load_model: id  3 | task -1 | new slot, n_ctx = 8192
srv    load_model: prompt cache is enabled, size limit: 8192 MiB
�[0msrv    load_model: use `--cache-ram 0` to disable the prompt cache
�[0msrv    load_model: for more info see https://github.com/ggml-org/llama.cpp/pull/16391
�[0minit: chat template, example_format: '[gMASK]<sop><|system|>You are a helpful assistant<|user|>Hello<|assistant|></think>Hi there<|user|>How are you?<|assistant|><think>'
srv          init: init: chat template, thinking = 1
main: model loaded
main: server is listening on http://127.0.0.1:10101
main: starting the main loop...
srv  update_slots: all slots are idle
srv  params_from_: Chat format: GLM 4.5
slot get_availabl: id  3 | task -1 | selected slot by LRU, t_last = -1
slot launch_slot_: id  3 | task -1 | sampler chain: logits -> ?penalties -> ?dry -> ?top-n-sigma -> top-k -> ?typical -> top-p -> min-p -> ?xtc -> ?temp-ext -> dist
slot launch_slot_: id  3 | task 0 | processing task, is_child = 0
slot update_slots: id  3 | task 0 | new prompt, n_ctx_slot = 8192, n_keep = 0, task.n_tokens = 214
slot update_slots: id  3 | task 0 | n_tokens = 0, memory_seq_rm [0, end)
slot update_slots: id  3 | task 0 | prompt processing progress, n_tokens = 214, batch.n_tokens = 214, progress = 1.000000
slot update_slots: id  3 | task 0 | prompt done, n_tokens = 214, batch.n_tokens = 214
slot init_sampler: id  3 | task 0 | init sampler, took 0.02 ms, tokens: text = 214, total = 214
D:\a\llama.cpp\llama.cpp\ggml\src\ggml-cuda\fattn.cu:469: fatal error

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions