Skip to content

add inline in device code in tranaspose_operator - #7

Merged
valarLip merged 2 commits into
mainfrom
transpose_add
Dec 5, 2024
Merged

valarLip merged 2 commits into
mainfrom
transpose_add

Conversation

@fangche123

Copy link
Copy Markdown
Contributor

No description provided.

@valarLip
valarLip merged commit ee8934a into main Dec 5, 2024
@valarLip
valarLip deleted the transpose_add branch December 30, 2024 01:51
amd-youchen pushed a commit to amd-youchen/aiter that referenced this pull request Dec 3, 2025
valarLip pushed a commit that referenced this pull request Mar 18, 2026
* add inline in device code in tranaspose_operator

* update inline

---------
simondanielsson added a commit to simondanielsson/aiter that referenced this pull request Sep 9, 2026
valarLip pushed a commit that referenced this pull request Sep 11, 2026
…el for chunked prefill (#3606)

* fix(mla): always write partial output + LSE for prefill PS tiles

The PS scheduler in v1_2_host.cuh's generate_work_info tagged tiles
that a single threadgroup could absorb from block 0 with the sentinel
partial_o_loc = -1, causing generate_reduce_info to exclude them
from reduce_indptr / reduce_final_map / reduce_partial_map. As a
result mla_reduce_v1 never wrote final_lse[qo_start:qo_end, :] for
those tiles, leaving stale workspace bytes that downstream consumers
(vLLM's chunked-context MLA prefill on MI350) read as garbage LSE
and fed into merge_attn_states, causing a ~2-3pp gsm8k accuracy
regression on DeepSeek-V3.

Always assign a real partial_o_loc so every tile produces a partial
output + partial LSE that reduce processes (num_partials==1 for what
used to be the fast-path tiles). The kernel already supports this
path -- only the host scheduler needed changing; no assembly edits.

The if(work.partial_o_loc == -1) continue; guard in
generate_reduce_info is left in as defensive coding.

Mirrors PR #3542 ("[Triton-Gluon-MLA-GFX950] return_lse: full decode
+ merged fp32 lse"), which fixed the analogous bug in the
triton-gluon decode kernel's NUM_KV_SPLITS==1 fast path.

* fix: dont skip reduction of tiles with num_split==1

Signed-off-by: simondanielsson <[email protected]>

* fix: increase max_partial now that we support split tiles

Signed-off-by: simondanielsson <[email protected]>

* fix: compute the work and partial based on actual kv size

Signed-off-by: simondanielsson <[email protected]>

* fix: return final_lse instead of partial attn_lse from kernel wrapper

Signed-off-by: simondanielsson <[email protected]>

* test: add proper final lse validation test

Signed-off-by: simondanielsson <[email protected]>

* test: add non-causal chunk context to correctness test

Signed-off-by: simondanielsson <[email protected]>

* pass max_kvlen to correctness test

Signed-off-by: simondanielsson <[email protected]>

* fix: simplify comments

Signed-off-by: simondanielsson <[email protected]>

* fix: remove redundant comment

Signed-off-by: simondanielsson <[email protected]>

* fix: remove redundant handling of partial_o_loc=-1

Signed-off-by: simondanielsson <[email protected]>

* fix: simplify comment

Signed-off-by: simondanielsson <[email protected]>

* fix: indent

Signed-off-by: simondanielsson <[email protected]>

* fix: indentation

Signed-off-by: simondanielsson <[email protected]>

* fix: avoid running reduce when num_splits==0

Signed-off-by: simondanielsson <[email protected]>

* chore: add comment about fullgraphs

Signed-off-by: simondanielsson <[email protected]>

* fix: size without mxa kvlen

Signed-off-by: simondanielsson <[email protected]>

* chore: fix docstring

Signed-off-by: simondanielsson <[email protected]>

* fix: rename lse_ref in test

Signed-off-by: simondanielsson <[email protected]>

* fix: add need_lse flag

This avoid avoid unnecessary reduction when lse is not needed.

Signed-off-by: simondanielsson <[email protected]>

* chore: simplify comments

Signed-off-by: simondanielsson <[email protected]>

* fix: comment in get_ps_metadata_info_v1

Signed-off-by: simondanielsson <[email protected]>

* chore: restructure to minimzie diff

Signed-off-by: simondanielsson <[email protected]>

* fix: use qo_len in test when available instead of ctx_len

Signed-off-by: simondanielsson <[email protected]>

* chore: remove empty eol spaces

Signed-off-by: simondanielsson <[email protected]>

* fix: set max_partials to one per qo-tile + splits

Signed-off-by: simondanielsson <[email protected]>

* fix: set lower lse test tolerances

Signed-off-by: simondanielsson <[email protected]>

* fix: typo

Signed-off-by: simondanielsson <[email protected]>

* fix: set lse error atol to 3e-2 to be above the fp8 rounding onise

Signed-off-by: simondanielsson <[email protected]>

* chore: fix black erro

Signed-off-by: simondanielsson <[email protected]>

* fix: fill final_lse buffer with -inf (#3)

Signed-off-by: simondanielsson <[email protected]>

* fix: remove redundant asserts (#6)

Signed-off-by: simondanielsson <[email protected]>

* fix: include cassert in v1_2_host.cuh (#7)

Signed-off-by: simondanielsson <[email protected]>

* fix: add return_lse param and check that ensures final_lse is populated completely if return_lse (#3 & #4)

Signed-off-by: simondanielsson <[email protected]>

* fix: align flydsl reduce kernel with the cu variant

Signed-off-by: simondanielsson <[email protected]>

* chore: indent py bindings

Signed-off-by: simondanielsson <[email protected]>

* fix: convert asserts to AITER_CHECK

Signed-off-by: simondanielsson <[email protected]>

* fix: address comments about tests

Signed-off-by: simondanielsson <[email protected]>

* fix: add test cases to flydsl reduce to ensre parity

Signed-off-by: simondanielsson <[email protected]>

* fix: switch to int64 slot offsets

Signed-off-by: simondanielsson <[email protected]>

* fix: add test of aiter.mla.mla_prefill_ps_fwd python wrapper

Signed-off-by: simondanielsson <[email protected]>

---------

Signed-off-by: simondanielsson <[email protected]>
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