Skip to content
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

musa: enable building fat binaries, enable VMM support, and disable Flash Attention on QY1 (MTT S80) #9526

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yeahdongcn
Copy link
Contributor

@yeahdongcn yeahdongcn commented Sep 18, 2024

This PR enables building fat binaries for both QY1 (mp_21, MTT S80) and QY2 (mp_22, MTT S4000), and restores VMM support (the issue mentioned in #8383 has been fixed). However, due to a known issue when compiling Flash Attention on QY1, it has been explicitly disabled.

Testing done

  • make GGML_MUSA=1 -> passed

  • ran tinyllama model on MTT S80 and MTT S4000 -> passed

    root@e9c2e4c9121b:/ws# ./llama-cli -ngl 999
    build: 3783 (df79623d) with clang version 14.0.0 ([email protected]:sw/mtcc.git a0d2558b470b4b21e99af11c036fab6801e57075) for x86_64-unknown-linux-gnu
    main: llama backend init
    main: load the model and apply lora adapter, if any
    llama_model_loader: loaded meta data with 23 key-value pairs and 201 tensors from models/7B/ggml-model-f16.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              = llama
    llama_model_loader: - kv   1:                               general.name str              = TinyLlama
    llama_model_loader: - kv   2:                       llama.context_length u32              = 2048
    llama_model_loader: - kv   3:                     llama.embedding_length u32              = 2048
    llama_model_loader: - kv   4:                          llama.block_count u32              = 22
    llama_model_loader: - kv   5:                  llama.feed_forward_length u32              = 5632
    llama_model_loader: - kv   6:                 llama.rope.dimension_count u32              = 64
    llama_model_loader: - kv   7:                 llama.attention.head_count u32              = 32
    llama_model_loader: - kv   8:              llama.attention.head_count_kv u32              = 4
    llama_model_loader: - kv   9:     llama.attention.layer_norm_rms_epsilon f32              = 0.000010
    llama_model_loader: - kv  10:                       llama.rope.freq_base f32              = 10000.000000
    llama_model_loader: - kv  11:                          general.file_type u32              = 2
    llama_model_loader: - kv  12:                       tokenizer.ggml.model str              = llama
    llama_model_loader: - kv  13:                      tokenizer.ggml.tokens arr[str,32000]   = ["<unk>", "<s>", "</s>", "<0x00>", "<...
    llama_model_loader: - kv  14:                      tokenizer.ggml.scores arr[f32,32000]   = [0.000000, 0.000000, 0.000000, 0.0000...
    llama_model_loader: - kv  15:                  tokenizer.ggml.token_type arr[i32,32000]   = [2, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, ...
    llama_model_loader: - kv  16:                      tokenizer.ggml.merges arr[str,61249]   = ["▁ t", "e r", "i n", "▁ a", "e n...
    llama_model_loader: - kv  17:                tokenizer.ggml.bos_token_id u32              = 1
    llama_model_loader: - kv  18:                tokenizer.ggml.eos_token_id u32              = 2
    llama_model_loader: - kv  19:            tokenizer.ggml.unknown_token_id u32              = 0
    llama_model_loader: - kv  20:            tokenizer.ggml.padding_token_id u32              = 2
    llama_model_loader: - kv  21:                    tokenizer.chat_template str              = {% for message in messages %}\n{% if m...
    llama_model_loader: - kv  22:               general.quantization_version u32              = 2
    llama_model_loader: - type  f32:   45 tensors
    llama_model_loader: - type q4_0:  155 tensors
    llama_model_loader: - type q6_K:    1 tensors
    llm_load_vocab: special tokens cache size = 3
    llm_load_vocab: token to piece cache size = 0.1684 MB
    llm_load_print_meta: format           = GGUF V3 (latest)
    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: vocab_only       = 0
    llm_load_print_meta: n_ctx_train      = 2048
    llm_load_print_meta: n_embd           = 2048
    llm_load_print_meta: n_layer          = 22
    llm_load_print_meta: n_head           = 32
    llm_load_print_meta: n_head_kv        = 4
    llm_load_print_meta: n_rot            = 64
    llm_load_print_meta: n_swa            = 0
    llm_load_print_meta: n_embd_head_k    = 64
    llm_load_print_meta: n_embd_head_v    = 64
    llm_load_print_meta: n_gqa            = 8
    llm_load_print_meta: n_embd_k_gqa     = 256
    llm_load_print_meta: n_embd_v_gqa     = 256
    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: f_logit_scale    = 0.0e+00
    llm_load_print_meta: n_ff             = 5632
    llm_load_print_meta: n_expert         = 0
    llm_load_print_meta: n_expert_used    = 0
    llm_load_print_meta: causal attn      = 1
    llm_load_print_meta: pooling type     = 0
    llm_load_print_meta: rope type        = 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_ctx_orig_yarn  = 2048
    llm_load_print_meta: rope_finetuned   = unknown
    llm_load_print_meta: ssm_d_conv       = 0
    llm_load_print_meta: ssm_d_inner      = 0
    llm_load_print_meta: ssm_d_state      = 0
    llm_load_print_meta: ssm_dt_rank      = 0
    llm_load_print_meta: ssm_dt_b_c_rms   = 0
    llm_load_print_meta: model type       = 1B
    llm_load_print_meta: model ftype      = Q4_0
    llm_load_print_meta: model params     = 1.10 B
    llm_load_print_meta: model size       = 606.53 MiB (4.63 BPW) 
    llm_load_print_meta: general.name     = TinyLlama
    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: PAD token        = 2 '</s>'
    llm_load_print_meta: LF token         = 13 '<0x0A>'
    llm_load_print_meta: max token length = 48
    ggml_cuda_init: GGML_CUDA_FORCE_MMQ:    no
    ggml_cuda_init: GGML_CUDA_FORCE_CUBLAS: no
    ggml_cuda_init: found 1 MUSA devices:
      Device 0: MTT S80, compute capability 2.1, VMM: yes
    llm_load_tensors: ggml ctx size =    0.19 MiB
    llm_load_tensors: offloading 22 repeating layers to GPU
    llm_load_tensors: offloading non-repeating layers to GPU
    llm_load_tensors: offloaded 23/23 layers to GPU
    llm_load_tensors:      MUSA0 buffer size =   571.37 MiB
    llm_load_tensors:        CPU buffer size =    35.16 MiB
    ......................................................................................
    llama_new_context_with_model: n_ctx      = 2048
    llama_new_context_with_model: n_batch    = 2048
    llama_new_context_with_model: n_ubatch   = 512
    llama_new_context_with_model: flash_attn = 0
    llama_new_context_with_model: freq_base  = 10000.0
    llama_new_context_with_model: freq_scale = 1
    llama_kv_cache_init:      MUSA0 KV buffer size =    44.00 MiB
    llama_new_context_with_model: KV self size  =   44.00 MiB, K (f16):   22.00 MiB, V (f16):   22.00 MiB
    llama_new_context_with_model:  MUSA_Host  output buffer size =     0.12 MiB
    llama_new_context_with_model:      MUSA0 compute buffer size =   148.00 MiB
    llama_new_context_with_model:  MUSA_Host compute buffer size =     8.01 MiB
    llama_new_context_with_model: graph nodes  = 710
    llama_new_context_with_model: graph splits = 2
    llama_init_from_gpt_params: warming up the model with an empty run - please wait ... (--no-warmup to disable)
    main: llama threadpool init, n_threads = 6
    
  • ./tests/test-backend-ops -> passed full log

      1442/1442 tests passed
      Backend MUSA0: OK
    
    2/2 backends passed
    OK
    

Signed-off-by: Xiaodong Ye <[email protected]>
Signed-off-by: Xiaodong Ye <[email protected]>
@github-actions github-actions bot added the Nvidia GPU Issues specific to Nvidia GPUs label Sep 18, 2024
common/arg.cpp Outdated Show resolved Hide resolved
@yeahdongcn yeahdongcn force-pushed the upstream_master branch 2 times, most recently from 98bf998 to abbc1f2 Compare September 18, 2024 09:54
common/arg.cpp Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Nvidia GPU Issues specific to Nvidia GPUs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants