Archived
radiance 1.7.0
- every model serves without a GPU: libavx covers every op, so `--kernels libavx` alone serves every shipped container - Qwen3-ASR (zivius): speech to text on /v1/audio/transcriptions and live over /v1/realtime - /v1/messages works with Claude Code as it ships (gearwave00001) - a long agent conversation keeps its cached history when the client rewrites its last turn (manueloverride) - a stream's first event goes out with the first token, so llama-benchy measures prefill right - opt-in --prefill-interleave (Smellyyyy, baKon) and --prefill-span (keptn42) - four-rank TP releases the link early; four-rank selftests and docs/TP4.md (goodman-b) - NVFP4 and FP8 compressed-tensors imports (devmilan); tools/rad-export for finetunes and LoRA adapters (baKon) - many fixes, among them lost tokens on stop strings under concurrency, keep-alive, MiniCPM5 tool arguments and the CPU's vision and audio encoders - plugin ABI 17 and changed op schemas: out-of-tree plugins must be rebuilt
This commit is contained in:
1 parent
b068190326
commit
1e968f6e1d
739 files changed
+128447
-84632
No files matched your search
+295
-168
@@ -1,43 +1,45 @@
|
||||
/* ref_common.h -- libref's numeric bedrock: dtype conversion, strided element access, and
|
||||
* the parameter readers every op shares.
|
||||
/* ref_common.h -- libref's numeric core: dtype conversion, strided element access, and the
|
||||
* parameter readers every op shares.
|
||||
*
|
||||
* ============================ THE NUMERICS ARE THE REFERENCE DEFINITION ============================
|
||||
* The numerics are the reference definition. rad-kbench compares each resolved kernel against
|
||||
* this plugin to a tolerance, so these rules are part of the contract:
|
||||
*
|
||||
* rad-kbench compares a resolved kernel against this plugin to a tolerance, so what this plugin
|
||||
* computes is not "one correct answer" -- it is THE answer, and every rule below is part of the
|
||||
* contract rather than an implementation detail:
|
||||
* * Every accumulation is f32. Not double: device kernels accumulate in f32, and an oracle more
|
||||
* accurate than what it certifies makes a tolerance ambiguous. Not the operand dtype either: a
|
||||
* bf16 accumulator would be worse than every kernel it judges. The exceptions sum in double
|
||||
* and are part of their op's definition (docs/OPS.md):
|
||||
* - seg_mean's segment sums, which OPS.md states;
|
||||
* - gram_accum's Gram matrix, a calibration statistic read once at convert time;
|
||||
* - logit_rerank's dot products, an exact rescoring of a coarse head's candidates;
|
||||
* - sample_logprobs' normaliser, the sum of exp over the whole vocabulary;
|
||||
* - givens_dense_quant's dense rotation and ple_gate's key-query dot;
|
||||
* - the sums of squares of hc_read's, mtp_enter's, ple_gate's and qsa_block_key's norms. An
|
||||
* f32 sum of n squares differs by at most about n * 2^-24 relative, which at these widths
|
||||
* (n <= 10240) stays below one bf16 rounding of the normed value.
|
||||
* * IEEE round-to-nearest-even everywhere, including the f32 -> bf16 / f16 / fp8 rounders. The
|
||||
* target has no bf16 convert instruction, so software RTNE is the right reference.
|
||||
* * No fused multiply-add and no reassociation: `a*b + c` rounds twice. A contracting reference
|
||||
* disagrees with itself across compilers. libref/CMakeLists.txt passes -ffp-contract=off.
|
||||
* * Summation order is fixed and independent of thread count. OpenMP parallelism is only over
|
||||
* whole output elements (a row, a column block, a head), with no `reduction()` clause anywhere,
|
||||
* so runs at different thread counts are bit-identical.
|
||||
*
|
||||
* * EVERY accumulation is f32. Not double, because a device kernel accumulates in f32 and an
|
||||
* oracle that is more accurate than the thing it certifies turns a tolerance into a guess
|
||||
* about which of the two is drifting. Not the operand dtype either: a bf16 accumulator would
|
||||
* make the reference worse than every kernel it judges.
|
||||
* * IEEE round-to-nearest-even everywhere, including the hand-written f32 -> bf16 / f16 / fp8
|
||||
* rounders below. There is no bf16 convert instruction anywhere on this project's target, so
|
||||
* a software RTNE is the right reference and not a workaround.
|
||||
* * NO FUSED MULTIPLY-ADD AND NO REASSOCIATION. `a*b + c` must round twice. A reference that
|
||||
* contracts is a reference that disagrees with itself between two compilers, and one that
|
||||
* reassociates cannot be trusted to a tolerance at all. The pragma below asks the compiler for
|
||||
* this and libref/CMakeLists.txt passes -ffp-contract=off, because the pragma is advisory
|
||||
* in C++ and the flag is not.
|
||||
* * SUMMATION ORDER IS FIXED AND INDEPENDENT OF THREAD COUNT. OpenMP parallelism in this plugin
|
||||
* is only ever over whole output elements -- one thread owns a row, a column block, a head --
|
||||
* and there is not one `reduction()` clause in the plugin. Two runs at different thread counts
|
||||
* are bit-identical, which is what makes a diff against a device kernel mean something.
|
||||
* This plugin is deliberately simple: scalar loops with a per-element dtype switch outside the few
|
||||
* hot paths (the GEMM tiles, ref_gemm.h, and the delta-net scans, ref_gdn.cpp, which run
|
||||
* independent output chains side by side without changing any chain). Its jobs are to run an
|
||||
* unsupported model at reduced speed instead of not at all, and to be what every fast kernel is
|
||||
* checked against (spec §17).
|
||||
*
|
||||
* The cost of all of this is stated plainly: this plugin is slow. It is a nest of scalar loops
|
||||
* with a per-element dtype switch outside the few paths that matter, and it is meant to be. Its
|
||||
* jobs are to make an unsupported model run at reduced speed instead of not at all, and to be the
|
||||
* thing every fast kernel is checked against (spec §17).
|
||||
* An operand of a dtype these conversions cannot read or store is refused at launch
|
||||
* (ref_registry.cpp), never read as zeros.
|
||||
*/
|
||||
#ifndef RAD_REF_COMMON_H
|
||||
#define RAD_REF_COMMON_H
|
||||
|
||||
/* THE CONTRACTION RULE IS A BUILD FLAG, NOT A PRAGMA. `#pragma STDC FP_CONTRACT` is C, and g++
|
||||
* ignores it with a warning on every translation unit that includes this header; clang's
|
||||
* equivalent is spelled differently and is scoped. libref/CMakeLists.txt therefore passes
|
||||
* -ffp-contract=off on the target, which every compiler this project builds with honours, and the
|
||||
* top-level build already sets it for device code (docs/OPS.md). If you compile these sources by
|
||||
* hand, pass it. */
|
||||
/* The no-contraction rule is a build flag, not a pragma: `#pragma STDC FP_CONTRACT` is C and g++
|
||||
* ignores it with a warning, and clang's equivalent is spelled differently and scoped. The target
|
||||
* gets -ffp-contract=off from libref/CMakeLists.txt (the top-level build sets it for device code,
|
||||
* docs/OPS.md). Pass it when compiling these sources by hand. */
|
||||
|
||||
#include "rad_abi.h"
|
||||
#include "rad_plugin.h"
|
||||
@@ -52,13 +54,9 @@ namespace ref {
|
||||
|
||||
/* ================================================================== narrowing conversions
|
||||
*
|
||||
* ONE DEFINITION, IN rad_plugin.h, and these are the names ref's kernels call it by.
|
||||
*
|
||||
* These conversions ARE the reference definition, which is why they belong in the header every
|
||||
* plugin gets rather than in this file. This plugin's contract is f32 accumulation, IEEE
|
||||
* round-to-nearest-ties-to-even, no FMA and no reassociation, and a plugin whose bf16 narrowing
|
||||
* truncates instead of rounding to even cannot reproduce it and therefore cannot be checked
|
||||
* against it. A convention every implementer has to rediscover is a convention that drifts. */
|
||||
* Local names for rad_plugin.h's conversions. They are part of the reference definition, so they
|
||||
* live in the header every plugin gets: a plugin whose bf16 narrowing truncates instead of rounding
|
||||
* to even cannot be checked against this one. */
|
||||
static inline float bf16_to_f32(uint16_t h) { return rad_bf16_to_f32(h); }
|
||||
static inline uint16_t f32_to_bf16(float f) { return rad_f32_to_bf16(f); }
|
||||
static inline float f16_to_f32(uint16_t h) { return rad_f16_to_f32(h); }
|
||||
@@ -68,8 +66,17 @@ static inline uint8_t f32_to_fp8e4m3(float f) { return rad_f32_to_fp8e4m3(f);
|
||||
static inline float fp8e5m2_to_f32(uint8_t b) { return rad_fp8e5m2_to_f32(b); }
|
||||
static inline uint8_t f32_to_fp8e5m2(float f) { return rad_f32_to_fp8e5m2(f); }
|
||||
|
||||
/* OCP MXFP4 element (e2m1): sign in bit 3, exponent in 2:1, mantissa in bit 0. Eight magnitudes,
|
||||
* and no infinity or NaN -- the format has no room for either. */
|
||||
/* E4M3 decoded through a table of all 256 codes, filled by fp8e4m3_to_f32 itself: the same
|
||||
* floats without the decode's branches, which otherwise dominate an fp8 GEMM or KV-cache read. */
|
||||
struct Fp8Table {
|
||||
float v[256];
|
||||
Fp8Table() { for (int b = 0; b < 256; ++b) v[b] = fp8e4m3_to_f32((uint8_t)b); }
|
||||
};
|
||||
inline const Fp8Table kFp8Table;
|
||||
static inline float fp8e4m3_lut(uint8_t b) { return kFp8Table.v[b]; }
|
||||
|
||||
/* OCP MXFP4 element (e2m1): sign in bit 3, exponent in 2:1, mantissa in bit 0. Eight magnitudes;
|
||||
* no infinity or NaN. */
|
||||
static inline float mxfp4_elem_to_f32(uint8_t nib) {
|
||||
static const float kMag[8] = { 0.0f, 0.5f, 1.0f, 1.5f, 2.0f, 3.0f, 4.0f, 6.0f };
|
||||
float v = kMag[nib & 0x7u];
|
||||
@@ -83,19 +90,21 @@ static inline float e8m0_to_f32(uint8_t e) {
|
||||
}
|
||||
|
||||
/* ================================================================== packed weight codes
|
||||
* The packing conventions are libr4d's, because a .rad file is specific to a kernel set (spec
|
||||
* §4.2) and ref has to read the same bytes the fast kernel does:
|
||||
* The canonical planes a container stores (abi/rad_encoding.h): sub-byte codes are a bit stream
|
||||
* along the row, lowest bits first, and integer codes are two's complement (abi/rad_types.h).
|
||||
* libref rearranges no plane (its relayouts only join whole planes, ref_planes.h), so it reads
|
||||
* these bytes as stored; the op oracle compares a device kernel that relayouts a weight at load
|
||||
* after RadUnrelayoutFn restores this form.
|
||||
*
|
||||
* RAD_I4 two nibbles per byte, element 2i in the LOW nibble; symmetric two's-complement code,
|
||||
* value = (n ^ 8) - 8, so 0..15 maps to -8..7. This is what radiance_w4.pack writes and
|
||||
* what r4d_dequant_w4_bf16's `twos=1` path reads.
|
||||
* RAD_I2 four codes per byte, element 4i in the LOW two bits; value = (c ^ 2) - 2, the same
|
||||
* construction one radix down, so 0..3 maps to -2..1.
|
||||
* RAD_FP4E2M1 two e2m1 nibbles per byte, element 2i low, with one e8m0 scale per 32 elements
|
||||
* carried in a separate stream (the `b_scale` operand).
|
||||
* RAD_I4 two nibbles per byte, element 2i in the low nibble; two's-complement code,
|
||||
* value = (n ^ 8) - 8, so 0..15 maps to -8..7.
|
||||
* RAD_I2 four codes per byte, element 4i in the low two bits; value = (c ^ 2) - 2, so 0..3 maps
|
||||
* to -2..1.
|
||||
* RAD_FP4E2M1 two e2m1 nibbles per byte, element 2i low, with one e8m0 scale per 32 elements in a
|
||||
* separate stream (the `b_scale` operand).
|
||||
*
|
||||
* All three return the RAW CODE's value. The group scale is applied by the caller, because only
|
||||
* the caller knows where the scale stream is. */
|
||||
* All three return the raw code's value; the caller applies the group scale, since only it knows
|
||||
* where the scale stream is. */
|
||||
static inline float w4_code(const void* p, int64_t i) {
|
||||
uint8_t b = ((const uint8_t*)p)[i >> 1];
|
||||
uint8_t n = (i & 1) ? (uint8_t)(b >> 4) : (uint8_t)(b & 0xf);
|
||||
@@ -112,29 +121,66 @@ static inline float mxfp4_code(const void* p, int64_t i) {
|
||||
}
|
||||
|
||||
/* ================================================================== element access
|
||||
* One switch per element, which is the price of being generic. The GEMM family lifts it out with
|
||||
* the templated loaders below; nothing else runs often enough to care. */
|
||||
* One switch per element, the price of being generic. The GEMM family hoists it with the templated
|
||||
* loaders below; nothing else runs often enough to matter. */
|
||||
static inline float ld_dt(uint32_t dt, const void* p, int64_t i) {
|
||||
switch (dt) {
|
||||
case RAD_F32: return ((const float*)p)[i];
|
||||
case RAD_F16: return f16_to_f32(((const uint16_t*)p)[i]);
|
||||
case RAD_BF16: return bf16_to_f32(((const uint16_t*)p)[i]);
|
||||
case RAD_F8E4M3: return fp8e4m3_to_f32(((const uint8_t*)p)[i]);
|
||||
case RAD_F8E4M3: return fp8e4m3_lut(((const uint8_t*)p)[i]);
|
||||
case RAD_F8E5M2: return fp8e5m2_to_f32(((const uint8_t*)p)[i]);
|
||||
case RAD_I8: return (float)((const int8_t*)p)[i];
|
||||
case RAD_U8: return (float)((const uint8_t*)p)[i];
|
||||
case RAD_BOOL: return ((const uint8_t*)p)[i] ? 1.0f : 0.0f;
|
||||
case RAD_I16: return (float)((const int16_t*)p)[i];
|
||||
case RAD_U16: return (float)((const uint16_t*)p)[i];
|
||||
case RAD_I32: return (float)((const int32_t*)p)[i];
|
||||
case RAD_U32: return (float)((const uint32_t*)p)[i];
|
||||
case RAD_I64: return (float)((const int64_t*)p)[i];
|
||||
case RAD_I4: return w4_code(p, i);
|
||||
case RAD_I2: return w2_code(p, i);
|
||||
case RAD_FP4E2M1: return mxfp4_code(p, i);
|
||||
case RAD_E8M0: return e8m0_to_f32(((const uint8_t*)p)[i]);
|
||||
/* Unreachable through a launch: the registry refuses an operand of any other dtype
|
||||
* (ref_registry.cpp, ref_check_dtypes). */
|
||||
default: return 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
/* A packed code's bits `c` (already masked to `bits`) into element `i` of a bit stream, lowest
|
||||
* bits first. The two atomics touch only this element's bits, so rows written by different threads
|
||||
* may share a byte. */
|
||||
static inline void st_packed(void* p, int64_t i, int bits, unsigned c) {
|
||||
const int per = 8 / bits;
|
||||
uint8_t* b = (uint8_t*)p + i / per;
|
||||
const int sh = (int)(i % per) * bits;
|
||||
const uint8_t mask = (uint8_t)(((1u << bits) - 1u) << sh);
|
||||
__atomic_fetch_and(b, (uint8_t)~mask, __ATOMIC_RELAXED);
|
||||
__atomic_fetch_or(b, (uint8_t)((c << sh) & mask), __ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
/* The e2m1 code nearest `v` (ties to the even code), saturating at 6; NaN is +0. */
|
||||
static inline unsigned e2m1_code(float v) {
|
||||
static const float kMag[8] = { 0.0f, 0.5f, 1.0f, 1.5f, 2.0f, 3.0f, 4.0f, 6.0f };
|
||||
if (v != v) return 0u;
|
||||
const unsigned sign = std::signbit(v) ? 8u : 0u;
|
||||
const float a = std::fabs(v);
|
||||
unsigned best = 0;
|
||||
for (unsigned c = 1; c < 8; ++c) {
|
||||
const float d = std::fabs(kMag[c] - a), db = std::fabs(kMag[best] - a);
|
||||
if (d < db || (d == db && (c & 1u) == 0u)) best = c;
|
||||
}
|
||||
return sign | best;
|
||||
}
|
||||
|
||||
/* `v` rounded to nearest even and clamped to [lo, hi]; NaN is 0. */
|
||||
static inline float sat_round(float v, float lo, float hi) {
|
||||
if (v != v) return 0.0f;
|
||||
const float r = std::nearbyintf(v);
|
||||
return r < lo ? lo : (r > hi ? hi : r);
|
||||
}
|
||||
|
||||
static inline void st_dt(uint32_t dt, void* p, int64_t i, float v) {
|
||||
switch (dt) {
|
||||
case RAD_F32: ((float*)p)[i] = v; break;
|
||||
@@ -142,25 +188,42 @@ static inline void st_dt(uint32_t dt, void* p, int64_t i, float v) {
|
||||
case RAD_BF16: ((uint16_t*)p)[i] = f32_to_bf16(v); break;
|
||||
case RAD_F8E4M3: ((uint8_t*)p)[i] = f32_to_fp8e4m3(v); break;
|
||||
case RAD_F8E5M2: ((uint8_t*)p)[i] = f32_to_fp8e5m2(v); break;
|
||||
/* Integer stores round-to-nearest and saturate. A reference that wrapped would turn one
|
||||
* overflowing activation into a plausible small number, which is the failure this plugin
|
||||
* exists to catch rather than to commit. */
|
||||
case RAD_I8: { float r = std::nearbyintf(v); r = r < -128.f ? -128.f : (r > 127.f ? 127.f : r);
|
||||
((int8_t*)p)[i] = (int8_t)r; break; }
|
||||
case RAD_U8: { float r = std::nearbyintf(v); r = r < 0.f ? 0.f : (r > 255.f ? 255.f : r);
|
||||
((uint8_t*)p)[i] = (uint8_t)r; break; }
|
||||
/* Integer stores round to nearest even, saturate to the type's range and store NaN as 0.
|
||||
* Wrapping would turn an overflowing activation into a plausible small number, the kind
|
||||
* of failure this plugin must catch. */
|
||||
case RAD_I8: ((int8_t*)p)[i] = (int8_t)sat_round(v, -128.0f, 127.0f); break;
|
||||
case RAD_U8: ((uint8_t*)p)[i] = (uint8_t)sat_round(v, 0.0f, 255.0f); break;
|
||||
case RAD_BOOL: ((uint8_t*)p)[i] = v != 0.0f ? 1u : 0u; break;
|
||||
case RAD_I16: { float r = std::nearbyintf(v); r = r < -32768.f ? -32768.f : (r > 32767.f ? 32767.f : r);
|
||||
((int16_t*)p)[i] = (int16_t)r; break; }
|
||||
case RAD_I32: ((int32_t*)p)[i] = (int32_t)std::nearbyintf(v); break;
|
||||
case RAD_U32: ((uint32_t*)p)[i] = (uint32_t)std::nearbyintf(v); break;
|
||||
case RAD_I64: ((int64_t*)p)[i] = (int64_t)std::nearbyintf(v); break;
|
||||
default: break;
|
||||
case RAD_I16: ((int16_t*)p)[i] = (int16_t)sat_round(v, -32768.0f, 32767.0f); break;
|
||||
case RAD_U16: ((uint16_t*)p)[i] = (uint16_t)sat_round(v, 0.0f, 65535.0f); break;
|
||||
/* Bounds that are powers of two, exact in f32: at and past 2^31 (2^32, 2^63) the store
|
||||
* saturates to the largest value, which f32 cannot hold. */
|
||||
case RAD_I32: {
|
||||
const float r = sat_round(v, -0x1p31f, 0x1p31f);
|
||||
((int32_t*)p)[i] = r >= 0x1p31f ? INT32_MAX : (int32_t)r;
|
||||
break;
|
||||
}
|
||||
case RAD_U32: {
|
||||
const float r = sat_round(v, 0.0f, 0x1p32f);
|
||||
((uint32_t*)p)[i] = r >= 0x1p32f ? UINT32_MAX : (uint32_t)r;
|
||||
break;
|
||||
}
|
||||
case RAD_I64: {
|
||||
const float r = sat_round(v, -0x1p63f, 0x1p63f);
|
||||
((int64_t*)p)[i] = r >= 0x1p63f ? INT64_MAX : (int64_t)r;
|
||||
break;
|
||||
}
|
||||
/* Packed codes: the nearest code, saturated, so a code read by ld_dt stores back as
|
||||
* itself (a gather or scatter of packed rows moves them exactly). */
|
||||
case RAD_I4: st_packed(p, i, 4, (unsigned)(int)sat_round(v, -8.0f, 7.0f) & 0xFu); break;
|
||||
case RAD_I2: st_packed(p, i, 2, (unsigned)(int)sat_round(v, -2.0f, 1.0f) & 0x3u); break;
|
||||
case RAD_FP4E2M1: st_packed(p, i, 4, e2m1_code(v)); break;
|
||||
default: break; /* refused at launch, as in ld_dt */
|
||||
}
|
||||
}
|
||||
|
||||
/* Integer reads that must NOT go through f32: a token id, a slot index or a block id above 2^24
|
||||
* would come back rounded. Index tensors are read with this and never with ld_dt. */
|
||||
/* Integer reads that must not go through f32, where an id above 2^24 (token, slot, block) would
|
||||
* be rounded. Index tensors are read with this, never with ld_dt. */
|
||||
static inline int64_t ld_int(uint32_t dt, const void* p, int64_t i) {
|
||||
switch (dt) {
|
||||
case RAD_I32: return (int64_t)((const int32_t*)p)[i];
|
||||
@@ -188,13 +251,13 @@ static inline void st_int(uint32_t dt, void* p, int64_t i, int64_t v) {
|
||||
}
|
||||
|
||||
/* ================================================================== templated loaders
|
||||
* The GEMM family reads one element per FLOP, so the switch above would be most of its cost. These
|
||||
* let a caller hoist the decision to the top of the op and pay it once. */
|
||||
* The GEMM family reads one element per FLOP, so the switch above would dominate its cost. These
|
||||
* let a caller resolve the dtype once at the top of the op. */
|
||||
template <uint32_t DT> struct Cvt;
|
||||
template <> struct Cvt<RAD_F32> { static inline float ld(const void* p, int64_t i) { return ((const float*)p)[i]; } };
|
||||
template <> struct Cvt<RAD_F16> { static inline float ld(const void* p, int64_t i) { return f16_to_f32(((const uint16_t*)p)[i]); } };
|
||||
template <> struct Cvt<RAD_BF16> { static inline float ld(const void* p, int64_t i) { return bf16_to_f32(((const uint16_t*)p)[i]); } };
|
||||
template <> struct Cvt<RAD_F8E4M3> { static inline float ld(const void* p, int64_t i) { return fp8e4m3_to_f32(((const uint8_t*)p)[i]); } };
|
||||
template <> struct Cvt<RAD_F8E4M3> { static inline float ld(const void* p, int64_t i) { return fp8e4m3_lut(((const uint8_t*)p)[i]); } };
|
||||
template <> struct Cvt<RAD_I8> { static inline float ld(const void* p, int64_t i) { return (float)((const int8_t*)p)[i]; } };
|
||||
template <> struct Cvt<RAD_I32> { static inline float ld(const void* p, int64_t i) { return (float)((const int32_t*)p)[i]; } };
|
||||
template <> struct Cvt<RAD_I4> { static inline float ld(const void* p, int64_t i) { return w4_code(p, i); } };
|
||||
@@ -203,23 +266,19 @@ template <> struct Cvt<RAD_FP4E2M1> { static inline float ld(const void* p, int
|
||||
|
||||
/* ------------------------------------------------------------------ the ranged key
|
||||
*
|
||||
* A RANGED PARAMETER NAMES THE BAND AND THE OPERAND NAMES THE CALL, and every kernel below that
|
||||
* wants a row count asks the operand.
|
||||
* A ranged parameter names the band; the operand names the call. Every kernel that wants a row
|
||||
* count reads it from the operand.
|
||||
*
|
||||
* `M`, `numel` and `q_len` are declared RAD_RANGE by the architectures, and the core freezes the
|
||||
* band's UPPER BOUND into the geometry a kernel reads -- max_tok, max_seqs, the whole residual
|
||||
* stream. It is what the selector matched on and what a kernel sizes a persistent buffer from;
|
||||
* it is not this issue's extent. A decode step presents a few rows of a max_tok buffer, so a
|
||||
* reference that reads the parameter as the length either REFUSES the call outright or, where the
|
||||
* buffers are large enough to survive it, walks rows nobody wrote and reports a mismatch against
|
||||
* a kernel that is right.
|
||||
* `M`, `numel` and `q_len` are declared RAD_RANGE, and the core freezes the band's upper bound
|
||||
* (max_tok, max_seqs, the whole residual stream) into the geometry. That is what the selector
|
||||
* matched and what persistent buffers are sized from, not this issue's extent: a decode step
|
||||
* presents a few rows of a max_tok buffer. Reading the parameter as the length would refuse the
|
||||
* call or walk unwritten rows and report a false mismatch. The engine binds every operand with its
|
||||
* real shape at issue, and libr4d reads the operand too (its all-reduce uses `numel` only to size
|
||||
* peer scratch at init).
|
||||
*
|
||||
* libr4d reads the operand for the same reason -- the all-reduce shim takes r4d_numel(x) and uses
|
||||
* its `numel` parameter only to size the peer scratch at init -- and the engine binds every
|
||||
* operand with its real shape at issue, which is what makes the operand the honest source.
|
||||
*
|
||||
* The parameter is kept as a CEILING where one is stated: a call above the band was resolved
|
||||
* against constraints it does not satisfy, and that is a caller bug worth refusing. */
|
||||
* The parameter stays a ceiling where one is stated: a call above the band was resolved against
|
||||
* constraints it does not satisfy, a caller bug worth refusing. */
|
||||
static inline int64_t band_rows(int64_t from_operand, int64_t band) {
|
||||
if (from_operand <= 0) return 0;
|
||||
return (band > 0 && from_operand > band) ? 0 : from_operand;
|
||||
@@ -233,12 +292,9 @@ static inline int64_t numel(const RadTensor* t) {
|
||||
return n;
|
||||
}
|
||||
|
||||
static inline bool contig(const RadTensor* t) { return rad_tensor_is_contiguous(t) != 0; }
|
||||
|
||||
/* Element offset of the `lin`-th element in row-major logical order. Contiguous is the norm and
|
||||
* costs nothing; a strided view -- a slice of a wider projection, which the GDN block hands its
|
||||
* conv in every real model -- costs a decomposition, and is supported rather than refused because
|
||||
* "no geometry constraints" has to mean strides too. */
|
||||
/* Element offset of the `lin`-th element in row-major logical order. Contiguous costs nothing; a
|
||||
* strided view (a slice of a wider projection, as the GDN block passes its conv) costs a
|
||||
* decomposition. Strides are supported because the reference has no geometry constraints. */
|
||||
static inline int64_t offlin(const RadTensor* t, int64_t lin) {
|
||||
if (t->rank == 0) return lin;
|
||||
int64_t acc = 1;
|
||||
@@ -258,12 +314,12 @@ static inline int64_t offlin(const RadTensor* t, int64_t lin) {
|
||||
return off;
|
||||
}
|
||||
|
||||
/* The element offset of logical row `r` when a tensor is read as [rows, cols]: rows is everything
|
||||
* but the last dimension and cols is the last. This is the shape almost every op here wants. */
|
||||
/* Element offset of logical row `r` when a tensor is read as [rows, cols], cols being the last
|
||||
* dimension and rows everything before it. Most ops here use this view. */
|
||||
static inline int64_t rowoff(const RadTensor* t, int64_t r, int64_t cols) {
|
||||
if (t->rank >= 2 && t->shape[t->rank - 1] == cols) {
|
||||
/* Walk the leading dimensions with their own strides, so a [T,H,V] tensor read as
|
||||
* [T*H, V] lands correctly even when H's stride is not V. */
|
||||
* [T*H, V] is correct even when H's stride is not V. */
|
||||
int64_t off = 0;
|
||||
for (int i = (int)t->rank - 2; i >= 0; --i) {
|
||||
int64_t s = t->shape[i];
|
||||
@@ -283,18 +339,40 @@ static inline int64_t laststride(const RadTensor* t) {
|
||||
static inline float ldt(const RadTensor* t, int64_t off) { return ld_dt(t->dtype, t->data, off); }
|
||||
static inline void stt(const RadTensor* t, int64_t off, float v) { st_dt(t->dtype, t->data, off, v); }
|
||||
|
||||
/* `v` rounded through a store and load of dtype `dt`, as an unfused pair rounds the tensor between
|
||||
* them. Whole-byte dtypes only. */
|
||||
static inline float round_dt(uint32_t dt, float v) {
|
||||
uint64_t buf = 0;
|
||||
st_dt(dt, &buf, 0, v);
|
||||
return ld_dt(dt, &buf, 0);
|
||||
}
|
||||
|
||||
/* Rows of a tensor read as [rows, n]: `n` is a parameter, the row count comes from the operand
|
||||
* (ref_ops.h). */
|
||||
static inline int64_t rows_of(const RadTensor* t, int64_t n) { return n > 0 ? numel(t) / n : 0; }
|
||||
|
||||
/* Entry `i` of a cu_seqlens operand. */
|
||||
static inline int64_t cu_at(const RadTensor* cu, int64_t i) {
|
||||
return ld_int(cu->dtype, cu->data, offlin(cu, i));
|
||||
}
|
||||
|
||||
/* The sequence that owns dense row `r`; a linear scan, since there are few. */
|
||||
static inline int64_t seq_of(const RadTensor* cu, int64_t n_seq, int64_t r) {
|
||||
int64_t s = 0;
|
||||
while (s + 1 < n_seq && cu_at(cu, s + 1) <= r) ++s;
|
||||
return s;
|
||||
}
|
||||
|
||||
/* ================================================================== parameters
|
||||
*
|
||||
* p_find FORWARDS to the ABI's own lookup, and the property that makes that safe is that
|
||||
* rad_args_geti/gets and the rest are `static inline` in the headers: this .so carries its own
|
||||
* copy and has no undefined symbol from rad_abi.h. That matters because a kernel plugin links only
|
||||
* the ABI (spec 18) -- a plugin referencing a symbol defined inside the engine would fail to
|
||||
* dlopen unless the host exported its whole static core dynamically, which is a build coupling
|
||||
* this side of the boundary must not have.
|
||||
* p_find forwards to the ABI's lookup. That is safe because the rad_args_* helpers are `static
|
||||
* inline` in the headers, so this .so has no undefined symbol from rad_abi.h. A kernel plugin links
|
||||
* only the ABI (spec 18); referencing an engine symbol would break dlopen unless the host exported
|
||||
* its static core.
|
||||
*
|
||||
* The getters below stay ref's own, because they are deliberately LAXER than the ABI's: they
|
||||
* accept a RANGE and a string spelling of an int, since a tool or a test may call a kernel
|
||||
* directly with no declare in front of it to enforce the type. */
|
||||
* The getters are ref's own and deliberately laxer than the ABI's: they accept a RANGE and a string
|
||||
* spelling of an int, since a tool or test may call a kernel directly with no declare to enforce
|
||||
* the type. */
|
||||
static inline const RadParam* p_find(const RadArgs* a, const char* k) {
|
||||
return a ? rad_param_find(a->p, a->n_p, k) : nullptr;
|
||||
}
|
||||
@@ -303,7 +381,7 @@ static inline long long p_int(const RadArgs* a, const char* k, long long dflt) {
|
||||
const RadParam* p = p_find(a, k);
|
||||
if (!p) return dflt;
|
||||
if (p->kind == RAD_P_INT) return p->ival;
|
||||
if (p->kind == RAD_P_RANGE) return p->ihi; /* see p_range_note below */
|
||||
if (p->kind == RAD_P_RANGE) return p->ihi; /* the band's ceiling; see band_rows */
|
||||
if (p->kind == RAD_P_STR && p->sval) return std::strtoll(p->sval, nullptr, 10);
|
||||
return dflt;
|
||||
}
|
||||
@@ -315,10 +393,9 @@ static inline const char* p_str(const RadArgs* a, const char* k, const char* dfl
|
||||
return dflt;
|
||||
}
|
||||
|
||||
/* A real-valued parameter. These are RAD_P_F64 in the schema (docs/OPS.md), and the core refuses
|
||||
* any other spelling for a float key at declare -- so `dval` is what arrives. The other kinds are
|
||||
* still read here because a tool or a test may call a kernel directly, with no declare in front of
|
||||
* it to enforce the type, and failing such a caller over a spelling would tell it nothing useful. */
|
||||
/* A real-valued parameter. The schema types these RAD_P_F64 (docs/OPS.md) and declare refuses any
|
||||
* other spelling, so `dval` is what normally arrives. Other kinds are still accepted for direct
|
||||
* callers (tools, tests) with no declare in front. */
|
||||
static inline float p_f32(const RadArgs* a, const char* k, float dflt) {
|
||||
const RadParam* p = p_find(a, k);
|
||||
if (!p) return dflt;
|
||||
@@ -329,8 +406,8 @@ static inline float p_f32(const RadArgs* a, const char* k, float dflt) {
|
||||
return dflt;
|
||||
}
|
||||
|
||||
/* An enumerated parameter that a caller may spell either way: act="silu" or act=0. Names win;
|
||||
* the integer form is libr4d's ordering. */
|
||||
/* An enumerated parameter spelled either way, act="silu" or act=0. Names win; the integer form
|
||||
* follows libr4d's ordering. An unknown name is -1, for the caller to refuse. */
|
||||
static inline int p_enum(const RadArgs* a, const char* k, const char* const* names, int n,
|
||||
int dflt) {
|
||||
const RadParam* p = p_find(a, k);
|
||||
@@ -338,35 +415,50 @@ static inline int p_enum(const RadArgs* a, const char* k, const char* const* nam
|
||||
if (p->kind == RAD_P_STR && p->sval) {
|
||||
for (int i = 0; i < n; ++i)
|
||||
if (names[i] && std::strcmp(names[i], p->sval) == 0) return i;
|
||||
return dflt;
|
||||
return -1;
|
||||
}
|
||||
if (p->kind == RAD_P_INT) return (int)p->ival;
|
||||
return dflt;
|
||||
}
|
||||
|
||||
/* ================================================================== operand checks */
|
||||
/* Errors are values (docs/IMPLEMENTATION.md). Nothing in this plugin throws, and nothing that did
|
||||
* not do the work returns RAD_OK. */
|
||||
/* Errors are values (docs/IMPLEMENTATION.md): nothing here throws, and nothing returns RAD_OK
|
||||
* without doing the work. */
|
||||
#define RAD_REF_TRY(expr) do { int _s = (expr); if (_s < 0) return _s; } while (0)
|
||||
|
||||
static inline const RadTensor* t_in(const RadArgs* a, int i) { return rad_arg_in(a, i); }
|
||||
static inline bool have(const RadArgs* a, int n) { return rad_args_have(a, n) != 0; }
|
||||
|
||||
/* ================================================================== parallel loops
|
||||
* OpenMP over whole outputs, with an if() clause: a loop with fewer than REF_PAR_MIN units of
|
||||
* work (a unit is about one multiply-add or element access) runs on the calling thread, so a
|
||||
* small op does not wake a thread team. Which thread computes an output never changes its value.
|
||||
*
|
||||
* REF_PAR_FOR(work) a parallel for, static schedule (REF_PAR_FOR_DYN: dynamic)
|
||||
* REF_PAR_REGION(work) a parallel region, for a loop that wants per-thread setup (ws_get)
|
||||
* REF_FOR / REF_FOR_DYN the for inside such a region, static or dynamic schedule */
|
||||
#define REF_PRAGMA(x) _Pragma(#x)
|
||||
#define REF_PAR_MIN ((int64_t)1 << 16)
|
||||
#define REF_PAR_FOR(work) \
|
||||
REF_PRAGMA(omp parallel for schedule(static) if((int64_t)(work) >= REF_PAR_MIN))
|
||||
#define REF_PAR_FOR_DYN(work) \
|
||||
REF_PRAGMA(omp parallel for schedule(dynamic) if((int64_t)(work) >= REF_PAR_MIN))
|
||||
#define REF_PAR_REGION(work) REF_PRAGMA(omp parallel if((int64_t)(work) >= REF_PAR_MIN))
|
||||
#define REF_FOR REF_PRAGMA(omp for schedule(static))
|
||||
#define REF_FOR_DYN REF_PRAGMA(omp for schedule(dynamic))
|
||||
|
||||
/* ================================================================== per-thread workspace
|
||||
* The gated-delta-net ops carry state that is too big for a stack frame -- a [128,128] fp32
|
||||
* recurrent state alone is 64 KB, and the chunked scan wants three more matrices beside it. The
|
||||
* fast kernel keeps all of that in WMMA accumulators; the reference cannot, so it needs somewhere
|
||||
* to put it.
|
||||
* The gated-delta-net ops carry state too big for a stack frame: a [128,128] fp32 recurrent state
|
||||
* is 64 KB, and the chunked scan needs three more matrices. The fast kernel keeps that in WMMA
|
||||
* accumulators; the reference needs memory.
|
||||
*
|
||||
* A per-thread vector that GROWS ONCE and is then reused. This is the one place in the plugin that
|
||||
* allocates, and it is worth naming why it is allowed to: the engine's no-allocation rule is about
|
||||
* the arena and the step path (docs/IMPLEMENTATION.md), and this allocates on the first launch of
|
||||
* a shape and never again -- there is no per-step malloc. The honest alternative is a scratch hook,
|
||||
* and it does not work here: scratch is sized at declare from the geometry, and the amount this
|
||||
* needs depends on the OpenMP thread count, which declare does not know.
|
||||
* A per-thread vector that grows once and is then reused, so it allocates only on a shape's first
|
||||
* launch. A scratch hook cannot replace it: scratch is sized at declare, but this depends on the
|
||||
* OpenMP thread count, which declare does not know. (This plugin is not the step path the engine's
|
||||
* no-allocation rule covers, docs/IMPLEMENTATION.md; other ops allocate small per-row vectors.)
|
||||
*
|
||||
* ONE CALL PER LAUNCH. A second call may reallocate and invalidate the first pointer, so every op
|
||||
* below asks for its whole workspace at once and carves it up itself. */
|
||||
* One call per launch: a second call may reallocate and invalidate the first pointer, so each op
|
||||
* requests its whole workspace at once and carves it up. */
|
||||
inline float* ws_get(size_t n_floats) {
|
||||
static thread_local std::vector<float> v;
|
||||
if (v.size() < n_floats) v.resize(n_floats);
|
||||
@@ -374,15 +466,12 @@ inline float* ws_get(size_t n_floats) {
|
||||
}
|
||||
|
||||
/* ================================================================== exact top-k
|
||||
* One step of an exact selection over a row, descending by value and, ON A TIE, by the LOWER
|
||||
* index. That tie rule is libr4d's (r4d_rowtopk_bf16: "descending, ties to the lower column") and
|
||||
* it has to be stated rather than left to a sort's stability, because a router that breaks ties
|
||||
* differently from the kernel it is checked against routes a token to a different expert and the
|
||||
* diff is a whole layer wide.
|
||||
* One step of an exact selection over a row: descending by value, ties to the lower index. That is
|
||||
* libr4d's rule (r4d_rowtopk_bf16) and it must be explicit, not left to sort stability: a router
|
||||
* that breaks ties differently sends a token to a different expert and the whole layer diverges.
|
||||
*
|
||||
* `pv`/`pi` carry the previously selected (value, index); seed them with +infinity and -1. The
|
||||
* cost is O(N) per selected element, i.e. O(N*R) for the whole row -- the straightforward
|
||||
* definition, and the one that needs no scratch buffer to be exact. */
|
||||
* `pv`/`pi` carry the previous pick (value, index); seed them with +infinity and -1. O(N) per
|
||||
* selected element, O(N*R) per row, with no scratch buffer. */
|
||||
static inline bool topk_next(const RadTensor* x, int64_t base, int64_t st, int64_t N,
|
||||
float* pv, int64_t* pi) {
|
||||
float best_v = 0.0f;
|
||||
@@ -400,61 +489,99 @@ static inline bool topk_next(const RadTensor* x, int64_t base, int64_t st, int64
|
||||
}
|
||||
|
||||
/* ================================================================== small maths
|
||||
* Written out rather than taken from <cmath>'s fast paths, because the reference's exp is the one
|
||||
* every softmax and every gate is checked against. std::expf is correctly rounded to well under a
|
||||
* ULP on glibc, which is the accuracy an oracle wants; a device kernel's __expf is not, and the
|
||||
* gap is what rad-kbench's tolerance is for. */
|
||||
static inline float ref_exp(float x) { return std::exp(x); }
|
||||
/* Used by locally-typical sampling, which is a threshold on |surprisal - entropy| and therefore
|
||||
* needs both. Same reasoning as ref_exp: the oracle takes the correctly-rounded libm. */
|
||||
static inline float ref_log(float x) { return std::log(x); }
|
||||
static inline float ref_abs(float x) { return std::fabs(x); }
|
||||
static inline float act_sigmoid(float x) { return 1.0f / (1.0f + std::exp(-x)); }
|
||||
* Every transcendental is evaluated in double and rounded once to float. glibc's float routines
|
||||
* are not the same function from one release to the next (2.41 made log1pf, tanhf, erff and
|
||||
* others correctly rounded), so a float call answers differently on two hosts and an oracle held
|
||||
* to its recordings exactly would fail on the one that did not record them. The double routines
|
||||
* have been stable for many releases and are accurate to well under a ULP of double, so the
|
||||
* rounded float is the same everywhere but for a double-rounding tie. A device kernel's __expf is
|
||||
* further off; rad-kbench's tolerance covers that gap. */
|
||||
static inline float ref_exp(float x) { return (float)std::exp((double)x); }
|
||||
static inline float ref_log(float x) { return (float)std::log((double)x); }
|
||||
static inline float ref_log1p(float x) { return (float)std::log1p((double)x); }
|
||||
static inline float ref_erf(float x) { return (float)std::erf((double)x); }
|
||||
static inline float ref_tanh(float x) { return (float)std::tanh((double)x); }
|
||||
static inline float ref_sin(float x) { return (float)std::sin((double)x); }
|
||||
static inline float ref_cos(float x) { return (float)std::cos((double)x); }
|
||||
static inline float ref_pow(float b, float e) { return (float)std::pow((double)b, (double)e); }
|
||||
static inline float ref_abs(float x) { return std::fabs(x); }
|
||||
static inline float act_sigmoid(float x) { return 1.0f / (1.0f + ref_exp(-x)); }
|
||||
static inline float act_silu(float x) { return x * act_sigmoid(x); }
|
||||
|
||||
/* The exact erf-based GELU, not tanh. A model trained with the tanh approximation should ask for
|
||||
* it by name rather than have the reference guess; until an op says so, "gelu" is the real one. */
|
||||
/* The exact erf-based GELU. "gelu" means this; the tanh approximation must be requested by name. */
|
||||
static inline float act_gelu(float x) {
|
||||
return 0.5f * x * (1.0f + std::erf(x * 0.70710678118654752f));
|
||||
return 0.5f * x * (1.0f + ref_erf(x * 0.70710678118654752f));
|
||||
}
|
||||
|
||||
/* The tanh approximation (PyTorch's gelu_tanh / gemma's gelu_pytorch_tanh) -- the form gated
|
||||
* feed-forwards are trained with. The constants are the standard fit and are the same two the
|
||||
* gemm_nt_bias "gelu_tanh" epilogue uses (ref_gemm.cpp), which is a GEMM-local copy of this same
|
||||
* formula; both compute the identical function, so a GELU-gated FFN and a tanh-gelu epilogue agree
|
||||
* to the last bit. Kept here rather than `#include`d into ref_gemm.cpp so the elementwise header
|
||||
* stays self-contained. */
|
||||
/* The tanh approximation (PyTorch's gelu_tanh, Gemma's gelu_pytorch_tanh), which gated
|
||||
* feed-forwards are trained with. */
|
||||
static inline float act_gelu_tanh(float x) {
|
||||
const float k0 = 0.7978845608028654f, k1 = 0.044715f;
|
||||
return 0.5f * x * (1.0f + std::tanh(k0 * (x + k1 * x * x * x)));
|
||||
return 0.5f * x * (1.0f + ref_tanh(k0 * (x + k1 * x * x * x)));
|
||||
}
|
||||
|
||||
/* softplus in the two-sided form, with the large-x cutoff FLA and libr4d both use: above the
|
||||
* threshold log1p(e^x) IS x to every bit f32 holds, and evaluating it costs an overflow. */
|
||||
/* softplus in the two-sided form, with FLA's and libr4d's large-x cutoff: above the threshold
|
||||
* log1p(e^x) equals x in f32, and evaluating it would overflow. */
|
||||
static inline float act_softplus(float x, float thr) {
|
||||
if (x > thr) return x;
|
||||
return x > 0.0f ? x + std::log1p(std::exp(-x)) : std::log1p(std::exp(x));
|
||||
return x > 0.0f ? x + ref_log1p(ref_exp(-x)) : ref_log1p(ref_exp(x));
|
||||
}
|
||||
|
||||
/* ================================================================== the Hadamard rotation
|
||||
* The widest rotation this reference performs in one stack frame. libr4d caps `had` at 512 -- a
|
||||
* power of two dividing the per-rank K, and 8704 admits no more -- so 4096 is four doublings of
|
||||
* headroom. A wider request returns RAD_E_UNSUPPORTED by name rather than silently rotating a
|
||||
* narrower block, because a half-applied rotation is numerically plausible and completely wrong. */
|
||||
* The widest rotation this reference performs in one stack frame. libr4d caps `had` at 512 (a
|
||||
* power of two dividing the per-rank K; 8704 admits no more), so 4096 leaves headroom. A wider
|
||||
* request returns RAD_E_UNSUPPORTED rather than rotating a narrower block, since a half-applied
|
||||
* rotation looks plausible and is wrong. */
|
||||
enum { REF_HAD_MAX = 4096 };
|
||||
|
||||
/* The unnormalised in-place transform over `g` values, g a power of two. */
|
||||
static inline void fwht(float* v, int64_t g) {
|
||||
for (int64_t h = 1; h < g; h <<= 1)
|
||||
for (int64_t i = 0; i < g; ++i)
|
||||
if ((i & h) == 0) {
|
||||
const float a = v[i], b = v[i + h];
|
||||
v[i] = a + b;
|
||||
v[i + h] = a - b;
|
||||
for (int64_t i = 0; i < g; i += 2 * h)
|
||||
for (int64_t j = i; j < i + h; ++j) {
|
||||
const float a = v[j], b = v[j + h];
|
||||
v[j] = a + b;
|
||||
v[j + h] = a - b;
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool pow2(int64_t v) { return v > 0 && (v & (v - 1)) == 0; }
|
||||
|
||||
/* ================================================================== the 8-bit group
|
||||
* One group of the block-scaled 8-bit quantisers (constants explained at ref_quant.cpp's
|
||||
* quant_act_fp8): `v(i)` for i < n is the group's values and `top` the largest code, 448 for E4M3
|
||||
* and 127 for int8. The codes clamp(v(i) / scale, +-top) go to q[qb + i * qs] in q's dtype (int8
|
||||
* rounded to nearest even), and the scale amax / top (1 for an all-zero group) is returned. */
|
||||
template <class V>
|
||||
static inline float q8_group(const V& v, int64_t n, float top, const RadTensor* q, int64_t qb,
|
||||
int64_t qs) {
|
||||
float amax = 0.0f;
|
||||
for (int64_t i = 0; i < n; ++i) { const float m = std::fabs(v(i)); if (m > amax) amax = m; }
|
||||
const float sc = amax > 0.0f ? amax * (1.0f / top) : 1.0f;
|
||||
const float inv = 1.0f / sc;
|
||||
for (int64_t i = 0; i < n; ++i) {
|
||||
float c = v(i) * inv;
|
||||
if (c > top) c = top;
|
||||
if (c < -top) c = -top;
|
||||
st_dt(q->dtype, q->data, qb + i * qs, c);
|
||||
}
|
||||
return sc;
|
||||
}
|
||||
|
||||
/* ================================================================== the int8 step order
|
||||
* quant_act_i8 stores a row's codes in the order libr4d's int8 WMMA reads an A fragment: within
|
||||
* each sixteen-byte step the middle two dwords are exchanged, so column c sits at byte
|
||||
* i8_step_pos(c) (bits 2 and 3 of c swapped). The map is its own inverse. gemm_nt_q reads its
|
||||
* activation in this order at the dtypes i8_steps_dtype names. */
|
||||
static inline int64_t i8_step_pos(int64_t c) {
|
||||
return (c & ~(int64_t)12) | ((c & 4) << 1) | ((c & 8) >> 1);
|
||||
}
|
||||
static inline bool i8_steps_dtype(const char* dt) {
|
||||
static const char* const kDtypes[] = { "w4a8", "w4a8_asym", "w8a8", "w2a8" };
|
||||
for (const char* d : kDtypes)
|
||||
if (dt && std::strcmp(dt, d) == 0) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
} /* namespace ref */
|
||||
#endif /* RAD_REF_COMMON_H */
|
||||
Reference in new issue
Block a user