Skip to content

[FEAT][kernels]: implement TMA-accelerated Online Softmax Fused LogP for SM90+ - #26

Merged
Flink-ddd merged 2 commits into
mainfrom
feat/tma-logp-sm90
May 26, 2026
Merged

Flink-ddd merged 2 commits into
mainfrom
feat/tma-logp-sm90

Conversation

@Flink-ddd

Copy link
Copy Markdown
Collaborator

Overview

This PR introduces a highly optimized, hardware-aware fused LogP kernel utilizing TMA and Warp Specialization targeting NVIDIA Hopper (SM90) and Blackwell (SM100/SM120) architectures.

By eliminating the intermediate memory bottlenecks of the standard LogP computation in DPO/GRPO pipelines, this implementation drastically reduces global memory traffic and pushes the kernel performance closer to the hardware limit.

Key Technical Architectures

  1. Warp Specialization:
    Warp 0 Producer: Dedicates to orchestration, issuing asynchronous cp.async.bulk.tensor.2d instructions to load logits tiles into Shared Memory via hardware mbarrier synchronization.
    Warps 1-3 Consumers: Dedicates to math execution, performing high-performance block-level reductions asynchronously without stalling data transfers.
  2. Tiling & Online Softmax Algorithm:
    Instead of allocating massive Shared Memory for the entire vocabulary, which causes OOM on larger vocabularies, we implement an Online Softmax reduction. Logits are streamed in chunks of TILE_V=4096, calculating local maximums and running scaling factors dynamically.
  3. Dynamic Hardware-Aware Dispatching:
    Integrated into KernelRegistry. The registry dynamically checks the GPU compute capability at runtime. If cc >= 90, the TMA-accelerated fused kernel is automatically prioritized over FlashInfer and Triton fallbacks.

Closes #25

@Flink-ddd
Flink-ddd force-pushed the feat/tma-logp-sm90 branch from 8e26c29 to ec042ac Compare May 26, 2026 06:42
@Flink-ddd
Flink-ddd merged commit 67bef41 into main May 26, 2026
3 checks passed
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.

[FEAT][csrc]: implement TMA-accelerated fused LogP kernel with Warp Specialization for SM90+

1 participant