Skip to content

[CK Tile] Async support preshuffle GEMM - #5854

Merged
EnricoDeg merged 9 commits into
developfrom
users/enricodeg/ck/preshuffle-async-gemm
Jun 5, 2026
Merged

[CK Tile] Async support preshuffle GEMM#5854
EnricoDeg merged 9 commits into
developfrom
users/enricodeg/ck/preshuffle-async-gemm

Conversation

@EnricoDeg

Copy link
Copy Markdown
Contributor

Motivation

Add async support to existing preshuffle GEMM pipeline

Technical Details

Notes:
the implementation avoids previous strategy of duplicating pipelines for async support and instead add a switch Async to the ops Problem to enable async pipeline. Then, integrate the async pipeline in the existing one. This allows to avoid code duplication and facilitate the integration of buffer load to lds in existing pipelines. In my opinion, it should be used also for other pipelines which don't support buffer load to lds yet and it would also be a good idea to refactor the existing async GEMM pipelines with the same approach.

Summary:

  • integrate buffer load to lds in existing pipeline
  • add optimal tensor descriptors for vmem loading and lds reading. They are currently optimized for 16x16 wave tiles but they also work for 32x32 wave tiles. Optimizations for 32x32 wave tile requires different lds layout and it will be done in a follow-up issue
  • Add async config to examples
  • Add test (gfx950 only)

Test Plan

New test for gfx950 test_ck_tile_gemm_pipeline_wp_async

Submission Checklist

@EnricoDeg
EnricoDeg requested a review from a team as a code owner March 26, 2026 10:55
@EnricoDeg EnricoDeg added the organization: streamhpc contributors from streamhpc label Mar 26, 2026
@EnricoDeg EnricoDeg self-assigned this Mar 26, 2026
@EnricoDeg EnricoDeg changed the title [CK Tile] Async pipeline preshuffle GEMM [CK Tile] Async support preshuffle GEMM Mar 26, 2026
@EnricoDeg
EnricoDeg force-pushed the users/enricodeg/ck/preshuffle-async-gemm branch from 8ea8eec to 4f84184 Compare March 26, 2026 17:21
@EnricoDeg
EnricoDeg marked this pull request as draft March 26, 2026 22:28
@EnricoDeg
EnricoDeg force-pushed the users/enricodeg/ck/preshuffle-async-gemm branch 2 times, most recently from bf1a872 to 5737191 Compare March 30, 2026 08:47

@JP-Fernando JP-Fernando left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Clean implementation of an Async switch which avoids pipeline duplication. The Async paths are clearly separated by conditional compilation (if constexpr), and the lambdas like global_prefetch() make the code readable and maintainable - I prefer lambdas with conditional compilation to endless overloads, certainly. My questions and comments are only about clarity and stricter maintenance.

Comment thread projects/composablekernel/example/ck_tile/03_gemm/gemm_utils.hpp
@EnricoDeg
EnricoDeg force-pushed the users/enricodeg/ck/preshuffle-async-gemm branch 2 times, most recently from db9bec4 to 7caace3 Compare April 8, 2026 07:57
@EnricoDeg
EnricoDeg marked this pull request as ready for review April 8, 2026 07:58
@EnricoDeg
EnricoDeg force-pushed the users/enricodeg/ck/preshuffle-async-gemm branch from bcff5d3 to 0805528 Compare April 17, 2026 13:52
@EnricoDeg
EnricoDeg force-pushed the users/enricodeg/ck/preshuffle-async-gemm branch from 0805528 to 009e36c Compare April 28, 2026 07:16
@EnricoDeg
EnricoDeg force-pushed the users/enricodeg/ck/preshuffle-async-gemm branch from 009e36c to 16aa424 Compare May 11, 2026 08:04
@EnricoDeg
EnricoDeg force-pushed the users/enricodeg/ck/preshuffle-async-gemm branch 6 times, most recently from 7837c73 to 4a41705 Compare May 26, 2026 08:17
@EnricoDeg
EnricoDeg force-pushed the users/enricodeg/ck/preshuffle-async-gemm branch from 4a41705 to f614dfb Compare May 27, 2026 10:06
EnricoDeg added 4 commits May 28, 2026 14:55
Default to false because no async pipeline is supported
It doesn't bring performance benefit, so it's better to unify the code
with existing implementation
@EnricoDeg
EnricoDeg force-pushed the users/enricodeg/ck/preshuffle-async-gemm branch from f614dfb to 904c9f3 Compare May 28, 2026 14:55
Comment thread projects/composablekernel/example/ck_tile/03_gemm/CMakeLists.txt

@CongMa13 CongMa13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fixed the s_waitcnt issue.

@afagaj
afagaj requested a review from aosewski June 2, 2026 14:45

@aosewski aosewski left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Read through the async path carefully, including the s_waitcnt question from the thread — for what it's worth I think your relaxed vmcnt(Bload_total_num) is correct: the loads share one FIFO vmcnt, so draining to the B-load count guarantees the async-A-to-LDS has retired while B and the next A stay in flight. vmcnt(0) would just kill the overlap. The same templated idiom is already merged in the mixed-prec flatmm v1 pipeline. A couple of small things inline to make that reasoning durable.

Comment thread projects/composablekernel/example/ck_tile/03_gemm/gemm_utils.hpp
Comment thread projects/composablekernel/example/ck_tile/03_gemm/CMakeLists.txt

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 adds an “Async” switch to CK Tile GEMM pipeline problems/traits and integrates an async global→LDS prefetch path into the existing weight-preshuffle V2 GEMM pipeline, avoiding separate duplicated async pipeline implementations.

