Skip to content

[CK_TILE] Top-K with Sigmoid kernel#3062

Merged
illsilin merged 7 commits intodevelopfrom
samremes/topk_sigmoid
Oct 28, 2025
Merged

[CK_TILE] Top-K with Sigmoid kernel#3062
illsilin merged 7 commits intodevelopfrom
samremes/topk_sigmoid

Conversation

@samremes
Copy link
Contributor

@samremes samremes commented Oct 20, 2025

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 x into 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.

  • I have added tests relevant to the introduced functionality, and the unit tests are passing locally
  • I have added the test to REGRESSION_TESTS list defined at the top of CMakeLists.txt in tests/CMakeLists.txt, IF the test takes more than 30 seconds to run.
  • I have added inline documentation which enables the maintainers with understanding the motivation
  • I have removed the stale documentation which is no longer relevant after this pull request
  • (If this change is user-facing) I have added release notes which provide the end users with a brief summary of the improvement from this pull request
  • I have run clang-format on all changed files
  • Any dependent changes have been merged

Discussion

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

spolifroni-amd
spolifroni-amd previously approved these changes Oct 23, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ActivationIsSoftmax boolean 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>
@illsilin illsilin merged commit 515e283 into develop Oct 28, 2025
48 checks passed
@illsilin illsilin deleted the samremes/topk_sigmoid branch October 28, 2025 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants