Skip to content

Add THD support for RoPE#1284

Open
niyunsheng wants to merge 2 commits into
linkedin:mainfrom
niyunsheng:rope_thd
Open

Add THD support for RoPE#1284
niyunsheng wants to merge 2 commits into
linkedin:mainfrom
niyunsheng:rope_thd

Conversation

@niyunsheng

Copy link
Copy Markdown
Contributor

Summary

Add THD packed-input support for RoPE. This introduces a THD RoPE autograd wrapper and public functional/transformers APIs for query/key tensors shaped (total_tokens, num_heads, head_dim) with cos/sin shaped (total_tokens, head_dim).

Details

The THD path reuses the existing Triton RoPE kernel with a packed-token layout wrapper, keeping the existing batch-major RoPE API unchanged. Documentation and RoPE unit tests were updated to cover the new public THD API.

This is an initial RoPE-only step toward THD / packed-sequence training support requested in #1281. It does not close the issue, since broader packed-layout support across kernels remains future work.

Testing Done

  • Hardware Type: NVIDIA GB200
  • run make test to ensure correctness
  • run make checkstyle to ensure code style
  • run make test-convergence to ensure convergence
    Additional targeted testing:
  • python -m pytest test/transformers/test_rope.py

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.

1 participant