MoA-Structured Decode Attention DNF Derivation, KV-Cache Accumulation, GQA/MQA, and OpenACC Kernel
The problem is to derive memory-optimal inference artifacts for transformer attention using the Mathematics of Arrays (MoA), directly from the forward-pass Denotational Normal Form (DNF) with a fixed query-row index. The method produces four artifacts: a single-query decode DNF eliminating the K^T buffer, a C/OpenACC GPU kernel with exact IEEE-754 arithmetic, a multi-step KV-cache with O(d_k+d_v) per-step append, and GQA/MQA via ψ-selection. Experimental evidence shows the DNF achieves DRAM traffic of (d_k+nd_k+nd_v+d_v)×4 B with numerical error ≤2×10⁻⁷, and the GPU kernel is verified to have zero error against PyTorch scaled_dot_product_attention. This matters because it provides proven, memory-optimal attention inference with exact arithmetic, enabling efficient deployment of large transformer models on GPUs.