Changes:

  • Extend TileGemmUniversalTraits / UniversalGemmPipelineProblem to carry an Async boolean and thread it through tests/examples.
  • Integrate async buffer_load→LDS for weight-preshuffle V2, including new LDS descriptors / DRAM windows optimized for VMEM→LDS and LDS reads.
  • Add a gfx95(0) async preshuffle test variant and supporting kernel type lists/CMake plumbing.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
projects/composablekernel/test/ck_tile/gemm_weight_preshuffle/test_gemm_pipeline_util.hpp Thread async + prefetch knobs into test problem/traits.
projects/composablekernel/test/ck_tile/gemm_weight_preshuffle/test_gemm_pipeline_kernel_types.hpp Add async kernel type tuples for the new test.
projects/composablekernel/test/ck_tile/gemm_weight_preshuffle/CMakeLists.txt Add gfx95-only async preshuffle test target.
projects/composablekernel/include/ck_tile/ops/gemm/pipeline/wp_pipeline_agmem_bgmem_creg_v2.hpp Integrate async global→LDS prefetch and ping/pong LDS plumbing into preshuffle V2 pipeline.
projects/composablekernel/include/ck_tile/ops/gemm/pipeline/wp_pipeline_agmem_bgmem_creg_base_policy.hpp Add async-specific LDS descriptor + DRAM window/tile distributions for A.
projects/composablekernel/include/ck_tile/ops/gemm/pipeline/tile_gemm_traits.hpp Add Async as a trait parameter/state.
projects/composablekernel/include/ck_tile/ops/gemm/pipeline/gemm_pipeline_problem.hpp Expose Problem::Async from traits.
projects/composablekernel/include/ck_tile/ops/gemm/block/block_wp_asmem_breg_creg.hpp Add waitcnt before LDS barrier for async path.
projects/composablekernel/include/ck_tile/ops/gemm_quant/pipeline/gemm_quant_pipeline_problem.hpp Explicitly disable async for blockscale quant pipeline problems.
projects/composablekernel/example/ck_tile/03_gemm/gemm_weight_preshuffle_tdm_data_cache_prefetch.cpp Add Async=false to keep example config compatible.
projects/composablekernel/example/ck_tile/03_gemm/gemm_weight_preshuffle_invoker.hpp Thread Async into traits for the preshuffle invoker.
projects/composablekernel/example/ck_tile/03_gemm/gemm_utils.hpp Add an async-capable preshuffle config type.
projects/composablekernel/example/ck_tile/03_gemm/CMakeLists.txt Adjust weight preshuffle example compile options.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@EnricoDeg
EnricoDeg merged commit 8e2d46d into develop Jun 5, 2026
34 checks passed
@EnricoDeg
EnricoDeg deleted the users/enricodeg/ck/preshuffle-async-gemm branch June 5, 2026 07:15
assistant-librarian Bot pushed a commit to ROCm/composable_kernel that referenced this pull request Jun 5, 2026
[CK Tile] Async support preshuffle GEMM

## Motivation

Add async support to existing preshuffle GEMM pipeline

## Technical Details

Notes:
the implementation avoids previous strategy of duplicating pipelines for
async support and instead add a switch `Async` to the ops Problem to
enable async pipeline. Then, integrate the async pipeline in the
existing one. This allows to avoid code duplication and facilitate the
integration of buffer load to lds in existing pipelines. In my opinion,
it should be used also for other pipelines which don't support buffer
load to lds yet and it would also be a good idea to refactor the
existing async GEMM pipelines with the same approach.

Summary:

 - integrate buffer load to lds in existing pipeline
- add optimal tensor descriptors for vmem loading and lds reading. They
are currently optimized for 16x16 wave tiles but they also work for
32x32 wave tiles. Optimizations for 32x32 wave tile requires different
lds layout and it will be done in a follow-up issue
 - Add async config to examples
 - Add test (gfx950 only)

## Test Plan

New test for gfx950 `test_ck_tile_gemm_pipeline_wp_async`

## Submission Checklist

- [x] Look over the contributing guidelines at
https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
shumway pushed a commit to ROCm/composable_kernel that referenced this pull request Aug 18, 2026
[CK Tile] Async support preshuffle GEMM

## Motivation

Add async support to existing preshuffle GEMM pipeline

## Technical Details

Notes:
the implementation avoids previous strategy of duplicating pipelines for
async support and instead add a switch `Async` to the ops Problem to
enable async pipeline. Then, integrate the async pipeline in the
existing one. This allows to avoid code duplication and facilitate the
integration of buffer load to lds in existing pipelines. In my opinion,
it should be used also for other pipelines which don't support buffer
load to lds yet and it would also be a good idea to refactor the
existing async GEMM pipelines with the same approach.

Summary:

 - integrate buffer load to lds in existing pipeline
- add optimal tensor descriptors for vmem loading and lds reading. They
are currently optimized for 16x16 wave tiles but they also work for
32x32 wave tiles. Optimizations for 32x32 wave tile requires different
lds layout and it will be done in a follow-up issue
 - Add async config to examples
 - Add test (gfx950 only)

## Test Plan

New test for gfx950 `test_ck_tile_gemm_pipeline_wp_async`

## Submission Checklist

- [x] Look over the contributing guidelines at
https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants