Commit 0d7733f7 for whisper.cpp

commit 0d7733f7dffea2af7598be202c640ddbd4a75f62
Author: mpermino <maxim.perminov@intel.com>
Date:   Mon Nov 23 20:46:13 2026 -0800

    whisper : remove unused logits_id sort in whisper_sample_token_topk (#4187)

    whisper_sample_token_topk() copies all n_vocab (logit, id) pairs into
    decoder.logits_id vector and partial_sorts the top k on every call, but
    the result is never read. It was used before PR #1229, but since then
    the candidates are drawn from std::discrete_distribution over probs.

    This happens at every sampling, could be 1000s times per second on fast
    systems. No change in output; a few % of perf gain.

    The only other function that accesses decoder.logits_id is
    whisper_lang_auto_detect(), but it always refills it, so it's not affected.

diff --git a/src/whisper.cpp b/src/whisper.cpp
index ae9004d5..c978b6e6 100644
--- a/src/whisper.cpp
+++ b/src/whisper.cpp
@@ -6697,29 +6697,10 @@ static std::vector<whisper_token_data> whisper_sample_token_topk(
     const auto & vocab = ctx.vocab;

     const auto & probs    = decoder.probs;
-    const auto & logits   = decoder.logits;
     const auto & logprobs = decoder.logprobs;

     const int n_logits = vocab.n_vocab;

-    auto & logits_id = decoder.logits_id;
-
-    logits_id.resize(n_logits);
-    for (int i = 0; i < n_logits; ++i) {
-        logits_id[i].first = logits[i];
-        logits_id[i].second = i;
-    }
-
-    {
-        using pair_type = std::remove_reference<decltype(logits_id)>::type::value_type;
-        std::partial_sort(
-                logits_id.begin(),
-                logits_id.begin() + k, logits_id.end(),
-                [](const pair_type & a, const pair_type & b) {
-            return a.first > b.first;
-        });
-    }
-
     std::vector<whisper_token_data> result;
     result.reserve(k);