mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2026-09-03 03:21:16 +02:00
honor -o in the FA vec (Q,NE) slice
This commit is contained in:
committed by
Georgi Gerganov
parent
26bf53d829
commit
545c66e12b
@@ -10589,9 +10589,37 @@ static std::vector<int> fa_vec_legal_ne(int dk, int dv) {
|
||||
return r;
|
||||
}
|
||||
|
||||
static bool op_names_filter_selects(const char * op_names_filter, const char * op_name) {
|
||||
if (!op_names_filter) {
|
||||
return true;
|
||||
}
|
||||
std::string_view filter(op_names_filter);
|
||||
while (!filter.empty()) {
|
||||
auto comma_pos = filter.find_first_of(',');
|
||||
const auto lparen_pos = filter.find_first_of('(');
|
||||
std::string_view entry;
|
||||
if (lparen_pos < comma_pos) {
|
||||
const auto rparen_pos = filter.find_first_of(')');
|
||||
comma_pos = filter.find_first_of(',', rparen_pos);
|
||||
entry = filter.substr(0, lparen_pos);
|
||||
} else {
|
||||
entry = filter.substr(0, comma_pos);
|
||||
}
|
||||
if (entry == op_name) {
|
||||
return true;
|
||||
}
|
||||
filter = comma_pos != std::string_view::npos ? filter.substr(comma_pos + 1) : "";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Covers padded rows, sinks, kvpad, multi-SIMDgroup reduction, quantized K/V, and MLA views.
|
||||
// The override is backend-global, so this runs after all parallel workers have joined.
|
||||
static bool run_fa_vec_slice(ggml_backend_t backend, ggml_backend_t backend_cpu) {
|
||||
static bool run_fa_vec_slice(ggml_backend_t backend, ggml_backend_t backend_cpu, const char * op_names_filter) {
|
||||
if (!op_names_filter_selects(op_names_filter, "FLASH_ATTN_EXT")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
auto * reg = ggml_backend_dev_backend_reg(ggml_backend_get_device(backend));
|
||||
|
||||
auto set_ov = (set_fa_vec_override_t) ggml_backend_reg_get_proc_address(reg, "ggml_backend_metal_tuning_set_fa_vec_override");
|
||||
@@ -10777,7 +10805,7 @@ static bool test_backend(ggml_backend_t backend, ggml_backend_dev_t dev, test_mo
|
||||
output_printer->print_summary(test_summary_info(n_ok, tests_run, false));
|
||||
output_printer->print_failed_tests(failed_tests);
|
||||
|
||||
const bool slice_ok = run_fa_vec_slice(backend, backend_cpu.get());
|
||||
const bool slice_ok = run_fa_vec_slice(backend, backend_cpu.get(), op_names_filter);
|
||||
|
||||
return n_ok == tests_run && slice_ok;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user