Paper describes heap-based Top-k kernel, but codebase seems to use a different Top-k implementation
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 422
- Forks
- 57
- Avg merge
- 15h 50m
- Merged PRs (30d)
- 1
Description
Hi, thanks for open-sourcing MSA.
In Section 4.1 of the paper, the Top-k kernel is described as a heap-based implementation:
Each of the warp’s 32 lanes streams a 1/32 stride of the input row and maintains a k-element min-heap in shared memory. The heap root is cached in a register, and insertions are performed with deferred writes. Finally, a k-round shuffle merge combines the 32 local TopK results.
However, in the current codebase I could not find this heap-based Top-k implementation.
The exposed API:
from fmha_sm100 import sparse_topk_select
appears to call:
python/fmha_sm100/api.py::sparse_topk_select
python/fmha_sm100/csrc/sparse_topk_select.cu
python/fmha_sm100/csrc/include/sparse_topk_select.cuh
The implementation in sparse_topk_select.cuh seems to be based on TensorRT-LLM indexerTopK, using histogram/threshold selection plus insertion sort, rather than the per-lane min-heap + shuffle-merge algorithm described in the paper.
Could you clarify:
- Is the heap-based Top-k kernel from the paper included in this repository?
- If yes, where is the implementation located?
- If no, is the current sparse_topk_select implementation intended to replace the paper-described heap-based kernel?
- Are the benchmark numbers in the paper based on the heap-based kernel or the currently released sparse_topk_select kernel?
Thanks!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read Section 4.1 of the paper and trace the exposed API through python/fmha_sm100/api.py::sparse_topk_select, python/fmha_sm100/csrc/sparse_topk_select.cu, and python/fmha_sm100/csrc/include/sparse_topk_select.cuh. Compare the described heap-based kernel with the TensorRT-LLM-style implementation and document whether the paper kernel is present, which implementation is intended, and which one produced the benchmark numbers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- machine-learning, performance
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100