---
title: PF8.2 weight preprocess kernel — GPU runtime smoke PASS + 5th Claude hallucination caught (in expected-value derivation)
date: 2026-05-10
type: research
status: pf8.2-runtime-verified-plus-discipline-evidence
---

# PF8.2 weight preprocess kernel — GPU runtime smoke PASS + 5th Claude hallucination caught (in expected-value derivation)

> Per skill v1.11.0 #28+#31: build clean ≠ runtime correct.
> PF8.2 kernel from `940f49e` was build-verified but NOT
> GPU-runtime-verified. This entry documents the smoke that
> confirms runtime correctness + a 5th Claude hallucination caught
> by the smoke itself (not the kernel — the test's expected values).

## §0 Direct evidence (raw nvcc + run output this tick, NOT memory recall)

### First run (revealed Claude hallucination in test setup)

```bash
$ /tmp/test_pf8_preprocess
FAIL at i=0: in=0x76543210 expected=0xfedcba98 got=0x89abcdef
FAIL at i=3: in=0x76543210 expected=0xfedcba98 got=0x89abcdef
FAIL at i=6: in=0x76543210 expected=0xfedcba98 got=0x89abcdef
FAIL at i=9: in=0x76543210 expected=0xfedcba98 got=0x89abcdef
FAIL at i=12: in=0x76543210 expected=0xfedcba98 got=0x89abcdef
FAIL: 11/32 values incorrect
PASS: alignment guard returns cudaErrorInvalidValue for numel=31
```

11 FAIL on case 0 (input `0x76543210`), 0 FAIL on case 1 (`0xFEDCBA98`)
+ case 2 (`0x88888888`). Alignment guard PASS.

### Hallucination diagnosis (re-derive bit-pack arithmetic)

Per skill v1.11.0 #28+#31: empirical smoke caught my hallucination.
Re-deriving from kernel source:

```cpp
for (int32_t i = 0; i < 8; i++) {
  int32_t single_val = val & 0xF;
  single_val = single_val >= 8 ? single_val - 8 : 15 - single_val;
  new_val |= single_val << (i * 4);   // ← bit pack LSB→MSB
  val >>= 4;
}
```

For input `0x76543210` (values 0,1,2,3,4,5,6,7 packed LSB→MSB):
- iter 0: `val & 0xF = 0`; transform `15 - 0 = 15`; `new_val |= 15 << 0` → bits [0-3] = 0xF
- iter 1: `val & 0xF = 1`; transform `15 - 1 = 14`; `new_val |= 14 << 4` → 0xEF
- iter 2: `val & 0xF = 2`; transform `15 - 2 = 13`; `new_val |= 13 << 8` → 0xDEF
- iter 3: `val & 0xF = 3`; transform `15 - 3 = 12`; `new_val |= 12 << 12` → 0xCDEF
- iter 4: `val & 0xF = 4`; transform `15 - 4 = 11`; `new_val |= 11 << 16` → 0xBCDEF
- iter 5: `val & 0xF = 5`; transform `15 - 5 = 10`; `new_val |= 10 << 20` → 0xABCDEF
- iter 6: `val & 0xF = 6`; transform `15 - 6 = 9`; `new_val |= 9 << 24` → 0x9ABCDEF
- iter 7: `val & 0xF = 7`; transform `15 - 7 = 8`; `new_val |= 8 << 28` → **0x89ABCDEF**

Kernel produced 0x89ABCDEF. **My initial expected `0xFEDCBA98` was wrong**.
The 0xFEDCBA98 value was just the transformed digits in MSB→LSB order
(reverse bit-pack), but the kernel uses LSB→MSB packing. Memory-recall
hallucination — I "knew" the transform produces F,E,D,C,B,A,9,8 and
intuited the hex literal without working through the bit-shift math.

### Test fix + re-run (correct expected)

```bash
$ /tmp/test_pf8_preprocess
PASS: PF8.2 preprocess transforms all 32 values correctly
  3-pattern test (vals 0..7 → 15..8, vals 8..15 → 0..7, all 8s → all 0s)
PASS: alignment guard returns cudaErrorInvalidValue for numel=31
```

All 32 values correct + alignment guard works. PF8.2 kernel is
runtime-correct.

## §1 5th Claude hallucination this session

Counter is now 5 (per de36538 + b551bea catalog):

| # | Tick | Hallucination | Reality | Caught by |
|---|------|---------------|---------|-----------|
| 1 | `0f4d0ae` | --max-waiting-requests CLI flag exists | Never existed | codex investigation |
| 2 | `43bda9c` | W4A16 has max_par×64×n reduce buffer | W4A8 has it, W4A16 doesn't | codex's wins-entry framing |
| 3 | `4b30c15` | ARLE has /health endpoint | /healthz+/readyz only | codex empirical pivot |
| 4 | `5bf0e20` | 2026-05-09 baseline-B5 comparable to newdequant | Different checkpoint variants | self-audit + raw command.txt |
| 5 | `THIS TICK` | bit-pack `0x76543210 → 0xFEDCBA98` | Actually `→ 0x89ABCDEF` (LSB→MSB packing) | empirical smoke run |

**New common-mode pattern**: even "deterministic" claims (CLI flag
existence, kernel-internal buffer presence, HTTP route, baseline
match, bit-pack arithmetic) can be hallucinated when stated from
memory recall instead of derived/verified step-by-step.

The smoke test itself is the verification mechanism. Without the
empirical run, my wrong expected would have shipped + been
"validated" by future readers without re-derivation.

## §2 Strengthened skill v1.11.0+ #31 evidence

Original #31 said: "ANY claim about ARLE's surface (CLI flags, file
structure, kernel internals, HTTP routes, baseline checkpoint match,
model variant, scheduler config defaults) MUST be backed by raw
grep/Read/cat output IN THE SAME RESPONSE making the claim."

