Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
bb0010a
feat(rocke): attention band in the gfx942 tiled 2D/3D attention kernels
AnaghaRaoAMD Oct 6, 2026
fb12020
fix(rocke): zero empty rows and clamp Q loads in the gfx942 4-warp GQ…
AnaghaRaoAMD Oct 6, 2026
04e6a00
feat(rocke): attention band in the gfx942 dense attention kernel
AnaghaRaoAMD Oct 6, 2026
9347ca6
feat(rocke): serve the attention band on gfx942 through dispatch
AnaghaRaoAMD Oct 6, 2026
b5db0c8
test(rocke): run the gfx942 dense band at batch=2 and pin its visible…
AnaghaRaoAMD Oct 20, 2026
2910256
fix(rocke): clamp the gfx942 4-warp block-table index; pin gfx942 ban…
AnaghaRaoAMD Oct 20, 2026
38e3879
test(rocke): gfx942 unified band truth table, mixed-cohort dispatch, …
AnaghaRaoAMD Oct 20, 2026
144200e
fix(rocke): bound the ragged dense byte extent; reject right_bound in…
AnaghaRaoAMD Oct 20, 2026
e857e05
test(rocke): select the unified band GPU suites in CTest; map their c…
AnaghaRaoAMD Oct 20, 2026
c810772
test(rocke): update the split-KV LSE refusal tests for the gfx942 band
AnaghaRaoAMD Oct 28, 2026
5132ce2
test(rocke): run the gfx942 band numerics without torch
AnaghaRaoAMD Oct 28, 2026
044ede6
Merge branch 'develop' into users/anarao/gfx942-attention-band
AnaghaRaoAMD Oct 31, 2026
fd74969
Merge branch 'develop' into users/anarao/gfx942-attention-band
AnaghaRaoAMD Nov 2, 2026
d68b613
test(rocke): describe the gfx950 start-tile bug instead of citing a P…
AnaghaRaoAMD Nov 2, 2026
c5295f4
test(rocke): pin the tiled attention bindings' band-field rejections
AnaghaRaoAMD Nov 2, 2026
6a011a1
docs(rocke): record the attention band as a Python-only known gap
AnaghaRaoAMD Nov 2, 2026
83fd190
fix(rocke): skip only dispatcher refusals in the gfx942 mask-set pari…
AnaghaRaoAMD Nov 2, 2026
f376147
test(rocke): refuse gfx942 tiled tuning pins stored before the band
AnaghaRaoAMD Nov 2, 2026
2476682
test(rocke): add a Torch-free ragged cross-length full-attention dens…
AnaghaRaoAMD Nov 2, 2026
ba01620
fix(rocke): treat only data_ptr objects without a device as raw buffers
AnaghaRaoAMD Nov 2, 2026
f64cb73
Merge branch 'develop' into users/anarao/gfx942-attention-band
AnaghaRaoAMD Nov 3, 2026
108bddc
Merge branch 'develop' into users/anarao/gfx942-attention-band
AnaghaRaoAMD Nov 3, 2026
9a09c82
test(rocke): pin gfx942 dense ragged IR in the golden
AnaghaRaoAMD Nov 3, 2026
bc02342
fix(rocke): bump the binary ABI for the attention band spec fields
AnaghaRaoAMD Nov 3, 2026
0809358
fix(rocke): keep bottom-right decode windows on the strided decode ke…
AnaghaRaoAMD Nov 3, 2026
479b297
test(rocke): run the attention band CPU checks in a CI lane
AnaghaRaoAMD Nov 3, 2026
3e3f1f7
docs(rocke): name gfx942 by device identifier, not product name
AnaghaRaoAMD Nov 3, 2026
164194b
refactor(rocke): share the attention band code across gfx942 and gfx950
AnaghaRaoAMD Nov 3, 2026
6a3e4d2
refactor(rocke): one home each for band spec fields, band arches and …
AnaghaRaoAMD Nov 3, 2026
cd74726
test(rocke): cover ragged bottom-right causal on gfx942 dense
AnaghaRaoAMD Nov 3, 2026
d04d88a
test(rocke): reuse shared helpers in the torch-free gfx942 band suite
AnaghaRaoAMD Nov 3, 2026
902c9b6
test(rocke): pin the bottom-right decode window routing
AnaghaRaoAMD Nov 3, 2026
b16fffa
test(rocke): unit-test the shared attention band helpers
AnaghaRaoAMD Nov 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ test_categories:
- "rocke_buffer_rsrc_hip"
- "rocke_tiled_attention_2d_reentrancy"
- "rocke_unified_attention_scalar_lower_to_llvm"
- "rocke_attention_tiled_band_rejects"
- "rocke_python_import_smoke"
- "rocke_golden_static"
- "rocke_differential_golden_ll"
Expand Down Expand Up @@ -109,6 +110,7 @@ test_categories:
- "rocke_buffer_rsrc_hip"
- "rocke_tiled_attention_2d_reentrancy"
- "rocke_unified_attention_scalar_lower_to_llvm"
- "rocke_attention_tiled_band_rejects"
- "rocke_python_import_smoke"
- "rocke_golden_static"
- "rocke_differential_golden_ll"
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def run_sweep(
fp8_fnuz=bool(problem.fp8_fnuz),
# The paged unified kernels (and this harness' reference) are bottom-right
# causal; AttentionRequest defaults to NO_MASK, which now means full
# attention on gfx950 and rejects a sliding window.
# attention on gfx950 and gfx942 and rejects a sliding window.
mask_type=AttentionMaskType.BOTTOM_RIGHT_CAUSAL,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,11 @@ def _run_dsl(shape: DecodeShape, data: dict, num_cus: int, *, warmup: int, iters
import torch

try:
from dispatch.attention import AttentionRequest, dispatch_attention
from dispatch.attention import (
AttentionMaskType,
AttentionRequest,
dispatch_attention,
)
from kernels import UnifiedAttentionProblem, run_unified_attention_torch, prepare_unified_attention_torch # type: ignore
from kernels.common.attention_unified import _resolve_attention_arch
except ImportError:
Expand All @@ -295,6 +299,10 @@ def _run_dsl(shape: DecodeShape, data: dict, num_cus: int, *, warmup: int, iters
num_cus=num_cus,
use_sinks=shape.use_sinks,
sliding_window=shape.sliding_window,
# The paged unified kernels (and this harness' reference) are bottom-right
# causal; AttentionRequest defaults to NO_MASK, which now means full
# attention on gfx950 and gfx942 and rejects a sliding window.
mask_type=AttentionMaskType.BOTTOM_RIGHT_CAUSAL,
)
result = dispatch_attention(req)
path = result.spec.path # "2d" or "3d"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,11 @@ def _run_prod(shape, data, sw, is_fp8, bench, *, warmup, iters, backend="auto"):
code path as the production provider.
"""
import torch
from dispatch.attention import AttentionRequest, dispatch_attention
from dispatch.attention import (
AttentionMaskType,
AttentionRequest,
dispatch_attention,
)
from kernels import run_unified_attention_torch
from rocke.runtime import synchronize_and_release, time_launches

Expand All @@ -1230,6 +1234,10 @@ def _run_prod(shape, data, sw, is_fp8, bench, *, warmup, iters, backend="auto"):
sliding_window=sw,
kv_block_size=shape.block_size,
num_cus=bench.num_cus,
# The paged unified kernels (and this harness' reference) are bottom-right
# causal; AttentionRequest defaults to NO_MASK, which now means full
# attention on gfx950 and gfx942 and rejects a sliding window.
mask_type=AttentionMaskType.BOTTOM_RIGHT_CAUSAL,
)

# Force path when caller requests a specific one (e.g. backend="3d").
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

from kernels.common.attention_unified import (
UnifiedAttentionProblem,
band_spec_fields,
_has_score_bias,
_enable_combo_2d,
_enable_early_v_schedule,
Expand Down Expand Up @@ -121,6 +122,7 @@ def _spec_gfx942_fp16_flash(problem: UnifiedAttentionProblem, arch: str):
use_q_direct_global=_enable_gfx942_flash_q_direct(problem, arch),
kv_cache_policy=_gfx942_flash_kv_cache_policy(problem),
use_i64_kv_addr=_enable_i64_kv_addr(problem),
**band_spec_fields(problem, arch),
)


Expand Down Expand Up @@ -186,6 +188,7 @@ def _spec_gfx942_bf16_flash(problem: UnifiedAttentionProblem, arch: str):
use_q_direct_global=_enable_gfx942_flash_q_direct(problem, arch),
kv_cache_policy=_gfx942_flash_kv_cache_policy(problem),
use_i64_kv_addr=_enable_i64_kv_addr(problem),
**band_spec_fields(problem, arch),
)


Expand Down Expand Up @@ -272,7 +275,9 @@ def _spec_generic_2d_non_gfx950(problem: UnifiedAttentionProblem, arch: str):
unchanged.
"""
UnifiedAttention2DTiledSpec, _, _ = _tiled_2d_impl(arch)
return UnifiedAttention2DTiledSpec(**_base_2d_generic_fields(problem, arch))
return UnifiedAttention2DTiledSpec(
**_base_2d_generic_fields(problem, arch), **band_spec_fields(problem, arch)
)


def _spec_gfx950_generic(problem: UnifiedAttentionProblem, arch: str):
Expand Down Expand Up @@ -418,10 +423,7 @@ def _spec_generic_3d(problem: UnifiedAttentionProblem, arch: str):
if arch in ("gfx942", "gfx950")
else {}
),
# Only the gfx950 spec class declares these; the 3D tiled gate rejects any
# non-default mask on every other arch before a spec is built.
**({"causal_top_left": True} if problem.causal_top_left else {}),
**({"right_bound": problem.right_bound} if problem.right_bound != 0 else {}),
**band_spec_fields(problem, arch),
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ prefill shapes are not included.
graphs decode (`max_seqlen_q == 1`) and short prefill (`<= 768`) — where host
launch overhead is a large fraction — and ungraphs long prefill (kernel-bound).
Toggle with `HIPDNN_GFX942_2D_GRAPH` / `HIPDNN_GFX942_3D_GRAPH` (both default-on).
- **The attention band matches gfx950.** The tiled 2D/3D kernels compute the
cuDNN / hipDNN band: top-left alignment (`causal_top_left`, name token `tl`),
full attention (`NO_MASK`, `rbu`), lookahead (`rb<R>`) and non-causal windows.
With top-left, `context_len` is 0, so the ALiBi / QQ-bias offsets follow it;
`right_bound != 0` is rejected together with ALiBi / QQ-bias. The 4-warp GQA
cohorts (D256 causal, D128 sliding-window) keep top-left but decline a right
bound other than 0, so those problems build the generic tiled 2D spec. The
default mask keeps every kernel name, cache key and IR unchanged. See
[`../../../dispatch/attention/README.md`](../../../dispatch/attention/README.md)
("Attention band"). gfx1250 remains the causal-only gap.
- **The 3D decode kernel is transposed too.** The split-KV segment kernel
(`attention_tiled_3d`) computes $S^\top = K Q^\top$ on the narrow `16x16x16` atom
with $P^\top$ register-resident, as the flash path above does with `32x32x8`. It
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,16 @@ def add_dense_tuning_args(ap: argparse.ArgumentParser) -> None:
action="store_true",
help="enable attention sinks (one [Hq] logit per query head)",
)
# The band, also a request property.
ap.add_argument(
"--right-bound",
dest="right_bound",
type=int,
default=None,
help="attention-band right bound (-1 = unbounded, 0 = causal, R > 0 = R keys "
"of lookahead); when set the request is NO_MASK + this band (the cuDNN "
"vocabulary) and overrides the causal flag; default = the causal flag",
)


def dense_request(
Expand All @@ -229,6 +239,11 @@ def dense_request(
full causal) and ``use_sinks`` (``--use-sinks``, read from ``args``) are
request properties, so dispatch ships the SWA-pruned, sink-seeded spec.
"""
mask_type = 1 if causal else 0
right_bound = getattr(args, "right_bound", None)
if right_bound is not None:
# The band comes from (sliding_window, right_bound) under NO_MASK.
mask_type = 0
return AttentionRequest(
batch=int(batch),
nhead_q=int(num_query_heads),
Expand All @@ -238,13 +253,14 @@ def dense_request(
hdim_q=int(head_size),
hdim_v=int(head_size),
arch=_ARCH,
mask_type=1 if causal else 0,
mask_type=mask_type,
dtype=str(dtype).lower(),
sliding_window=int(sliding_window),
use_sinks=bool(getattr(args, "use_sinks", False)),
# Opt-in selector: this is the candidate whose spec we are measuring.
algorithm="attention_dense",
spec_id=_SPEC_ID,
**({} if right_bound is None else {"right_bound": int(right_bound)}),
)


Expand Down
Loading
Loading