Archived
libxe2, arch/common: the 28 Oct pending set, the bf16 cast fused, the vectorized norm, a draft-vocab prefix
- gdn_kkt_solve on DPAS (~0.4 ms at 2048 tokens against 7.7), the int8 head's DPAS forms at 9-16 rows (verify past depth 7), the plain block norm (RadBuildCtx::plain_norm, set on the SYCL backend: `add` + `rmsnorm` where no reader takes the E4M3 codes) with the fast rmsnorm rows. - rmsnorm's bf16 rows up to 8192 wide: a work-item eight elements by one 16-byte load (the generic form walked 20 dependent loads a work-item): 24.7 -> 3.3 us a decode norm, ~3.5 ms a round. - w4a16: a bf16 activation narrowed to fp16 at the kernel's own load (the separate cast launch before every GEMM is gone), bit for bit the same. - RADIANCE_MTP_DRAFT_VOCAB=N: the 2-bit draft head over the vocabulary's first N ids (a prefix shortlist, GRIMOIRE's idea); the u2 layout hook takes an op N below the weight's rows. 131072: greedy acceptance identical on the decode proxy, draft head 650 -> 351 us a pass. KL against the exact-kernel reference (2002 positions): 0.002386, top-1 97.30% (was 0.002376 / 96.80%). Decode proxy (greedy, depth 5, mtp4): 72.0 -> 74.3 tok/s with the prefix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7580ec3d17
commit
726e532114
18 files changed
+472
-54
No files matched your search
+15
-6
@@ -370,10 +370,11 @@ int logits_gemm_head_gemv(const RadArgs* a, RadStream st) {
|
||||
const int64_t yrs = row_stride(Y, N), ycs = Y->rank >= 2 ? Y->stride[Y->rank - 1] : 1;
|
||||
sycl::queue* q = queue_of(st);
|
||||
if (!q) return RAD_E_DEVICE;
|
||||
/* the XMX form reads 8 activation rows, the ones past M zero */
|
||||
/* the XMX form reads 8 activation rows, the ones past M zero; 9-16 rows (a verify step past
|
||||
* depth 7) run it once a block of 8 -- the SIMT kernel took ~100 ms a call there */
|
||||
static const bool simt = std::getenv("XE2_HEAD_SIMT") != nullptr;
|
||||
const bool dpas = M <= 8 && K % 64 == 0 && !simt;
|
||||
const int64_t mrows = dpas ? 8 : M;
|
||||
const bool dpas = M <= 16 && K % 64 == 0 && !simt;
|
||||
const int64_t mrows = dpas ? (M <= 8 ? 8 : 16) : M;
|
||||
const int64_t abytes = (mrows * K * 2 + 255) / 256 * 256;
|
||||
float* ws = workspace(*q, (size_t)(abytes / 4 + mrows + 64));
|
||||
if (!ws) return RAD_E_DEVICE;
|
||||
@@ -410,9 +411,17 @@ int logits_gemm_head_gemv(const RadArgs* a, RadStream st) {
|
||||
if (dpas) {
|
||||
/* head_dpas serves the E4M3 head and every form but the int8 one, which it leaves to the
|
||||
* ESIMD kernel (each reads the planes on the card; a form not its own returns at once) */
|
||||
if (int r = head_dpas(*q, a16, rr, bb, yb, Y->dtype, N, K, yrs, ycs, mm); r != RAD_OK) return r;
|
||||
return head_i8_esimd(*q, mm == 1 ? 1 : (mm <= 2 ? 2 : (mm <= 4 ? 4 : 8)), a16, rr, bb, yb, Y->dtype, N, K, yrs,
|
||||
ycs, mm);
|
||||
for (int b0 = 0; b0 < mm; b0 += 8) {
|
||||
const int mb = mm - b0 < 8 ? mm - b0 : 8;
|
||||
const sycl::half* ab0 = a16 + (int64_t)b0 * K;
|
||||
char* yb0 = yb + rad_dtype_bytes(Y->dtype, (int64_t)b0 * yrs);
|
||||
if (int r = head_dpas(*q, ab0, rr + b0, bb, yb0, Y->dtype, N, K, yrs, ycs, mb); r != RAD_OK) return r;
|
||||
if (int r = head_i8_esimd(*q, mb == 1 ? 1 : (mb <= 2 ? 2 : (mb <= 4 ? 4 : 8)), ab0, rr + b0, bb, yb0,
|
||||
Y->dtype, N, K, yrs, ycs, mb);
|
||||
r != RAD_OK)
|
||||
return r;
|
||||
}
|
||||
return RAD_OK;
|
||||
}
|
||||
if (mm == 1) return head_gemv<1>(*q, a16, rr, bb, yb, Y->dtype, N, K, yrs, ycs, mm);
|
||||
if (mm <= 8) return head_gemv<8>(*q, a16, rr, bb, yb, Y->dtype, N, K, yrs, ycs, mm);
|
||||
|
||||
Reference in new issue
Block a user