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
claudeandClaude Opus 5.5 a65ab54213 libxe2: Phase 4 step 1 -- a bandwidth-bound decode GEMV and an ordered sum from local memory
The profile of a MiniCPM5-2B decode step on the B65 (232.8 ms) was 79% gemm_nt, reading its
weights at 62 GB/s, and 13% the norms' serial sum of squares.

- xe2_gemm_nt_gemv / xe2_logits_gemm_gemv (priority 10, M <= 16, bf16): a sub-group an output
  column, 16-byte coalesced weight loads, a tree reduction. Not libref's order: rad-kbench passes
  them at the gemm tolerance (fixture 361/361, MiniCPM5 180/180, worst rel_l2 1.6e-4), and
  XE2_EXACT=1 sends every launch to the exact kernel for bisecting.
- The norms form their squares in parallel into local memory and add them in index order: still
  bit-identical to libref.

Decode 4.2 -> 35.5 tok/s. Against a libref-only host build, over 1914 positions of the repo's docs
with every position through the GEMV: KL mean 5.9e-4, p99 3.5e-3, top-1 98.5% -- libavx's own
distance from libref is 5.7e-4 / 3.0e-3 / 98.6%. The exact path scores KL 0, top-1 100%.

docs/SYCL_PROGRESS.md: the profile, the KL bound (D13), and the user's decision to use the bf16
container for Milestone B instead of the fp8 one.

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

62 lines
2.5 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);
int gemm_nt_q(const RadArgs* a, RadStream s);
int gemm_nt_q_gated(const RadArgs* a, RadStream s);
int silu_mul(const RadArgs* a, RadStream s);
int quant_act_i8(const RadArgs* a, RadStream s);
int row_topk(const RadArgs* a, RadStream s);
int dflash_select(const RadArgs* a, RadStream s);
int gemm_nt_q_zp(const RadArgs* a, RadStream s);
/* Phase 4's fast kernels (xe2_gemv.cpp). XE2_EXACT=1 sends them to the correctness-first ones. */
bool exact_only();
int gemm_nt_gemv(const RadArgs* a, RadStream s);
int logits_gemm_gemv(const RadArgs* a, RadStream s);
int gemm_zp_layout(const RadParam* p, int n_p, int operand, const RadEncoding* enc, const int* sel,
const RadTensor* planes, int n, RadLayout* out);
int gemm_zp_relayout(const RadParam* p, int n_p, int operand, const RadEncoding* enc,
const int* sel, const RadTensor* planes, int n, void* dst, int64_t dst_bytes);
int gemm_zp_unrelayout(const RadParam* p, int n_p, int operand, const RadEncoding* enc,
const int* sel, const void* src, int64_t src_bytes, const RadTensor* planes,
int n);
} // namespace xe2