Skip to content

[CK_TILE] Use Unified Workspace for FMHA BWD - #182

Merged
DDEle merged 2 commits into
ck_improve_mainfrom
yiding12/fmha-bwd-workspace
May 14, 2026
Merged

[CK_TILE] Use Unified Workspace for FMHA BWD#182
DDEle merged 2 commits into
ck_improve_mainfrom
yiding12/fmha-bwd-workspace

Conversation

@DDEle

@DDEle DDEle commented Apr 23, 2026

Copy link
Copy Markdown
Collaborator

Bump composable_kernel submodule to mono-split/users/yiding12/fmha-bwd-workspace
HEAD and adapt the FMHA BWD host wrappers to the new unified workspace API:

  • Replace dq_acc tensor argument with workspace_ptr in get_ck_fmha_bwd_args
    / get_ck_fmha_varlen_bwd_args
  • Drop dq_acc strides that have been removed from fmha_bwd_args
  • In mha_bwd / mha_varlen_bwd, allocate the device workspace based on
    fmha_bwd_launcher::workspace_size and call launcher.prepare_workspace()
  • Invoke launcher.run(args, stream_config) instead of fmha_bwd(...)

DDEle added 2 commits April 23, 2026 01:13
Bump composable_kernel submodule to mono-split/users/yiding12/fmha-bwd-workspace
HEAD and adapt the FMHA BWD host wrappers to the new unified workspace API:

- Replace dq_acc tensor argument with workspace_ptr in get_ck_fmha_bwd_args
  / get_ck_fmha_varlen_bwd_args
- Drop dq_acc strides that have been removed from fmha_bwd_args
- In mha_bwd / mha_varlen_bwd, allocate the device workspace based on
  fmha_bwd_launcher::workspace_size and call launcher.prepare_workspace()
- Invoke launcher.run(args, stream_config) instead of fmha_bwd(...)
@DDEle
DDEle requested a review from rocking5566 May 7, 2026 02:36
@DDEle

DDEle commented May 7, 2026

Copy link
Copy Markdown
Collaborator Author

@rocking5566 rocking5566 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@DDEle
DDEle merged commit 5df1986 into ck_improve_main May 14, 2026
@DDEle
DDEle deleted the yiding12/fmha-bwd-workspace branch May 14, 2026 01:58
rocking5566 added a commit that referenced this pull request Jul 16, 2026
…ILab#2675)

* Add sink_ptr/d_sink_ptr to fmha_bwd_args to match updated CK submodule

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* update submodule

* [CK_TILE] Use Unified Workspace for FMHA BWD (#182)

* [CK_TILE] Use Unified Workspace for FMHA BWD

Bump composable_kernel submodule to mono-split/users/yiding12/fmha-bwd-workspace
HEAD and adapt the FMHA BWD host wrappers to the new unified workspace API:

- Replace dq_acc tensor argument with workspace_ptr in get_ck_fmha_bwd_args
  / get_ck_fmha_varlen_bwd_args
- Drop dq_acc strides that have been removed from fmha_bwd_args
- In mha_bwd / mha_varlen_bwd, allocate the device workspace based on
  fmha_bwd_launcher::workspace_size and call launcher.prepare_workspace()
- Invoke launcher.run(args, stream_config) instead of fmha_bwd(...)

* Update CK pin as ROCm/rocm-libraries#6152 merged

* [CK_TILE] FMHA BWD: stream-async workspace prepare (#183)

* [CK_TILE] FMHA BWD: stream-async workspace prepare

Bump composable_kernel submodule to mono-split/users/yiding12/fmha-bwd-
async-prepare HEAD and adapt the FMHA BWD host wrappers to the new
async workspace prepare API (CK PR #7331):

- Replace launcher.prepare_workspace() with prepare_workspace_async(),
  which enqueues the full workspace setup (dq_acc zero, group-mode D2H
  of seqstart, host-side metadata pack via hipLaunchHostFunc, H2D back
  to device) on the caller's stream. No host-blocking sync remains in
  the BWD launch path.
- Pass a pinned_host_alloc lambda backed by PyTorch's CachingHostAllocator
  (torch::empty(..., pin_memory=true)). The launcher keeps the returned
  shared_ptr alive via a stream-tail hipLaunchHostFunc keepalive so the
  pinned buffer is not recycled while async copies are still in flight.
- mha_varlen_bwd: drop the cu_seqlens_q.cpu() / cu_seqlens_k.cpu() host
  copies; the launcher now reads device seqstart directly via async D2H.
  get_ck_fmha_varlen_bwd_traits no longer takes seqstart_qs/ks.

* [CK_TILE] FMHA BWD: bump CK submodule to develop tip (#7331 merged)

ROCm/rocm-libraries#7331 (async workspace prepare for FMHA BWD launcher)
landed on develop. Move csrc/composable_kernel from the pre-merge fork
tip ce838e19e5 to ROCm/composable_kernel develop tip 83566edb0f, which
is the split commit for #7331 (rocm-libraries 5692db0).

* [CK_TILE] FMHA BWD: explicit at::kCPU on pinned host TensorOptions

* Update CK and enable RDNA backward

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Yi DING <yi.ding@amd.com>
Co-authored-by: Hosang Yoon <hosang.yoon@amd.com>
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.

2 participants