Archived
MTP coupling on qwen35_fp8's 2-bit draft head; libxe2 rows for the coupling ops
- arch: under --draft-coupling the MtpBlockFP8 draft head keeps the 2-bit logits' top 8, rescores them against the trunk's head (logit_rerank) and runs one mtp_couple_propose a round, as the Flash-Next head does; qwen35_fp8 declares the draw/state planes and a pitch-8 proposal. Off, nothing changes. - libxe2: device rows for mtp_couple_propose / mtp_couple_verify, a work-item a row over spechub's own row helpers and argument readers (built into xe2_couple.cpp). - spechub: mtp_couple_propose takes an optional q_temp (Q = softmax(score / q_temp)); exact at any value. RADIANCE_MTP_Q_TEMP sets it on qwen35_fp8 (default 1: 1.0 > 0.7 > 0.5 here). w4a16-rtn-mtp4, depth 7 adaptive, temperature 0.7: decode proxy 76.9 -> 78.8 tok/s, BetterBench decode 80.5 -> 81.7; greedy 8/8 identical with coupling on. Host tests (spechub|couple|abi|mtp) 7/7. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bfb1ebd1dd
commit
175f0bbd33
8 files changed
+160
-15
No files matched your search
@@ -0,0 +1,37 @@
|
||||
/* xe2_couple.cpp -- the linear-MTP coupling ops (`--draft-coupling on`) on the card.
|
||||
*
|
||||
* `mtp_couple_propose` and `mtp_couple_verify` (docs/OPS.md) through the spechub plugin's own row
|
||||
* helpers (plugin/spechub/spechub.h over abi/rad_spechub.h) and argument readers, one work-item a
|
||||
* row: the rows are a step's sampled positions (at most the draft window), and the sampler's
|
||||
* candidate plane holds ~top_k live entries, so the serial walks are short. The arithmetic is the
|
||||
* host reference's, in its order, in FP64 (libxe2 builds with -ffp-contract=off).
|
||||
*/
|
||||
#include "xe2_common.h"
|
||||
#include "xe2_ops.h"
|
||||
#include "../plugin/spechub/spechub.cpp"
|
||||
|
||||
namespace xe2 {
|
||||
|
||||
int mtp_couple_propose(const RadArgs* a, RadStream st) {
|
||||
RadMtpCoupleProposeCall c{};
|
||||
if (int rc = rad_mtp_couple_propose_args(a, &c); rc != RAD_OK) return rc;
|
||||
if (c.M <= 0) return RAD_OK;
|
||||
sycl::queue* q = queue_of(st);
|
||||
if (!q) return RAD_E_DEVICE;
|
||||
return submit([&] {
|
||||
q->parallel_for(sycl::range<1>{(size_t)c.M}, [=](sycl::id<1> i) { rad_mtp_couple_propose_row(c, (int64_t)i[0]); });
|
||||
});
|
||||
}
|
||||
|
||||
int mtp_couple_verify(const RadArgs* a, RadStream st) {
|
||||
RadMtpCoupleVerifyCall c{};
|
||||
if (int rc = rad_mtp_couple_verify_args(a, &c); rc != RAD_OK) return rc;
|
||||
if (c.M <= 0) return RAD_OK;
|
||||
sycl::queue* q = queue_of(st);
|
||||
if (!q) return RAD_E_DEVICE;
|
||||
return submit([&] {
|
||||
q->parallel_for(sycl::range<1>{(size_t)c.M}, [=](sycl::id<1> i) { rad_mtp_couple_verify_row(c, (int64_t)i[0]); });
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace xe2
|
||||
@@ -2,6 +2,10 @@
|
||||
#pragma once
|
||||
#include "rad_abi.h"
|
||||
|
||||
/* spechub's operand shapes for the coupling ops (plugin/spechub/spechub.cpp, built into xe2_couple.cpp) */
|
||||
int rad_mtp_couple_propose_shape(const RadParam*, int, int, RadOpdDesc*);
|
||||
int rad_mtp_couple_verify_shape(const RadParam*, int, int, RadOpdDesc*);
|
||||
|
||||
namespace xe2 {
|
||||
|
||||
int add(const RadArgs* a, RadStream s);
|
||||
@@ -13,6 +17,8 @@ int grid_embed(const RadArgs* a, RadStream s);
|
||||
|
||||
int rmsnorm(const RadArgs* a, RadStream s);
|
||||
int add_rmsnorm(const RadArgs* a, RadStream s);
|
||||
int mtp_couple_propose(const RadArgs* a, RadStream s);
|
||||
int mtp_couple_verify(const RadArgs* a, RadStream s);
|
||||
int rmsnorm_quant_fp8(const RadArgs* a, RadStream s);
|
||||
int quant_act_fp8(const RadArgs* a, RadStream s);
|
||||
int gated_quant_fp8(const RadArgs* a, RadStream s);
|
||||
|
||||
@@ -86,6 +86,19 @@ const RadKernelInfo kKernels[] = {
|
||||
.shape = "any n; bf16 rows wider than 512, 8-aligned, in one pass, else the pair",
|
||||
.dtypes = "float x, a, gain and y (bf16 in the recipes), f32 arithmetic",
|
||||
.domain = RAD_DOMAIN_DEVICE, .launch = xe2::add_rmsnorm },
|
||||
{ .name = "xe2_mtp_couple_propose", .op = "mtp_couple_propose", .family = "draft",
|
||||
.computes = "x~Q over the final top8, FP64 T1 softmax: spechub's row helper, a work-item a row",
|
||||
.shape = "M,n_vocab,round,max_rounds<=8",
|
||||
.dtypes = "f32,i32,u32",
|
||||
.domain = RAD_DOMAIN_DEVICE, .launch = xe2::mtp_couple_propose,
|
||||
.opd_shape = rad_mtp_couple_propose_shape },
|
||||
{ .name = "xe2_mtp_couple_verify", .op = "mtp_couple_verify", .family = "draft",
|
||||
.computes = "maximal coupling over the surviving target candidates, FP64 P: spechub's row "
|
||||
"helper, a work-item a row",
|
||||
.shape = "M,n_cand,n_vocab",
|
||||
.dtypes = "f32,i32,u32",
|
||||
.domain = RAD_DOMAIN_DEVICE, .launch = xe2::mtp_couple_verify,
|
||||
.opd_shape = rad_mtp_couple_verify_shape },
|
||||
{ .name = "xe2_rmsnorm_quant_fp8", .op = "rmsnorm_quant_fp8", .family = "norm",
|
||||
.computes = "residual add (optional), RMS norm, bf16 narrowing, E4M3 codes and an f32 scale "
|
||||
"per group; int8 codes at amax/127 for an int8 q",
|
||||
|
||||
Reference in new issue
Block a user