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_ops.h
T
pascallinxweilerandClaude Opus 5.5 94923fbb53 libxe2: the thirteen sampler ops
Each is libref's arithmetic on the card. The serial stages (penalties, DRY, the n-gram ban, top-p,
min-p, typical, XTC, the pick) run libref's loops unchanged, one work-item a row, so their sums keep
libref's order. Temperature and the grammar mask are one work-item an element. argmax, top-k and
logprobs scan the vocabulary with one work-group a row, reducing a 64-bit key -- the value's
order-preserving bits above the complemented index -- so the largest value wins and ties go to the
lower id, libref's rule; top-k is libref's topk_next k times, and a greedy row takes no rounds.
DRY's per-token map is replaced by a first-occurrence scan that computes the same maxima.

rad-kbench against libref: the whole fixture with libxe2 first, 1101/1101; MiniCPM5-2B's sampler
cases 56/56, all at rel_l2 0. With this, every op MiniCPM5-2B bf16 issues with speculation off has
a device row in libxe2 (13 model ops, 13 sampler ops).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
2026-10-23 16:21:22 +02:00

40 lines
1.4 KiB
C++

/* xe2_ops.h -- every libxe2 launch, by op. The rows that select them are in xe2_rows.cpp. */
#pragma once
#include "rad_abi.h"
namespace xe2 {
int add(const RadArgs* a, RadStream s);
int rmsnorm(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);
int rope(const RadArgs* a, RadStream s);
int embed_lookup(const RadArgs* a, RadStream s);
int gather_rows(const RadArgs* a, RadStream s);
int cast(const RadArgs* a, RadStream s);
int gemm_nt(const RadArgs* a, RadStream s);
int logits_gemm(const RadArgs* a, RadStream s);
int kv_store(const RadArgs* a, RadStream s);
int attn_paged(const RadArgs* a, RadStream s);
int sample_penalties(const RadArgs* a, RadStream s);
int sample_dry(const RadArgs* a, RadStream s);
int sample_ngram_ban(const RadArgs* a, RadStream s);
int sample_temp(const RadArgs* a, RadStream s);
int sample_mask(const RadArgs* a, RadStream s);
int sample_topk(const RadArgs* a, RadStream s);
int sample_topp(const RadArgs* a, RadStream s);
int sample_minp(const RadArgs* a, RadStream s);
int sample_typical(const RadArgs* a, RadStream s);
int sample_xtc(const RadArgs* a, RadStream s);
int sample_pick(const RadArgs* a, RadStream s);
int sample_argmax(const RadArgs* a, RadStream s);
int sample_logprobs(const RadArgs* a, RadStream s);
} // namespace xe2