This repository has been archived on 2026-11-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
radiance-sycl/libxe2/xe2_couple.cpp
T
claudeandClaude Opus 5.5 175f0bbd33 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>
2026-11-02 05:45:50 +01:00

38 lines
1.5 KiB
C++

/* 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