Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,8 @@ if(BASIC_KERNELS_ENABLED)
"csrc/quantization/fp8/fp8_quant.cpp"
"csrc/xpu_view.cpp"
"csrc/tensor_utils.cpp"
"csrc/utils/mem_cpy.cpp")
"csrc/utils/mem_cpy.cpp"
"csrc/topk_per_row.cpp")
include_directories("/usr/include")

define_gpu_extension_target(
Expand Down
20 changes: 20 additions & 0 deletions csrc/ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,23 @@ void swap_blocks(
torch::Tensor& dst,
int64_t block_size_in_bytes,
const torch::Tensor& block_mapping);

void top_k_per_row_decode(
const torch::Tensor& logits,
int64_t next_n,
const torch::Tensor& seqLens,
torch::Tensor& indices,
int64_t numRows,
int64_t stride0,
int64_t stride1,
int64_t topK);

void top_k_per_row_prefill(
const torch::Tensor& logits,
const torch::Tensor& rowStarts,
const torch::Tensor& rowEnds,
torch::Tensor& indices,
int64_t numRows,
int64_t stride0,
int64_t stride1,
int64_t topK);
Loading