Skip to content

Make Week 2 follow measured bottlenecks - #157

Draft
skyzh wants to merge 7 commits into
mainfrom
skyzh/xcode-matvec-profile
Draft

Make Week 2 follow measured bottlenecks#157
skyzh wants to merge 7 commits into
mainfrom
skyzh/xcode-matvec-profile

Conversation

@skyzh

@skyzh skyzh commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Week 2 is meant to teach an evidence loop, but the chapters need more than an end-to-end number to justify each next step. The earlier operator runner measured implementations in fixed blocks, so GPU performance-state drift could consistently favor whichever implementation ran later. It also hid two dispatch decisions that did not survive a matched operator comparison.

This balances every readable, course, and MLX operator order and rotates kernel-group order before rerunning the complete progression. Each chapter from Day 2 onward now ends with the model throughput, operator latency, attribution profile, and selective Xcode evidence needed to choose the next bottleneck. Day 2 also teaches students how to capture the same counter tables and Shader Cost Graph for their own implementation.

The paired evidence changes two retained choices. Fused decode attention wins through context 128 but loses beyond that measured crossover, so the dispatch guard follows the data. Direct quantized embedding is slower than the readable packed row lookup at this checkpoint, so Week 2 drops it while Week 3 retains and tests it where the serving path uses the fused operator.

On the balanced M4 Pro run, the final 128-token Week 2 checkpoint reaches 95.4% of MLX prefill, 84.4% of MLX decode, and 85.3% of MLX output throughput. Split-K improves complete 32-token prefill by 11.9% and remains neutral at 128 tokens. The appendix attaches those fresh-process samples beside projection microbenchmarks, dependency-aware attribution, dispatch geometry, and the source-enabled Xcode matvec profile.

AI-assisted: Codex.

skyzh added 6 commits July 24, 2026 23:48
A single dispatch can leave Xcode without enough replay work for Pipeline Statistics. Capture a small repeated steady-state workload while keeping the same Qwen3-4B shape and kernel.

Assisted-by: Codex
The course now connects Xcode pipeline limiters to the exact masked W4 source lines, while preserving the measured streaming-memory floor in the performance appendix.

Assisted-by: Codex
Students can now reproduce the limiter tables and source-cost graph instead of treating the checked-in screenshots as unexplained evidence.

Assisted-by: Codex
Move fused model kernels before decode attention and make the cumulative checkpoints, tests, benchmark labels, and Week 3 prerequisites follow the same order.

Assisted-by: Codex
Operator benchmarks, kernel-group attribution, and GPU captures can now select tiny_llm directly and restrict operator work to the chapter a student has completed.

Assisted-by: Codex
@skyzh skyzh changed the title Make the Week 2 GPU profile reproducible Make Week 2 follow measured bottlenecks Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant