Skip to content

feat(flydsl): Add HSTU Forward kernel#4354

Open
damien-lejeune wants to merge 11 commits into
mainfrom
users/relbers/hstu_attention_fwd
Open

feat(flydsl): Add HSTU Forward kernel#4354
damien-lejeune wants to merge 11 commits into
mainfrom
users/relbers/hstu_attention_fwd

Conversation

@damien-lejeune

@damien-lejeune damien-lejeune commented Jul 23, 2026

Copy link
Copy Markdown

Motivation

The purpose of this work is to implement a FlyDSL HSTU forward kernel.

Jira ID : SILOTIGER-617

Technical Details

The HSTU block is defined here: https://arxiv.org/pdf/2402.17152v2
The full HSTU layer, implemented here (paper Eq. 1–3) is:

$$U, V, Q, K = \text{Split}\big(\phi_1(f_1(X))\big)$$

$$A(X),V(X) = \phi_2!\big(Q K^\top + \text{rab}^{p,t}\big),V$$

$$Y(X) = f_2\big(\text{Norm}(A(X)V(X)) \odot U(X)\big)$$

where $f_1, f_2$ are linear layers, $\phi_1,\phi_2$ are SiLU, $\odot$ is elementwise product, and $\text{rab}^{p,t}$ is a relative attention bias (positional + temporal).

Test Plan

  • Unit tests were written validating correctness on the input shapes of interest. The tests check the FlyDSL kernel against a PyTorch oracle across a handful of shapes and each feature (causal, targets, sliding window, contextual prefix, and various head/hidden dims). They also cover input validation (rejecting bad device/shape/rank/dtype/target-length) and tuned-CSV config loading.
  • Tested support and performance on gfx942. Performance was externally validated to match requirements.
  • Tested correctness on gfx950

Test Result

  • All unit tests are (and should be) passing

Submission Checklist

@github-actions

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 on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:triton-300x Run an additional Triton test job on MI300X in PRs; main branch always runs both MI35X and MI300X
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 4354 --add-label <label>

@damien-lejeune damien-lejeune changed the title Users/relbers/hstu attention fwd feat(flydsl): Add HSTU Forward kernel Jul 23, 2026
@damien-lejeune
damien-lejeune marked this pull request as ready for review July 23, 2026 13:06
@damien-lejeune
damien-lejeune requested a review from a team July 23, 2026 13:06
@zufayu
zufayu requested a review from coderfeli July 24, 2026 01:32
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