This tick adds: **bit-pack arithmetic and other "deterministic
computation" claims are also surface claims**. The kernel's transform
rule is plain (`val ≥ 8 ? val-8 : 15-val`), but combining 8 iterations
of bit-shift packing into a single hex literal requires step-by-step
arithmetic, NOT memory recall of "what the answer should look like".

Smoke test = forcing the arithmetic to happen on actual hardware =
catches the hallucination before it ships.

## §3 Verdict

**PASS** for PF8.2 runtime correctness on:
- 3 distinct input patterns (vals 0..7, vals 8..15, all 8s)
- 32 elements per pattern (1 block × 32 INT32 = 256 INT4 weights)
- Alignment guard (numel=31 returns cudaErrorInvalidValue)

PF8.1 + PF8.2 both runtime-verified. Both kernels work as designed
on sm_89 RTX 4070 Ti SUPER.

## §4 What's NEXT for PF8 chain

After PF8.1 + PF8.2 runtime PASS:
- **PF8.3 FP8 marlin GEMM** (~700 LOC): codex's natural pickup OR
  Claude self-implements mirror of marlin_w4a8_kernel.cu. Codex
  idle 15+ ticks; Claude likely owns this if codex stays quiet.
- **PF8.4 dispatch wiring** (~50 LOC, can land anytime): adds
  MarlinW4FP8Prefill enum + INFER_MARLIN_W4_FP8_PREFILL env var.
- **PF8.5 A/B bench**: end-to-end TTFT comparison. License gate per
  a66d99a §2: TTFT p50 Δ ≥ -8% with σ < 5% n=3.

## §5 Cooperative discipline applied (per skill v1.11.0 #28+#30+#31)

- Raw nvcc + run output quoted in §0 (per #28+#31)
- Single-file commit (this research entry only); test harness
  `/tmp/test_pf8_preprocess.cu` stays in /tmp scope per session pattern
- Discovered 5th hallucination caught BY the smoke test itself, NOT
  by a peer agent — proves the empirical-smoke discipline is
  self-correcting

## §6 Cross-references

- PF8.2 source: `crates/cuda-kernels/csrc/gemm/marlin_int4_fp8_preprocess.cu` (940f49e)
- FFI binding: `crates/cuda-kernels/src/ffi/gemm.rs` `marlin_int4_fp8_preprocess_without_zp_cuda`
- PF8.1 runtime PASS: `docs/research/2026-05-10-pf8.1-runtime-smoke-PASS.md` (b628eca)
- Directive: `docs/research/2026-05-10-prefill-only-fp8-directive-draft.md` (a66d99a)
- Smoke harness: `/tmp/test_pf8_preprocess.cu` (this tick, /tmp scope)
- Skill v1.11.0 anti-patterns #28+#31: `.claude/skills/kernel-optimization/SKILL.md` (b551bea)
- Session retrospective (4 prior hallucinations): `de36538`

## §7 Status

PF8.2 runtime SMOKE PASS confirmed. PF8.1 + PF8.2 both runtime-verified.
Discovered 5th Claude hallucination this session — by an empirical
smoke catching its own test's wrong expected value, not by peer
investigation. Pattern: bit-pack arithmetic is also a "surface claim"
needing raw evidence. Skill v1.11.0+ #31 strengthened.

Next: PF8.3 GEMM kernel (codex pickup or Claude self-implement).
