| 516 | |
| 517 | |
| 518 | BlockMLA::BlockMLA( |
| 519 | int layer_i, |
| 520 | const std::shared_ptr<Config> config, |
| 521 | const Tensor* rms_att_weight, |
| 522 | const Tensor* rms_q_a_weight, |
| 523 | const Tensor* rms_kv_a_weight, |
| 524 | const Tensor* rms_ffn_weight, |
| 525 | const Tensor* wq_a, |
| 526 | const Tensor* sq_a, |
| 527 | const Tensor* wkv_a, |
| 528 | const Tensor* skv_a, |
| 529 | const Tensor* wo, |
| 530 | const Tensor* so, |
| 531 | const Tensor* wc, |
| 532 | const Tensor* sc, |
| 533 | const Tensor* wq_rope_b, |
| 534 | const Tensor* sq_rope_b, |
| 535 | const Tensor* wv_b, |
| 536 | const Tensor* sv_b, |
| 537 | const Tensor* w1, |
| 538 | const Tensor* s1, |
| 539 | const Tensor* w2, |
| 540 | const Tensor* s2, |
| 541 | const Tensor* w3, |
| 542 | const Tensor* s3, |
| 543 | const Tensor* shared_w1, |
| 544 | const Tensor* shared_s1, |
| 545 | const Tensor* shared_w2, |
| 546 | const Tensor* shared_s2, |
| 547 | const Tensor* shared_w3, |
| 548 | const Tensor* shared_s3, |
| 549 | const Tensor* moegate, |
| 550 | const Tensor* moegate_bias |
| 551 | ) : Block(layer_i, config, rms_att_weight, rms_ffn_weight, w1, s1, w2, s2, w3, s3, shared_w1, shared_s1, shared_w2, shared_s2, shared_w3, shared_s3, moegate, moegate_bias) { |
| 552 | |
| 553 | bool need_block_scales = _config->weight_quant == Quant::F8E5M2; |
| 554 | int b0 = config->block_size[0]; |
| 555 | int b1 = config->block_size[1]; |
| 556 | |
| 557 | _rms_q_a_weight = check_tensor( |
| 558 | rms_q_a_weight, Quant::F32, {config->q_lora_rank, 0, 0, 0}, __LINE__ |
| 559 | ); |
| 560 | _rms_kv_a_weight = check_tensor( |
| 561 | rms_kv_a_weight, Quant::F32, {config->kv_lora_rank, 0, 0, 0}, __LINE__ // Only norm latent part |
| 562 | ); |
| 563 | |
| 564 | _wq_a = check_tensor( |
| 565 | wq_a, config->weight_quant, {config->q_lora_rank, config->dim, 0, 0}, __LINE__ |
| 566 | ); |
| 567 | _wkv_a = check_tensor( |
| 568 | wkv_a, config->weight_quant, {config->kv_lora_rank + config->qk_rope_head_dim, config->dim, 0, 0}, __LINE__ |
| 569 | ); |
| 570 | _wc = check_tensor( |
| 571 | wc, config->weight_quant, {config->n_heads * config->kv_lora_rank, config->q_lora_rank, 0, 0}, __LINE__ |
| 572 | ); |
| 573 | _wq_rope_b = check_tensor( |
| 574 | wq_rope_b, config->weight_quant, {config->n_heads * config->qk_rope_head_dim, config->q_lora_rank, 0, 0}, __LINE__ |
| 575 | ); |
nothing calls this directly
no test coverage detected