Archived
TP4 for Qwen3.8-Flash-Next: unfused chain, four refusals answered
World 4 refused at declare on two counts and at boot on a third the audit
found; the fourth is unchanged by design.
- rad_arch.h: a world above the KV head count replicates the heads in rank
pairs instead of dividing them. Geom gains kv_off; each rank declares
n_head_kv 1 and gqa 6. A world that is not a multiple of the head count
is still refused, by name.
- rad_block_attn_gated_fp8.h: k/v pass the row span LinearFP8 already
takes, gated on world > n_head_kv_all so an even shard is untouched and
TP2 declares byte-identically.
- qwen4exp_fp8.cpp: above two ranks the ranks own whole experts (5 blocks
of 128 do not cut four ways); the parity tables stay two-rank and the
router stays replicated.
- libr4d: attn_{prefill,decode}_h256_gqa6_bs4 rows and their TU -- the
gqa8 body at ratio 6, page 4. No fused form is instantiated at this
geometry; the unfused pair is what resolves.
- libr4d: r4d_ar_gather_Nrank.hip. The vocab-parallel sampler declares an
all_gather at any world > 1 and libr4d shipped only the 2-rank row, so a
TP4 boot was refused by the reference-kernel gate rather than served
wrong. The wide one-shot all-reduce with the reduction removed.
- rad_block_attn_gated.h / rad_block_attn_fp8.h: refuse a world above the
KV head count. They read n_head_kv and declare no span, so they would
have booted and read half a KV head -- fluent wrong text.
- tests/arch_test.cpp: the four-rank declare test, and the fake records
the shard span the real builder stores.
- README, ARCHITECTURES: TP4 in the present tense, with the costs named
and the rate against TP2 left unmeasured.
This commit is contained in:
1 parent
966bda899a
commit
7cf4c005e1
14 files changed
+926
-31
No files matched your search
@@ -2206,6 +2206,35 @@ static const RadConstraint cAttnDecodeGqH256G12Bf16[] = {
|
||||
C_GE("causal", 0), C_LE("q_len", 5), C_IN("q_dtype", "bf16"), C_IN("kv_dtype", "bf16"),
|
||||
C_EQ("group", 128), C_IN("act", "sigmoid"),
|
||||
};
|
||||
/* SIX QUERIES PER KV HEAD, head_dim 256, paged block 4 (r4d_attn_paged_h256_gqa6_bs4.hip) -- the
|
||||
* SAME QSA layers as the gqa12 leg above, at four ranks. The model has two KV heads; a world of
|
||||
* four replicates each across a rank pair, so a rank declares 6 queries over the 1 kv head it
|
||||
* holds and `gqa` is 6 where the TP2 leg reads 12. What the ratio changes is the two bounds, as
|
||||
* ever: `q_len <= 10` is the same `q_len * gqa <= 64` at 6 queries a position rather than 12, so
|
||||
* this leg's bucket boundary sits where the plain h256/gqa6 leg's does, and a draft block of six or
|
||||
* seven positions -- which gqa12 hands to the prefill kernel -- is a decode launch here. The page
|
||||
* stays 4 because it is the model's indexer's block size, not a consequence of the parallelism.
|
||||
*
|
||||
* NO `attn_paged_gate_quant` ROW AT THIS GEOMETRY. The body instantiates the `_gq` entry points at
|
||||
* every ratio, but v1 of this port registers none of them as a row, so the sparse path's gate and
|
||||
* quantiser resolve to the standalone pair declared beside the probe. That is the design, not an
|
||||
* omission. */
|
||||
static const RadConstraint cAttnPrefillH256G6Bs4Fp8[] = {
|
||||
C_EQ("window", 0), C_EQ("head_dim", 256), C_EQ("gqa", 6), C_EQ("block_size", 4),
|
||||
C_EQ("causal", 1), C_IN("q_dtype", "bf16"), C_IN("kv_dtype", "fp8_e4m3"),
|
||||
};
|
||||
static const RadConstraint cAttnPrefillH256G6Bs4Bf16[] = {
|
||||
C_EQ("window", 0), C_EQ("head_dim", 256), C_EQ("gqa", 6), C_EQ("block_size", 4),
|
||||
C_EQ("causal", 1), C_IN("q_dtype", "bf16"), C_IN("kv_dtype", "bf16"),
|
||||
};
|
||||
static const RadConstraint cAttnDecodeH256G6Bs4Fp8[] = {
|
||||
C_EQ("window", 0), C_EQ("head_dim", 256), C_EQ("gqa", 6), C_EQ("block_size", 4),
|
||||
C_GE("causal", 0), C_LE("q_len", 10), C_IN("q_dtype", "bf16"), C_IN("kv_dtype", "fp8_e4m3"),
|
||||
};
|
||||
static const RadConstraint cAttnDecodeH256G6Bs4Bf16[] = {
|
||||
C_EQ("window", 0), C_EQ("head_dim", 256), C_EQ("gqa", 6), C_EQ("block_size", 4),
|
||||
C_GE("causal", 0), C_LE("q_len", 10), C_IN("q_dtype", "bf16"), C_IN("kv_dtype", "bf16"),
|
||||
};
|
||||
static const RadConstraint cAttnPrefillH128G8Fp8[] = {
|
||||
C_EQ("window", 0), C_EQ("head_dim", 128), C_EQ("gqa", 8), C_EQ("block_size", 16),
|
||||
C_EQ("causal", 1), C_IN("q_dtype", "bf16"), C_IN("kv_dtype", "fp8_e4m3"),
|
||||
@@ -2304,6 +2333,14 @@ static const RadConstraint cArGather2[] = {
|
||||
C_EQ("world_size", 2), C_IN("dtype", "bf16 fp16 f16 fp32 f32"),
|
||||
C_P2P,
|
||||
};
|
||||
/* The same gather at a width whose handshake is the wide family's tree and not one peer flag. The
|
||||
* dtype set is cArGather2's verbatim for the same reason -- the two callers' synonyms. */
|
||||
static const RadConstraint cArGather4[] = {
|
||||
C_EQ("world_size", 4), C_IN("dtype", "bf16 fp16 f16 fp32 f32"),
|
||||
};
|
||||
static const RadConstraint cArGather8[] = {
|
||||
C_EQ("world_size", 8), C_IN("dtype", "bf16 fp16 f16 fp32 f32"),
|
||||
};
|
||||
|
||||
static const RadConstraint cArExact[] = {
|
||||
C_EQ("world_size", 2), C_EQ("exact", 1), C_IN("dtype", "bf16 fp16 fp32"),
|
||||
@@ -3530,6 +3567,48 @@ static const RadKernelInfo kKernels[] = {
|
||||
r4d_shape_attn_paged_gate_quant, nullptr, r4d_fuse_attn_paged_gate_quant,
|
||||
r4d_rad_attn_decode_gq_h256_gqa12_bf16_describe },
|
||||
|
||||
/* The TP4 leg of Flash-Next's sparse attention: the same kernels the gqa12 rows above resolve, at
|
||||
* the ratio a four-rank world hands a rank (see cAttnPrefillH256G6Bs4Fp8). The two are not
|
||||
* alternatives -- `gqa` is a per-rank parameter, so world 2 resolves gqa 12 and these four rows
|
||||
* never win there, and world 4 resolves gqa 6 and the gqa12 rows never win. */
|
||||
{ "attn_prefill_h256_gqa6_bs4_fp8kv", "attn_paged", "attn",
|
||||
"paged causal attention, query-tiled (prefill / chunked prefill)",
|
||||
"head_dim 256, 6 queries per kv head, paged block 4, varlen",
|
||||
"bf16 query, fp8-e4m3 kv cache with per-(seq,head) descales, bf16 out",
|
||||
RAD_DOMAIN_DEVICE, R4D_PRIO_ATTN_PREFILL,
|
||||
ROW(cAttnPrefillH256G6Bs4Fp8), NOTUNE,
|
||||
nullptr, nullptr, r4d_rad_attn_prefill_h256_gqa6_fp8, nullptr, nullptr, nullptr,
|
||||
r4d_shape_attn_paged },
|
||||
|
||||
{ "attn_prefill_h256_gqa6_bs4_bf16kv", "attn_paged", "attn",
|
||||
"paged causal attention, query-tiled (prefill / chunked prefill)",
|
||||
"head_dim 256, 6 queries per kv head, paged block 4, varlen",
|
||||
"bf16 query, bf16 kv cache, bf16 out",
|
||||
RAD_DOMAIN_DEVICE, R4D_PRIO_ATTN_PREFILL,
|
||||
ROW(cAttnPrefillH256G6Bs4Bf16), NOTUNE,
|
||||
nullptr, nullptr, r4d_rad_attn_prefill_h256_gqa6_bf16, nullptr, nullptr, nullptr,
|
||||
r4d_shape_attn_paged },
|
||||
|
||||
{ "attn_decode_h256_gqa6_bs4_fp8kv", "attn_paged", "attn",
|
||||
"paged attention, causal or not, split-KV (decode / speculative verify / draft block)",
|
||||
"head_dim 256, 6 queries per kv head, paged block 4, q_len*gqa <= 64, no window",
|
||||
"bf16 query, fp8-e4m3 kv cache with per-(seq,head) descales, bf16 out, f16 partials",
|
||||
RAD_DOMAIN_DEVICE, R4D_PRIO_ATTN_DECODE,
|
||||
ROW(cAttnDecodeH256G6Bs4Fp8), ROW(tAttnSplit), nullptr,
|
||||
nullptr, nullptr, r4d_rad_attn_decode_h256_gqa6_fp8, r4d_rad_attn_decode_h256_gqa6_scratch,
|
||||
nullptr, nullptr,
|
||||
r4d_shape_attn_paged, nullptr, nullptr, r4d_rad_attn_decode_h256_gqa6_fp8_describe },
|
||||
|
||||
{ "attn_decode_h256_gqa6_bs4_bf16kv", "attn_paged", "attn",
|
||||
"paged attention, causal or not, split-KV (decode / speculative verify / draft block)",
|
||||
"head_dim 256, 6 queries per kv head, paged block 4, q_len*gqa <= 64, no window",
|
||||
"bf16 query, bf16 kv cache, bf16 out, f16 partials",
|
||||
RAD_DOMAIN_DEVICE, R4D_PRIO_ATTN_DECODE,
|
||||
ROW(cAttnDecodeH256G6Bs4Bf16), ROW(tAttnSplit), nullptr,
|
||||
nullptr, nullptr, r4d_rad_attn_decode_h256_gqa6_bf16, r4d_rad_attn_decode_h256_gqa6_scratch,
|
||||
nullptr, nullptr,
|
||||
r4d_shape_attn_paged, nullptr, nullptr, r4d_rad_attn_decode_h256_gqa6_bf16_describe },
|
||||
|
||||
{ "attn_prefill_h128_gqa8_fp8kv", "attn_paged", "attn",
|
||||
"paged causal attention, query-tiled (prefill / chunked prefill)",
|
||||
"head_dim 128, 8 queries per kv head, paged block 16, varlen",
|
||||
@@ -3750,6 +3829,30 @@ static const RadKernelInfo kKernels[] = {
|
||||
r4d_rad_ar_init, r4d_rad_ar_fini, r4d_rad_ar_gather_2rank, nullptr, nullptr, nullptr,
|
||||
r4d_shape_all_gather },
|
||||
|
||||
{ "ar_gather_4rank", "all_gather", "ar",
|
||||
"all-gather, one-shot push over P2P IPC scratch, per-block handshake",
|
||||
"exactly 4 ranks, all peer-accessible; y is [4 * numel] with rank r's input at r * numel; one "
|
||||
"scratch slot per (parity, source rank); shares the wide family's flag/seq/scratch set; "
|
||||
"cudagraph-safe",
|
||||
"any payload -- the bytes are moved, never summed, so the (u32 id, f32 logit) pairs the "
|
||||
"vocab-parallel sampler gathers survive intact",
|
||||
RAD_DOMAIN_DEVICE, R4D_PRIO_AR_ONESHOT,
|
||||
ROW(cArGather4), ROW(tAr), nullptr,
|
||||
r4d_rad_ar_init, r4d_rad_ar_fini, r4d_rad_ar_gather_4rank, nullptr, nullptr, nullptr,
|
||||
r4d_shape_all_gather },
|
||||
|
||||
{ "ar_gather_8rank", "all_gather", "ar",
|
||||
"all-gather, one-shot push over P2P IPC scratch, per-block handshake",
|
||||
"exactly 8 ranks, all peer-accessible; y is [8 * numel] with rank r's input at r * numel; one "
|
||||
"scratch slot per (parity, source rank); shares the wide family's flag/seq/scratch set; "
|
||||
"cudagraph-safe",
|
||||
"any payload -- the bytes are moved, never summed, so the (u32 id, f32 logit) pairs the "
|
||||
"vocab-parallel sampler gathers survive intact",
|
||||
RAD_DOMAIN_DEVICE, R4D_PRIO_AR_ONESHOT,
|
||||
ROW(cArGather8), ROW(tAr), nullptr,
|
||||
r4d_rad_ar_init, r4d_rad_ar_fini, r4d_rad_ar_gather_8rank, nullptr, nullptr, nullptr,
|
||||
r4d_shape_all_gather },
|
||||
|
||||
{ "ar_oneshot_2rank_exact", "all_reduce", "ar",
|
||||
"all-reduce (sum), one-shot push over P2P IPC scratch",
|
||||
"exactly 2 ranks, peer-accessible; scratch sized by the full message; cudagraph-safe",
|
||||
|
||||
Reference in new issue
Block a user