Files
leleka/scripts/q8/probe_all.sh
T
Pavlo RatushnyiandClaude Sonnet 5.5 4654f01b15 q8_1 scale and sum stay finite in the sealed quantizers (plan 1.1; upstream 2b726ba6, f6601bf8, 7a0e3023, e372d4ff)
A q8_1 block stores d = amax / 127 and the sum of its 32 activations as fp16: one massive activation (amax > 8.3 M, or a sum past 65504)
rounded to inf and the dot products then read inf * 0 = NaN (NonFiniteMmqOutput here, "!!!!" upstream). The quantizers now clamp both
to the largest finite half and keep the codes inside int8 (strata/kernels/q8_1_finite.hpp); a NaN input still gives a NaN sum.
Finite blocks are stored bit for bit as before.

Sites: head_quant (mtp_original_full_head_native, native_head_native), mtp_original_quantize (mtp_original_tail, mtp_original_full_checks),
quantize_q8_1_kernel (mtp_original_full_head_iq, native_head_iq: the routed experts' input and SwiGLU output) and the opt-in chain
swiglu+quantize (chain_window). Not taken: the MMQ prompt quantizers (ggml quantize_mmq_q8_1, mtp_prefill_q8), which upstream did not clamp.

The sealed PTX are patched entry by entry (scripts/q8): three were built with CUDA 13.0.88, which is not installed, and a recompile
renames the hashed anonymous-namespace entries; only the quantizer entries change, every other byte is the sealed one. Pins, the seal
plan digests and the sm_86 companions (sm86_assets.py build) follow. tools/q8-probe compares old and new PTX on the GPU.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 18:27:20 +01:00

21 lines
1.0 KiB
Bash

#!/bin/bash
# Run the q8_1 quantizer identity / extreme-activation probe over every sealed asset that carries one (docs/upstream-port-plan.md row 1.1).
# bash scripts/q8/probe_all.sh OLD_DIR NEW_DIR OLD_DIR/NEW_DIR hold the PTX files before and after (same file names)
# Needs the GPU (one small context, a few hundred MB) and tools/q8-probe built (tools/q8-probe/build.sh).
set -u
OLD=${1:?old dir}
NEW=${2:?new dir}
PROBE=${PROBE:-$(dirname "$0")/../../tools/q8-probe/q8_probe}
export LD_LIBRARY_PATH=$HOME/cuda-toolkits/13.2.2/lib64:${LD_LIBRARY_PATH:-}
rc=0
probe() { echo "=== $1 ($2)"; "$PROBE" "$OLD/$1" "$NEW/$1" "$2" ${3:-} || rc=1; }
probe mtp_original_full_head_native.ptx head
probe native_head_native.ptx head
probe mtp_original_tail.ptx tail
probe mtp_original_full_checks.ptx tail
probe mtp_original_full_head_iq.ptx iq quantize_q8_1_kernelEPKfP10block_q8_1x
probe native_head_iq.ptx iq quantize_q8_1_kernelEPKfP10block_q8_1x
probe chain_window.ptx chain
[ $rc = 0 ] && echo "probe_all: every asset OK" || echo "probe_all: FAILED"
exit $rc