-
Notifications
You must be signed in to change notification settings - Fork 10.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SYCL incoherent output on >4GB allocations of GPU memory #5250
Comments
Can confirm, with limited VRAM usage, the problem is gone. I:\SYCL\bin>main -m I:\deepseek-coder-33B-base-GGUF\deepseek-coder-7b-instruct-v1.5-Q8_0.gguf -p "Once upon a time, there existed a little girl, who liked to have adventures. She wanted to go to places and meet new people, and have fun" -n 128 -e -ngl 10 --no-mmap llm_load_tensors: offloading 10 repeating layers to GPU Once upon a time, there existed a little girl, who liked to have adventures. She wanted to go to places and meet new people, and have fun doing it all. One day she found an old diary that had been left in the woods by its owner some years ago. The young lady was intrigued as she read about this person’s journey through her country, especially when they mentioned a certain castle located somewhere near their hometown. |
hi @Jacoby1218 @characharm can you confirm whether this only happens on windows or both platform? |
probably both |
If this due to a limitation of the maximum buffer size in SYCL or the intel driver, this can be fixed by implementing the |
Since I just bought an Intel A770, I can confirm that this patch works: iff --git a/ggml-sycl.cpp b/ggml-sycl.cpp
index 1cc55ef5..e367f377 100644
--- a/ggml-sycl.cpp
+++ b/ggml-sycl.cpp
@@ -14758,6 +14758,10 @@ static size_t ggml_backend_sycl_buffer_type_get_alignment(ggml_backend_buffer_ty
UNUSED(buft);
}
+static size_t ggml_backend_sycl_buffer_type_get_max_size(ggml_backend_buffer_type_t buft) {
+ return 4ul * 1024ul * 1024ul * 1024ul;
+}
+
static size_t ggml_backend_sycl_buffer_type_get_alloc_size(ggml_backend_buffer_type_t buft, const ggml_tensor * tensor) {
int64_t row_low = 0;
int64_t row_high = ggml_nrows(tensor);
@@ -14788,7 +14792,7 @@ static ggml_backend_buffer_type_i ggml_backend_sycl_buffer_type_interface = {
/* .get_name = */ ggml_backend_sycl_buffer_type_name,
/* .alloc_buffer = */ ggml_backend_sycl_buffer_type_alloc_buffer,
/* .get_alignment = */ ggml_backend_sycl_buffer_type_get_alignment,
- /* .get_max_size = */ NULL, // TODO: return device.maxBufferLength
+ /* .get_max_size = */ ggml_backend_sycl_buffer_type_get_max_size,
/* .get_alloc_size = */ ggml_backend_sycl_buffer_type_get_alloc_size,
/* .supports_backend = */ ggml_backend_sycl_buffer_type_supports_backend,
/* .is_host = */ nullptr, But of course it should be device-dependant and I have no idea how to implement that. But this hack fixes the incoherence on models larger than 4GB, so maybe it already helps someone. |
@characharm can you try #5270 ? hengyume@mlp-618:~/llama.cpp/build$ ./bin/main -m ~/mythomax-l2-13b.Q5_K_M.gguf -p "Once upon a time, there existed a little girl, who liked to have adventures. She wanted to go to places and meet new people, and have fun" -n 32 -e -ngl 99 --no-mmap
Log start
main: build = 2042 (128dcbd3)
main: built with cc (Ubuntu 13.2.0-4ubuntu3) 13.2.0 for x86_64-linux-gnu
main: seed = 1706837823
GGML_SYCL_DEBUG=0
ggml_init_sycl: GGML_SYCL_FP16: no
ggml_init_sycl: SYCL_USE_XMX: yes
found 6 SYCL devices:
Device 0: Intel(R) Arc(TM) A770M Graphics, compute capability 1.3,
max compute_units 512, max work group size 1024, max sub group size 32, global mem size 16225243136
Device 1: Intel(R) FPGA Emulation Device, compute capability 1.2,
max compute_units 20, max work group size 67108864, max sub group size 64, global mem size 33197723648
Device 2: 12th Gen Intel(R) Core(TM) i7-12700H, compute capability 3.0,
max compute_units 20, max work group size 8192, max sub group size 64, global mem size 33197723648
Device 3: Intel(R) Arc(TM) A770M Graphics, compute capability 3.0,
max compute_units 512, max work group size 1024, max sub group size 32, global mem size 16225243136
Device 4: Intel(R) Graphics [0x4626], compute capability 3.0,
max compute_units 96, max work group size 512, max sub group size 32, global mem size 26558177280
Device 5: Intel(R) Graphics [0x4626], compute capability 1.3,
max compute_units 96, max work group size 512, max sub group size 32, global mem size 26558177280
Using device 0 (Intel(R) Arc(TM) A770M Graphics) as main device
llama_model_loader: loaded meta data with 19 key-value pairs and 363 tensors from /home/hengyume/mythomax-l2-13b.Q5_K_M.gguf (version GGUF V2)
llama_model_loader: Dumping metadata keys/values. Note: KV overrides do not apply in this output.
llama_model_loader: - kv 0: general.architecture str = llama
llama_model_loader: - kv 1: general.name str = LLaMA v2
llama_model_loader: - kv 2: llama.context_length u32 = 4096
llama_model_loader: - kv 3: llama.embedding_length u32 = 5120
llama_model_loader: - kv 4: llama.block_count u32 = 40
llama_model_loader: - kv 5: llama.feed_forward_length u32 = 13824
llama_model_loader: - kv 6: llama.rope.dimension_count u32 = 128
llama_model_loader: - kv 7: llama.attention.head_count u32 = 40
llama_model_loader: - kv 8: llama.attention.head_count_kv u32 = 40
llama_model_loader: - kv 9: llama.attention.layer_norm_rms_epsilon f32 = 0.000010
llama_model_loader: - kv 10: general.file_type u32 = 17
llama_model_loader: - kv 11: tokenizer.ggml.model str = llama
llama_model_loader: - kv 12: tokenizer.ggml.tokens arr[str,32000] = ["<unk>", "<s>", "</s>", "<0x00>", "<...
llama_model_loader: - kv 13: tokenizer.ggml.scores arr[f32,32000] = [0.000000, 0.000000, 0.000000, 0.0000...
llama_model_loader: - kv 14: tokenizer.ggml.token_type arr[i32,32000] = [2, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, ...
llama_model_loader: - kv 15: tokenizer.ggml.bos_token_id u32 = 1
llama_model_loader: - kv 16: tokenizer.ggml.eos_token_id u32 = 2
llama_model_loader: - kv 17: tokenizer.ggml.unknown_token_id u32 = 0
llama_model_loader: - kv 18: general.quantization_version u32 = 2
llama_model_loader: - type f32: 81 tensors
llama_model_loader: - type q5_K: 241 tensors
llama_model_loader: - type q6_K: 41 tensors
llm_load_vocab: special tokens definition check successful ( 259/32000 ).
llm_load_print_meta: format = GGUF V2
llm_load_print_meta: arch = llama
llm_load_print_meta: vocab type = SPM
llm_load_print_meta: n_vocab = 32000
llm_load_print_meta: n_merges = 0
llm_load_print_meta: n_ctx_train = 4096
llm_load_print_meta: n_embd = 5120
llm_load_print_meta: n_head = 40
llm_load_print_meta: n_head_kv = 40
llm_load_print_meta: n_layer = 40
llm_load_print_meta: n_rot = 128
llm_load_print_meta: n_embd_head_k = 128
llm_load_print_meta: n_embd_head_v = 128
llm_load_print_meta: n_gqa = 1
llm_load_print_meta: n_embd_k_gqa = 5120
llm_load_print_meta: n_embd_v_gqa = 5120
llm_load_print_meta: f_norm_eps = 0.0e+00
llm_load_print_meta: f_norm_rms_eps = 1.0e-05
llm_load_print_meta: f_clamp_kqv = 0.0e+00
llm_load_print_meta: f_max_alibi_bias = 0.0e+00
llm_load_print_meta: n_ff = 13824
llm_load_print_meta: n_expert = 0
llm_load_print_meta: n_expert_used = 0
llm_load_print_meta: rope scaling = linear
llm_load_print_meta: freq_base_train = 10000.0
llm_load_print_meta: freq_scale_train = 1
llm_load_print_meta: n_yarn_orig_ctx = 4096
llm_load_print_meta: rope_finetuned = unknown
llm_load_print_meta: model type = 13B
llm_load_print_meta: model ftype = Q5_K - Medium
llm_load_print_meta: model params = 13.02 B
llm_load_print_meta: model size = 8.60 GiB (5.67 BPW)
llm_load_print_meta: general.name = LLaMA v2
llm_load_print_meta: BOS token = 1 '<s>'
llm_load_print_meta: EOS token = 2 '</s>'
llm_load_print_meta: UNK token = 0 '<unk>'
llm_load_print_meta: LF token = 13 '<0x0A>'
llm_load_tensors: ggml ctx size = 0.28 MiB
llm_load_tensors: offloading 40 repeating layers to GPU
llm_load_tensors: offloading non-repeating layers to GPU
llm_load_tensors: offloaded 41/41 layers to GPU
llm_load_tensors: buffer size = 8694.21 MiB
llm_load_tensors: CPU buffer size = 107.42 MiB
...................................................................................................
llama_new_context_with_model: n_ctx = 512
llama_new_context_with_model: freq_base = 10000.0
llama_new_context_with_model: freq_scale = 1
llama_kv_cache_init: KV buffer size = 400.00 MiB
llama_new_context_with_model: KV self size = 400.00 MiB, K (f16): 200.00 MiB, V (f16): 200.00 MiB
llama_new_context_with_model: CPU input buffer size = 11.01 MiB
llama_new_context_with_model: compute buffer size = 82.50 MiB
llama_new_context_with_model: CPU compute buffer size = 11.00 MiB
llama_new_context_with_model: graph splits (measure): 3
system_info: n_threads = 10 / 20 | AVX = 1 | AVX_VNNI = 1 | AVX2 = 1 | AVX512 = 0 | AVX512_VBMI = 0 | AVX512_VNNI = 0 | FMA = 1 | NEON = 0 | ARM_FMA = 0 | F16C = 1 | FP16_VA = 0 | WASM_SIMD = 0 | BLAS = 1 | SSE3 = 1 | SSSE3 = 1 | VSX = 0 |
sampling:
repeat_last_n = 64, repeat_penalty = 1.100, frequency_penalty = 0.000, presence_penalty = 0.000
top_k = 40, tfs_z = 1.000, top_p = 0.950, min_p = 0.050, typical_p = 1.000, temp = 0.800
mirostat = 0, mirostat_lr = 0.100, mirostat_ent = 5.000
sampling order:
CFG -> Penalties -> top_k -> tfs_z -> typical_p -> top_p -> min_p -> temp
generate: n_ctx = 512, n_batch = 512, n_predict = 32, n_keep = 0
Once upon a time, there existed a little girl, who liked to have adventures. She wanted to go to places and meet new people, and have fun along the way. One day, she decided that she would pack her bags and leave for an exciting journey to a faraway land called India.
llama_print_timings: load time = 12740.44 ms
llama_print_timings: sample time = 3.37 ms / 32 runs ( 0.11 ms per token, 9504.01 tokens per second)
llama_print_timings: prompt eval time = 1089.83 ms / 33 tokens ( 33.03 ms per token, 30.28 tokens per second)
llama_print_timings: eval time = 3235.10 ms / 31 runs ( 104.36 ms per token, 9.58 tokens per second)
llama_print_timings: total time = 4335.06 ms / 64 tokens
Log end |
SYCL is producing garbled results on above 4 GB allocations of GPU memory.
main.exe -ngl 99 -n 512 -m "D:\models\mythomax-l2-13b.Q5_K_M.gguf" -f "G:\llama.cpp-vulkan\prompts\chat-with-bob.txt"
produced a buffer size of 8694.21 MiB, and this was the output:with
main.exe -ngl 8 -n 512 -m "D:\models\mythomax-l2-13b.Q5_K_M.gguf" -f "G:\llama.cpp-vulkan\prompts\chat-with-bob.txt"
this is what i got on outputThe text was updated successfully, but these errors were encountered: