mirror of
https://github.com/ggml-org/whisper.cpp.git
synced 2026-10-19 15:46:13 +02:00
metal : key the fa-vec tuned table by family instead of SKU (llama/29075)
* key the fa-vec tuned table by family instead of SKU * fall back to baseline for untuned fa-vec gpu families
This commit is contained in:
committed by
Georgi Gerganov
parent
185213231b
commit
6bc51cc745
@@ -3584,7 +3584,6 @@ int ggml_metal_op_flash_attn_ext(ggml_metal_op_t ctx, int idx) {
|
|||||||
auto cfg = use_sparse
|
auto cfg = use_sparse
|
||||||
? ggml_metal_tuning::fa_vec_baseline_cfg((int) ne00, (int) ne20)
|
? ggml_metal_tuning::fa_vec_baseline_cfg((int) ne00, (int) ne20)
|
||||||
: ggml_metal_tuning::fa_vec_pick(
|
: ggml_metal_tuning::fa_vec_pick(
|
||||||
props_dev->device_id,
|
|
||||||
props_dev->gpu_family,
|
props_dev->gpu_family,
|
||||||
(int) op->src[1]->type,
|
(int) op->src[1]->type,
|
||||||
(int) ne00, (int) ne20, // dk, dv (ne00 == dk for FA)
|
(int) ne00, (int) ne20, // dk, dv (ne00 == dk for FA)
|
||||||
|
|||||||
+1057
-3939
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ggml-metal-device.h" // enum ggml_metal_device_id
|
|
||||||
#include "ggml.h"
|
#include "ggml.h"
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@@ -32,7 +31,7 @@ constexpr int8_t FA_VEC_DOMAIN_DECODE = 0; // ne01 == 1
|
|||||||
constexpr int8_t FA_VEC_DOMAIN_BATCH = 1; // ne01 >= 2
|
constexpr int8_t FA_VEC_DOMAIN_BATCH = 1; // ne01 >= 2
|
||||||
|
|
||||||
struct fa_vec_key_t {
|
struct fa_vec_key_t {
|
||||||
int8_t device_id;
|
int8_t family;
|
||||||
int8_t dtype;
|
int8_t dtype;
|
||||||
int16_t dk;
|
int16_t dk;
|
||||||
int16_t dv;
|
int16_t dv;
|
||||||
@@ -70,8 +69,7 @@ void fa_vec_set_override(fa_vec_cfg_t cfg);
|
|||||||
void fa_vec_clear_override();
|
void fa_vec_clear_override();
|
||||||
fa_vec_cfg_t fa_vec_baseline_cfg(int dk, int dv);
|
fa_vec_cfg_t fa_vec_baseline_cfg(int dk, int dv);
|
||||||
|
|
||||||
// device_id selects a per-SKU row; on a miss, gpu_family (0 if unknown) maps to a representative
|
// Keyed by Apple GPU family; an untuned family matches no row and gets the baseline.
|
||||||
// SKU and the table is retried. No match -> baseline.
|
fa_vec_cfg_t fa_vec_pick(int gpu_family, int dtype, int dk, int dv, int64_t ne11, int64_t ne01);
|
||||||
fa_vec_cfg_t fa_vec_pick(enum ggml_metal_device_id device_id, int gpu_family, int dtype, int dk, int dv, int64_t ne11, int64_t ne01);
|
|
||||||
|
|
||||||
} // namespace ggml_metal_tuning
|
} // namespace ggml_metal_tuning
|
||||||
|
|||||||
Reference in New Issue
Block a user