---
id: pr-flashinfer-3009
repo: flashinfer-ai/flashinfer
pr: 3009
title: '[feat] Faster topk algorithm'
author: Aalanli
date: '2026-04-20'
url: https://github.com/flashinfer-ai/flashinfer/pull/3009
source_category: upstream-code
architectures:
- sm90
tags:
- arch_pipeline
- attention_kv
- benchmark_test
- compiler_runtime
- cuda kernel
- moe_routing
- topk
techniques:
- pipeline-stages
hardware_features:
- hopper
kernel_types:
- attention
- compiler
- moe
- runtime
languages:
- cuda-cpp
captured_at: '2026-05-16'
status: merged
merge_sha: 44a2672a4f937f5db1fa50f7344b1839d2b48038
inclusion_reason: Mine shape sets, tolerance rules, warmup logic, and profile commands before mutating code.
changed_paths:
- benchmarks/bench_topk.py
- csrc/flashinfer_fast_topk_clusters_binding.cu
- flashinfer/jit/topk.py
- flashinfer/testing/utils.py
- flashinfer/topk.py
- flashinfer/utils.py
- include/flashinfer/fast_topk_clusters_exact.cuh
- include/flashinfer/topk.cuh
- include/flashinfer/topk_common.cuh
- tests/utils/test_topk.py
artifact_dir: evidence/pull-bundles/flashinfer/gh-3009
head_ref_oid: ada16290edcca210efdbe2c0cb6c9ae4ba8fc52a
---
# [feat] Faster topk algorithm

- Repository: `flashinfer-ai/flashinfer`
- PR: [3009](https://github.com/flashinfer-ai/flashinfer/pull/3009)
- Decision: `Mine shape sets, tolerance rules, warmup logic, and profile commands before mutating code.`
- Reason: Mine shape sets, tolerance rules, warmup logic, and profile commands before mutating code.

## Changed Paths

- `benchmarks/bench_topk.py`
- `csrc/flashinfer_fast_topk_clusters_binding.cu`
- `flashinfer/jit/topk.py`
- `flashinfer/testing/utils.py`
- `flashinfer/topk.py`
- `flashinfer/utils.py`
- `include/flashinfer/fast_topk_clusters_exact.cuh`
- `include/flashinfer/topk.cuh`
- `include/flashinfer/topk_common.cuh`
- `tests/utils/test_topk.py`

## Evidence Bundle

`evidence/pull-bundles/flashinfer/gh-3009`
