The Library · 文库

The Library

一个分门别类的索引, 收齐了我写过的东西。 代码精读和论文精读是 /sources 下自成一体的 HTML 深读; 教程和博客是中英双语的 blog 长文; 实验是可复现的 kernel 与系统性能记录, 连原始数据一起存档; 日常同步是按期编号的结果记录, 数字由 GitHub 实时拉取。 六个栏目, 一张地图。

Five shelves A diagram of five labeled shelves — code, paper, tutorial, blog, and experiments — feeding into one index. /sources · the library CODE · 13 PAPER · 6 TUTORIAL · 8 BLOG · 7 EXPERIMENTS · 8
13code readings
6paper readings
8tutorials
7blog posts
8experiments
01

Code

代码精读 · source-level readings of real codebases — each a self-contained HTML deep dive
13 deep dives
Source ReadingNo. 001

SkyPilot

Cloud orchestration as an optimization problem: resources, regions, spot instances, Kubernetes, jobs, and the control loops that make them practical.

cloudinfrascheduler
Source ReadingNo. 002

SGLang

A serving-system read focused on runtime structure, request scheduling, cache management, routing, and the boundary between Python control and fast inference paths.

LLM servingruntimecache
Source ReadingNo. 003

vLLM

The wrap-up of the initial serving trilogy: scheduler pressure, PagedAttention, KV memory, batching, and how design choices compare against SGLang.

PagedAttentionKV cachescheduler
Source ReadingNo. 004

mini-SGLang

A smaller codebase read as a teaching artifact: what a minimal implementation makes explicit, what it hides, and how to learn from that compression.

minimalteachingserving
Source ReadingNo. 005

GCNasm

A descent into hand-written AMD GPU assembly: CDNA3 idioms, occupancy, memory movement, instruction selection, and the optimization patterns behind fast kernels.

AMDassemblykernel
Source ReadingNo. 006

FlyDSL

A Python DSL with typed MLIR underneath: layout algebra, copy and MMA atoms, compiler boundaries, and what it takes to express production GEMM from Python.

DSLMLIRlayout
Source ReadingNo. 007

AITER MoE Tuner

A tuner-first reading of MoE GEMM search: config space, benchmarking discipline, hardware assumptions, and why tuning code is often kernel knowledge in disguise.

MoEGEMMautotune
Source ReadingNo. 008

rocprof Viewer

A field guide to AMD instruction-level profiling: rocprofv3 capture, Advanced Thread Trace, source mapping, and how to read the viewer panels without fooling yourself.

profilingATTROCm
Source ReadingNo. 009

Codex Goal Mode

A source-level reading of goal mode as a thread-scoped state machine: persisted goals, model tools, runtime continuation, token budget accounting, and authority boundaries.

Codexstate machineruntime
Source ReadingNo. 010

AITER CI Kernel Surface

A source-level map of AITER's active CI: workflow routing, kernel families, shape pressure points, and the downstream gates that turn kernel tests into system tests.

CIkernel testsROCm
Source ReadingNo. 011

Humanize

A Claude Code plugin that wraps an agent in a shell-hook control loop with an independent Codex reviewer: the phase is a filename, a dozen cheap gates guard one expensive review, and a feedback controller trips circuit breakers when progress stalls.

agent loophooksCodex review
Source ReadingNo. 012

270 Fences: The Compiler in the FlyDSL Kernel Loop

FlyDSL compiles MI355X and MI455X kernels with one in-process LLVM it can patch, yet 62 of its 180 kernel files override that compiler by hand. Where the optimization loop breaks, which layer of the compiler chain fixes each break, and a CAKE-style outer loop that turns overrides into compiler features.

compilerFlyDSLagents
Source-levelLive radar

Kernel & Inference Optimization Radar

A reviewable cross-repository backlog: 32 open issues, 18 overlapping PRs, four model families, and the integration routes that separate a kernel benchmark from a serving-system win.

kernelinference E2EROCm
02

Paper

论文精读 · close readings of research papers, rebuilt as HTML deep dives
6 deep dives
Paper ReadingNo. 006

Together Compiler

Together AI recasts inference optimization as agent search and spends its engineering on making each experiment fast and faithful: a persistent engine that hot-reloads forward passes, two measurement tiers, and a cost model. Why CUDA Graphs + PDL recover 98% of a megakernel, what the agents found on MI355X, and how to apply it to MI355X, MI455X and FlyDSL.

agentic compilerinferenceMI355X / FlyDSL
Paper ReadingNo. 005

Draft-OPD

A speculative-decoding draft model trained by plain SFT plateaus — it never sees its own mistakes. Draft-OPD teaches it from its rejected guesses: target-assisted rollout, error-position replay, and an acceptance-aware forward/reverse-KL objective. +23% over EAGLE-3, +13% over DFlash, with every number checked against the source.

speculative decodingon-policy distillationEAGLE-3 / DFlash
Paper ReadingNo. 004

The Chunked Pipeline

How SGLang serves million-token prompts with pipeline parallelism: the communication-volume math, the bubble ratio, async P2P, and the dynamic chunking that equalizes per-stage time. A first-principles rebuild of the LMSYS post.

pipeline parallellong contextSGLang
Paper ReadingNo. 001

Polar

Agentic RL without rewriting the harness: proxying LLM API calls, asynchronous staging, prefix merging, and what SWE-Bench tells us about scalable agent training.

agent RLproxySWE-Bench
Paper ReadingNo. 002

Kernel Design Agents

A close read of agentic GPU kernel development: plan-execute-verify loops, KernelWiki, ncu-guided debugging, autotuning, and reward-hacking failure modes.

agentsGPU kernelsautotune
Paper ReadingNo. 003

Linear Layouts

One binary matrix over GF(2) as the organizing principle for tensor layouts: conversion, broadcast, swizzling, slicing, and robust code generation.

compilerlayoutGF(2)
03

Tutorial

教程 · first-principles primers and guides — rich HTML primers where a topic needs plates, the rest bilingual blog posts
8 pieces
Guide · HTMLkernel validation

Green Test, Red Model

Why a GPU kernel can pass every unit test and still break an end-to-end model run: seven gaps between a test and a model, traced through public bugs from the gfx1250 bring-up and from FlyDSL v0.3 to v0.4, and a validation ladder that closes them.

validationgfx1250FlyDSL
Guide · HTMLkernel autotune

Autotune, End to End

How kernel autotuning is designed in Triton, used in aiter / quack / CuteDSL, and consumed by engines like SGLang — and from all of it, how to design FlyDSL's autotune, with a concrete implementation guide.

autotuneTritonFlyDSL
Primer · HTMLcompiler stack

From Python to Silicon

A systems primer for the path from Python to GPU execution: compiler layers, kernel boundaries, IR, runtime dispatch, and what each layer is responsible for.

compilerMLIR/LLVMISA
Primerattention

Attention Mechanisms

Full, Sparse, and Linear attention from first principles — up through DeepSeek NSA and Gated Linear Attention, with the tradeoffs that decide each one.

attentionsparselinear
Primerinference

KV Cache & Model Weights

The first thing to understand before optimizing inference: what KV cache is, how it differs from model weights, and how each scales with sequence and batch.

inferenceKV cacheLLM
PrimerGPU memory

LLM GPU Memory Calculation

How to actually compute LLM memory on a GPU — the components, worked 7B/70B examples, and how DP / TP / PP / EP and ZeRO change the arithmetic.

GPUmemoryparallelism
Guidepost-training

SFT & RL Training Guide

A first-principles guide to SFT and RL post-training: loss and label masking, dataset construction, hyperparameters, RLHF, and the common pitfalls.

SFTRLRLHF
Primertransformer

Transformer Deep Dive

The Transformer rebuilt from three angles at once — the math, runnable PyTorch, and the design rationale behind self-attention, LayerNorm, and the MLP.

transformermathcode
04

Blog

博客 · original writing — benchmarks, framework comparisons, and project notes
7 posts
AnalysisPD · monokernel

Disaggregation Is Not a Kernel

Why PD disaggregation alone did not speed up GLM-5.3 decode on MI355X, what it took to run AMD monokernels on a MoRI decode server, and why two plain replicas on the same GPUs still win on InferenceX AgentX.

PD disaggregationmonokernelMI355X
Benchmarklaunch tuning

Kimi-K3 × DSpark on MI355X

A 450-minute launch-parameter search plus an 18-point characterisation of the winning recipe — why every throughput decision reduces to accepted tokens over step latency.

spec decodingbenchmarkMI355X
Benchmarkspec decoding

Qwen3-Coder × EAGLE3

A measured benchmark of EAGLE3 speculative decoding on Qwen3-Coder-30B-A3B — where the 1.87× speedup comes from and why code generation benefits most.

spec decodingbenchmarkSGLang
ComparisonRL frameworks

NeMo-RL vs slime

A working comparison of two RL post-training frameworks — algorithms, engineering quality, MoE support, and ROCm fit — with a reasoned pick for MI300X / MI355X.

RLtrainingframework
ProjectRL · kernels

TritonForge

Building a server-based, multi-turn RL system that generates Triton kernels across NVIDIA and AMD — architecture, SFT+RL methodology, results, and roadmap.

RLTritonkernel
NoteFlyDSL

BasisAttr · beneath Layout

A follow-up note beneath the FlyDSL layout algebra: what BasisAttr and Fly_Basis are, why layouts need them, and where to start completing the surface.

FlyDSLMLIRlayout
AnalysisMoE RL · long-context

Long-Sequence MoE RL

A first-principles read of Yan Bai's 128K-context MoE RL recipe — Path B recompute, linear cross-entropy, FSDP2, chunked EP overlap — re-derived, fact-checked, and mapped onto MI300X / MI355X.

RLMoEAMD
05

Experiments

实验记录 · reproducible kernel and system measurements — raw data archived alongside the write-up
8 records
ExperimentNo. 008

One decision, one decider: redesigning the FlyDSL compiler for agents

In FlyDSL, two parties decide register use and instruction order: the kernel author and LLVM. We tested what this costs with 29 experiments on MI355X GPUs. When LLVM made one of these decisions instead of the author, six kernels became 5–16% slower, and two kernels gave wrong results. The post explains each term for readers without a compiler background, and proposes one decider for each decision.

FlyDSLcompiler designMI355XFlyBench
ExperimentNo. 007

PD × monokernel: GLM-5.3 on MI355X

AMD monokernels on a MoRI PD decode server lift per-user decode from 213 to 474 tok/s at concurrency 1, with GSM8K unchanged. On the same 16 GPUs, two plain replicas still beat 1P1D on AgentX: 95% prefix-cache hits leave the prefill node idle. The lever is monokernel coverage, 35% of decode steps at concurrency 10; widening the kernel to 12 rows is blocked at the MoE down stage.

GLM-5.3PD disaggregationmonokernelInferenceX AgentX
ExperimentNo. 006

GLM-5.3 monokernel hill-climbing on MI355X: a retrospective

Five sgl-amd-mono PRs built the glm53 monokernel. An ablation on InferenceX AgentX shows what each one added: #15 alone was slower above 192k tokens, #24 and #42 cut ITL by about 30% at all context lengths, and #60 turned that into a score gain on the FP8 recipe. Final: +15–19% throughput at concurrency 1–4 over 3600 s.

GLM-5.3MI355XmonokernelInferenceX AgentX
ExperimentNo. 005

GB300 vs MI355X, one token at a time

DeepSeek-V4.1 Flash at BS=1 on SGLang: a 4.61 ms GB300 verify cycle against 9.15 ms on MI355X. Turning off GB300's side streams takes it to 7.34 ms, so 60% of the gap is stream concurrency that HIP graphs make expensive; most of the rest is MoE and attention kernel time, and a 30% swing on GB300 turned out to be CPU placement.

DeepSeek-V4.1GB300 / MI355Xstream concurrencyNUMA placement
ExperimentNo. 004

GLM-5.3 MXFP4: one gate missed by 0.0202 pp

A gated FP8 / MXFP4 A/B on 8x MI355X, stopped at a case boundary with one half finished. Flash MXFP4 returns 99.53% of the correct answers at 92% of the throughput, and breaches the truncation ceiling by one part in a hundred — on a 198-row set whose measurable grid cannot express that ceiling at all.

GLM-5.3MXFP4MI355Xquantization A/B
ExperimentNo. 003

Faster kernels, slower engine: TokenSpeed vs SGLang on Kimi-K3

TokenSpeed uses 17.6% less non-collective device time in graph-off traces, yet is 1.14x slower in graph-on batch-1 serving and about 3.7x slower at concurrency 8/32. Pinned code links and three follow-up experiments separate what the data proves from the leading host, scheduler and FlatKV hypotheses.

TokenSpeedGluon vs AITERMI355Xkernel trace
ExperimentNo. 002

Kimi-K3: three of every four layers are linear

Attributing decode and prefill GPU time to KDA, full attention and MoE across 1K–1M context on 8x MI355X — 74% of the layers turn out to cost 9–24% of the time, and a KDA layer is only the cheaper of the two above ~4K decode / ~8K prefill.

Kimi-K3linear attentionMI355Xthread trace
ExperimentNo. 001

Quack RMSNorm on H100 & H200

A tuned and un-tuned sweep of Quack's CuTe DSL RMSNorm forward and backward kernels across 90 cells on two idle Hopper GPUs — and why the analytical config ladder gives up 17% on the widest backward row.

CuTe DSLRMSNormH100 / H200autotune
06

Sync

日常同步 · numbered result-driven status entries — merged work, blockers, and open questions, counted from live GitHub data
1 entry
PR TrackerEntry 001

Open Source PR Tracker · Aug 19 → 26, 2026

Fifty pull requests across thirteen repositories on one board — landed, in flight, blocked, parked for a decision — grouped by the thread each advances, with why it exists and the single next step. The Softmax family on gfx950 is complete; the review harness found real bugs in four repos; eleven PRs wait mostly on people, not code. State and numbers refresh from GitHub nightly.

status board13 reposlive GitHub data

Code, Paper, Experiments & Sync open as self-contained HTML pages (each carries its own EN / ZH toggle). Tutorial & Blog open as bilingual blog pages. Search across everything, or filter by shelf. Try: MLIR, ATT, MoE, PagedAttention, agent RL, GF(2), RLHF, Codex, RMSNorm.