Skip to content

[OPUS] mma step_k, dword copy by set_slice and inline asm for tr_load - #2652

Merged
carlushuang merged 8 commits into
mainfrom
kaiyang-1/opus_step-k_dword_slice
Apr 11, 2026
Merged

carlushuang merged 8 commits into
mainfrom
kaiyang-1/opus_step-k_dword_slice

Conversation

@kaiyang-1

@kaiyang-1 kaiyang-1 commented Apr 8, 2026 •

Copy link
Copy Markdown
Contributor

Enhancements to tiled MMA operations:

  • Added multiple overloads of the step_k method to tiled_mma_adaptor, enabling stepwise computation over the K dimension for both arrays and vectors, with and without scaling factors. These overloads support more flexible and efficient tiled MMA operations, allowing partial computation and improved composability.

Performance optimization for memory copy:

  • Updated set_slice_impl to optimize memory copying for sub-dword scalar types (such as bf16, fp16, fp8) when source and destination slices are dword-aligned and contiguous. This copies at dword granularity to avoid v_bfi_b32 generated by compiler from per-element insert.

Shared memory transpose load refactor:

  • Refactored smem::_tr_load to use inline assembly and support immediate offsets and generalized the implementation for different scalar types, improving code clarity and enabling more efficient loads with compile-time known offsets.

@kaiyang-1
kaiyang-1 requested review from a team and Copilot April 8, 2026 07:44
@github-actions

github-actions Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:triton-355 Run Triton tests on MI355 in addition to MI325
ci:sglang SGLang integration tests
ci:atom ATOM benchmark (DeepSeek-R1 + GPT-OSS)
ci:vllm vLLM benchmark
ci:all All of the above

Add labels via the sidebar or gh pr edit 2652 --add-label <label>

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 extends OPUS’s tiled MMA adaptor API with per-K-step accumulation entry points and optimizes set_slice_impl for sub-dword element types by performing aligned copies at dword granularity to reduce compiler-generated per-lane insert logic.

Changes:

  • Added tiled_mma_adaptor::step_k overloads to compute a single K-slice update for array- and vector-backed tiles (scaled and unscaled).
  • Updated impl::set_slice_impl to perform dword-granularity copies for sub-dword scalar types when slices are dword-aligned.

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

Comment thread csrc/include/opus/opus.hpp Resolved
@kaiyang-1
kaiyang-1 marked this pull request as draft April 9, 2026 10:42
@kaiyang-1
kaiyang-1 marked this pull request as ready for review April 10, 2026 16:40
@kaiyang-1 kaiyang-1 changed the title [OPUS] tiled mma with step_k and dword copy by set_slice_impl [OPUS] mma step_k, dword copy by set_slice and inline asm for tr_load Apr 11, 2026

@carlushuang carlushuang 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

@carlushuang
carlushuang merged commit 179ef2f into main Apr 11, 2026
34 checks passed
@carlushuang
carlushuang deleted the kaiyang-1/opus_step-k_dword_slice branch April 11, 2026 02:32
Liang-jianhao97 pushed a commit that referenced this pull request Apr 30, 2026
…#2652)

* tiled mma with step_k and improve set_slice

* check unit stride for set_slice dword copy

* compact set_slice_impl and tr_load by inline asm

* fix tr_load for runtime layout

* unit test for tiled_mma_adaptor::step_k

* resolve ci code style check
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.

3 participants