[CK_TILE] Top-K with Sigmoid kernel#3062
Merged
Conversation
1 task
spolifroni-amd
previously approved these changes
Oct 23, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR extends the existing top-k softmax kernel to support sigmoid activation as an alternative to softmax. The implementation adds a template parameter to control the activation function and updates the API to accept an activation type parameter.
Key changes:
- Added sigmoid activation support alongside existing softmax functionality
- Modified the problem and pipeline templates to accept an
ActivationIsSoftmaxboolean parameter - Updated test and example code to support the new activation parameter
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
include/ck_tile/ops/topk_softmax/pipeline/topk_softmax_warp_per_row_problem.hpp |
Added ActivationIsSoftmax template parameter to control activation function |
include/ck_tile/ops/topk_softmax/pipeline/topk_softmax_warp_per_row_pipeline.hpp |
Implemented conditional logic to apply sigmoid or softmax based on the template parameter |
include/ck_tile/ops/topk_softmax/kernel/topk_softmax_kernel.hpp |
Fixed typo in comment ("tpok" → "topk") |
test/ck_tile/topk_softmax/test_topk_softmax_api.hpp |
Added activation field to trait struct |
test/ck_tile/topk_softmax/test_topk_softmax_api.cpp |
Extended dispatch logic to handle sigmoid activation for fp16 and bf16 types |
test/ck_tile/topk_softmax/test_topk_softmax.hpp |
Added reference implementation for sigmoid, activation parameter, and new test cases |
example/ck_tile/09_topk_softmax/topk_softmax_api.hpp |
Added activation field to trait struct |
example/ck_tile/09_topk_softmax/topk_softmax_api.cpp |
Extended dispatch logic to handle sigmoid activation for fp16 and bf16 types |
example/ck_tile/09_topk_softmax/topk_softmax.cpp |
Added reference implementation for sigmoid and activation parameter support |
CHANGELOG.md |
Added release note for the new top-k sigmoid kernel |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
aosewski
approved these changes
Oct 28, 2025
illsilin
approved these changes
Oct 28, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
Add top-k with sigmoid to the existing softmax version. Enabling it also through aiter once this PR is merged: ROCm/aiter#1251
Checklist
Please put an
xinto the boxes that apply. You can also fill these out after creating the PR. If you're not sure, please don't hesitate to ask.clang-formaton all changed filesDiscussion
If this is a relatively large or complex change, feel free to start a discussion by explaining why you chose the solution you did and what alternatives you considered