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
+14
-35
@@ -1,53 +1,32 @@
|
||||
// r4d_fp8_lm.h -- the STORED ROW GEOMETRY of the fp8 lm_head, and nothing else. Pure C++: no HIP,
|
||||
// no r4d.h, so the host layout hook (r4d_fp8_layout.cpp), the device entry point
|
||||
// (r4d_gemm_fp8a16_nt_m1.hip) and the selftest all derive the row width from the same line instead
|
||||
// of writing `K + 2 * (K / 128)` four times and drifting.
|
||||
// r4d_fp8_lm.h -- stored row geometry of the fp8 lm_head. Pure C++ (no HIP, no r4d.h) so the
|
||||
// layout hook (r4d_fp8_layout.cpp), the entry point (r4d_gemm_fp8a16_nt_m1.hip) and the selftest
|
||||
// derive the row width from one definition.
|
||||
//
|
||||
// WHY THE ROW LOOKS LIKE THIS AT ALL is r4d_rad_layout_fp8_logits' argument and is not repeated
|
||||
// here: `logits_gemm` carries ONE weight operand, so the block scales have nowhere to go but the
|
||||
// row's own tail, and that is what keeps a row-sharded lm_head a plain byte range under tensor
|
||||
// parallelism.
|
||||
// `logits_gemm` carries one weight operand, so the block scales live in each row's tail (see
|
||||
// r4d_rad_layout_fp8_logits); a row-sharded lm_head stays a plain byte range under TP.
|
||||
//
|
||||
// ---- THE PADDING, which is the only thing this header adds to `K + 2*nkb` ---------------------
|
||||
//
|
||||
// Both kernels that read this plane -- the M <= 2 matvec and the WMMA tile above it -- load the
|
||||
// weight SIXTEEN BYTES AT A TIME through a uint4, at `row * w_ld + (a multiple of 16)`. So the row
|
||||
// pitch has to be a multiple of 16 or every odd row is misaligned, and the unpadded width is a
|
||||
// multiple of 16 only when
|
||||
// Padding: both kernels that read this plane (the M <= 2 matvec and the WMMA tile) load the weight
|
||||
// as uint4 at `row * w_ld + (a multiple of 16)`, so the row pitch must be a multiple of 16. The
|
||||
// unpadded width is one only when
|
||||
//
|
||||
// K + 2*(K/128) = 130m (K = 128m) is 0 mod 16 <=> m is 0 mod 8 <=> K is 0 mod 1024
|
||||
//
|
||||
// which is a property of the MODEL, not of anything the kernel chose. K = 5120 has it; K = 2560
|
||||
// does not. Without the pad such a head cannot be served in fp8 at all: it falls to the bf16
|
||||
// projection, which reads twice the bytes and is then the single largest op in the step -- for
|
||||
// want of eight bytes a row.
|
||||
// e.g. K = 5120 qualifies, K = 2560 does not. The pad costs under 16 bytes per row (0.3% at
|
||||
// K = 2560) and is a no-op when K is a multiple of 1024, where the plane is byte-identical to the
|
||||
// unpadded one.
|
||||
//
|
||||
// So pad. The cost is under 16 bytes on a row that is already K + K/64 long -- 0.3% at K = 2560,
|
||||
// and ZERO at every K that is a multiple of 1024, where the rounding is a no-op and the plane is
|
||||
// byte-for-byte the unpadded one. **The padding never changes a valid container's plane**, and
|
||||
// that is not luck: the layout hook refuses a K without the property rather than writing a plane
|
||||
// its own kernels would fault on, so every K a container can already hold is one the rounding
|
||||
// leaves alone.
|
||||
//
|
||||
// This is NOT the padding r4d_gemm_fp8a16_nt_m1.hip's header prices and rejects. That one is about
|
||||
// padding an ALREADY-ALIGNED 5200-byte row out to 5376 to make it 128-aligned, chasing the
|
||||
// cacheline straddle, and it loses to FK = 256. This is 16-byte alignment, which is a correctness
|
||||
// floor rather than a tuning knob, and it is what decides whether the row can be served at all.
|
||||
// This is a 16-byte correctness floor, unrelated to the 128-byte row padding that
|
||||
// r4d_gemm_fp8a16_nt_m1.hip's header evaluates and rejects.
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
namespace r4d_fp8 {
|
||||
|
||||
// BYTES one stored lm_head row occupies: K E4M3 codes, then K/128 bf16 block scales, then the
|
||||
// Bytes one stored lm_head row occupies: K E4M3 codes, then K/128 bf16 block scales, then the
|
||||
// alignment tail. K must be a multiple of 128 (the scale block); the caller checks that.
|
||||
inline int64_t lm_row_bytes(int64_t K) {
|
||||
const int64_t used = K + 2 * (K / 128);
|
||||
return (used + 15) & ~(int64_t)15;
|
||||
}
|
||||
|
||||
// ...and where the pad starts, which is the only part of the row nothing reads. The transform
|
||||
// zeroes it so that a container's bytes are a function of its weights and not of what the
|
||||
// allocator happened to leave there.
|
||||
inline int64_t lm_row_used(int64_t K) { return K + 2 * (K / 128); }
|
||||
|
||||
} // namespace r4d_fp8
|
||||
Reference in new issue
Block a user