b4803c3259b980e44f0e6c0a2c03802c3d08a9be
Random CCCL pick: cub/test/catch2_test_device_topk_env_api.cu (290 lines, full) CCCL DeviceTopK uses cuda::execution::output_ordering::unsorted — top-k results are NOT sorted by default. The test sorts results AFTER retrieval only for verification, not during the algorithm. Our sampler's torch.topk(logits, k) defaults to sorted=True, which adds an unnecessary final sort step after the radix selection. For sampling, we only need the THRESHOLD value (min of top-k set) to mask logits below it — the ordering within top-k is irrelevant. Change: torch.topk(..., sorted=False) in the top-k fast path. This skips the O(k log k) sort of the selected elements. For Qwen3.6 with top_k=20, k=20 sort is cheap, but it's free to eliminate and matches CCCL's unsorted-by-default design. CCCL also teaches: determinism::not_guaranteed is acceptable for top-k in sampling contexts (temperature > 0 = inherent randomness). Base file modified: qwen3_6_scripts/sampler.py (deployed via patch_ops.sh)
project_6
Description
Languages
C++
41.8%
Cuda
31.6%
Python
22.2%
C
2.1%
CMake
1.1%
Other
1.1%