Skip to content

Commit b408d8e

Browse files
committed
knowledge: HEVC/H.265 amortization map onto the BF16 16×16 AMX tile substrate
The durable ledger for the operator's thesis: use the BF16 16×16 AMX GEMM / blasgraph neighborhood / Morton-tile pyramid / perturbation-shader cascade to amortize H.265/HEVC — the per-block cost collapsing to a gather (bit shift) + one TDPBF16PS tile op over a deterministic pyramid built once. Maps every HEVC DSP stage to the substrate primitive, each row tagged MEASURED (#PR) / MECHANISM-unmeasured (probe named) / DOESN'T-FIT: - Motion estimation/compensation → i8/bf16 GEMM + gather [MEASURED #230] - Inverse transform → separable tile GEMM; WHT no-op [MEASURED #232] - Intra prediction / covariance → field-coupling tile op [MEASURED shape #233] - Sub-pel interpolation (8-tap) → separable tile GEMM [MECHANISM — probe] - CTU quad-tree → Morton/HHTL cascade [MECHANISM — shipped] - Deblock/SAO → masked tile op + LUT (the "AMX masking") [PARTIAL — masking] - CABAC entropy → serial arithmetic coding [DOESN'T FIT] Two honest boundaries recorded: (1) CABAC is not a GEMM — the entropy layer is the M2 serial front-end the tile substrate does not amortize; (2) the golden-spiral codec is for directional/sparse data, not dense scalar residuals (#231, measured negative). Cross-repo tie grounded: OGAR's perturbation pyramid IS the Walsh-Hadamard transform of the address tree = the same WHT #232 measured as the codec transform. Includes a probe queue (subpel_tap_tile, intra_angular_tile, deblock_masked_tile, CTU routing parity, M2 CABAC). Anchors: PRs #230#233; hpc::bf16_tile_gemm, splat3d::spd3, cascade, codec; blasgraph HHTL; OGAR perturbation pyramid. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MLBnPuScZy6w9di2QEjsXM
1 parent 77aae6b commit b408d8e

1 file changed

Lines changed: 101 additions & 0 deletions

File tree

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# HEVC / H.265 amortization map — onto the BF16 16×16 AMX tile substrate
2+
3+
> READ BY: cognitive-architect, savant-architect, amx-savant, truth-architect,
4+
> l3-strategist, product-engineer
5+
>
6+
> Status ledger. Every row is tagged **[MEASURED #PR]** / **[MECHANISM —
7+
> unmeasured, probe named]** / **[DOESN'T FIT]**. No unmarked conjecture.
8+
> Companion to `.claude/knowledge/pr-x12-codec-cognitive-substrate-mapping.md`
9+
> (the E-7/H-7 plan this measures against).
10+
11+
## The thesis (operator, 2026-07-04)
12+
13+
> Use the BF16 16×16 AMX GEMM / blasgraph neighborhood / Morton-tile pyramid /
14+
> perturbation-shader cascade (+ AMX masking or other algorithms for certain
15+
> stages) **to amortize H.265 / HEVC.**
16+
17+
Amortize = the codec's per-block marginal cost collapses to **a gather (bit
18+
shift) + one 16×16 BF16 AMX tile op** (`hpc::bf16_tile_gemm::bf16_tile_gemm_16x16`
19+
`TDPBF16PS`), routed over a Morton/HHTL tile pyramid whose codebooks/bases are
20+
**deterministic and built once** (the helix "template is free, regenerable —
21+
only the endpoint costs" principle), then reused across every block and every
22+
frame. One tile machine + one pyramid + one place/residue codec, not N bespoke
23+
HEVC kernels.
24+
25+
## The one primitive, three layers
26+
27+
| layer | what it is | shipped in |
28+
|---|---|---|
29+
| **address (bit shift)** | integer motion / tile position / CTU quad-tree = pure addressing, zero arithmetic (`VPGATHERDD`) | `hpc::cascade` (Morton), blasgraph `heel_hip_twig_leaf` / `clam_neighborhood` (lance-graph) |
30+
| **couple (tile op)** | a 16×16 BF16 GEMM `C = A·B` = one `TDPBF16PS` — every linear field coupling / transform / covariance projection | `hpc::bf16_tile_gemm::bf16_tile_gemm_16x16`, `hpc::splat3d::spd3::sandwich_x16` |
31+
| **code (place/residue)** | deterministic pyramid PLACE (free) + coded RESIDUE magnitude; the perturbation phase IS the Walsh–Hadamard sign transform of the address tree | `hpc::splat3d::helix_orient`, `crates/helix` (lance-graph), OGAR `guid-prefix-shape-routing.md §4b` |
32+
33+
The perturbation-shader cascade and the codec transform are **the same object**:
34+
OGAR canon states "the perturbation pyramid becomes the Walsh–Hadamard transform
35+
of the address tree" (`OGAR/CLAUDE.md`, Bipolar-phase pyramid), and PR #232
36+
measured WHT (the ±1 add/subtract sign transform) as the codec transform,
37+
matching the DCT within 2%. Same ±1 sign butterfly, two names.
38+
39+
## HEVC stage → substrate primitive
40+
41+
| HEVC stage | reduces to | status |
42+
|---|---|---|
43+
| **Motion estimation** (block match / SAD→SSD) | `A·B` middle term of SSD = i8/bf16 GEMM | **[MEASURED #230]** — ME argmin == direct SSD, 256/256, via `int8_gemm_i32` |
44+
| **Motion compensation** (integer-pel) | gather at MV offset + residual add | **[MEASURED #230]** — bit-exact `recon = shifted_ref + residual` |
45+
| **Inverse transform** (integer DCT/DST 4–32) | separable `M·X` = tile GEMM; WHT (sign-only) suffices | **[MEASURED #232]** — WHT tracks DCT ≤2%; transform is a *no-op* when motion whitens the residual (dct/dir → 1) |
46+
| **Intra prediction** (planar/DC/33 angular) | directional extrapolation from neighbors = linear field op = tile GEMM; the angle is a helix direction code | **[MEASURED shape #233]** — field coupling `Xᵀ·X` / `Mᵀ·Σ·M` = tile op @ 0.1–0.4% Frobenius. Full intra-mode probe: **unmeasured** |
47+
| **Sub-pel interpolation** (8-tap luma / 4-tap chroma) | separable FIR = small GEMM per block = tile op | **[MECHANISM — unmeasured]** probe: `subpel_tap_tile` (8-tap separable == `bf16_tile_gemm_16x16`, bit-close to the reference filter) |
48+
| **Reference-sample smoothing / covariance** | Gaussian/covariance projection = the EWA sandwich | **[MEASURED #233]**`sandwich_x16` shape @ 0.4% |
49+
| **CTU quad-tree partition** (64→32→16→8) | Morton/HHTL tier cascade = the address pyramid | **[MECHANISM — shipped]** `hpc::cascade`, blasgraph HHTL; codec `Ctu` quad-tree. Routing-parity probe unmeasured |
50+
| **Deblocking + SAO** (in-loop filters) | conditional edge filter + offset LUT — clip/branch-heavy, *not pure GEMM* | **[PARTIAL — AMX masking]** the operator's "AMX masking": the filter is a masked tile op (predicated add), SAO is a gather-LUT. Fits with masking, not plain GEMM. Unmeasured |
51+
| **CABAC entropy** (context-adaptive binary arithmetic) | serial, bit-level, data-dependent arithmetic coding | **[DOESN'T FIT]** — a serial dependency chain, not a GEMM. AMX/tiles do not help. This is the M2 front-end and stays a separate serial layer. The honest boundary of the thesis. |
52+
53+
## What amortizes, precisely
54+
55+
- **Build once, reuse per block.** The transform basis (WHT ±1 sign matrix), the
56+
interpolation taps, the Morton pyramid, the palette/centroid codebooks, and the
57+
golden-spiral place template are **deterministic** — computed once, never
58+
stored per-block (helix principle). Every block pays only: a gather + 1–2 tile
59+
ops + a residue magnitude. The 64×64 gridlake = 4×4 = **16 tile ops**.
60+
- **One kernel, many stages.** ME, inverse transform, intra prediction, sub-pel,
61+
and covariance all route through `bf16_tile_gemm_16x16`. The substrate is the
62+
zero-FP cognitive shader (gather + tile ops), so "the codec IS the substrate"
63+
holds down to the instruction (`TDPBF16PS`).
64+
- **The transform mostly vanishes.** Per #232, good motion whitens the residual
65+
and the transform's advantage → 1 (a no-op); where it survives it is a
66+
multiply-free WHT. So the amortized codec spends tile ops on prediction, not on
67+
transform-coding a well-predicted residual.
68+
69+
## The two honest boundaries
70+
71+
1. **CABAC is not a GEMM.** Entropy (de)coding is inherently serial arithmetic
72+
coding — the one HEVC stage the tile substrate does not amortize. A real
73+
`.265` decoder needs it (M2). The thesis amortizes the **DSP**, not the
74+
**entropy layer**.
75+
2. **The golden-spiral is for directional/sparse data, not dense scalars.** Per
76+
#231 (measured negative), coding a *dense scalar* residual with sparse
77+
golden-spiral anchors loses to local DPCM; the golden-spiral / helix codec
78+
belongs on directions (surfel normals, plausibly MV fields), not the dense
79+
luma residual. Use DPCM/WHT there.
80+
81+
## Probe queue (next falsifiable steps, in order)
82+
83+
1. **`subpel_tap_tile`** — HEVC 8-tap separable interpolation == `bf16_tile_gemm_16x16`,
84+
Frobenius-close to the reference FIR. (Cleanest next measurement; mechanism
85+
already clear.)
86+
2. **`intra_angular_tile`** — the 33 angular intra modes as directional tile-op
87+
extrapolations; measure PSNR vs the HEVC reference predictor.
88+
3. **`deblock_masked_tile`** — deblocking as a predicated (AMX-masked) tile op;
89+
measure vs the HEVC clip-based filter (tests the operator's "AMX masking").
90+
4. **CTU quad-tree routing parity** — Morton/HHTL cascade partition == HEVC CTU
91+
split decisions on a real frame.
92+
5. **M2 (separate track)** — CABAC serial front-end to extract MVs+residuals from
93+
a real `.265` bitstream. Not tile-amortizable; the honest hard part.
94+
95+
## Anchors
96+
97+
PRs #230 (ME=GEMM, MC bit-exact), #231 (residue upscaling — measured negative for
98+
dense scalar), #232 (transform no-op × WHT), #233 (field coupling = AMX tile op,
99+
on real `TDPBF16PS`). Shipped: `hpc::bf16_tile_gemm`, `hpc::splat3d::spd3`,
100+
`hpc::cascade`, `hpc::codec`; lance-graph blasgraph HHTL; OGAR perturbation
101+
pyramid = WHT.

0 commit comments

Comments
 (0)