Files
Vijay Janapa Reddi af79ff3edd Add formal algorithm blocks and the pseudocode extension that renders them
Introduce 13 LaTeX-typeset algorithm blocks across 8 chapters (Adam update,
gradient checkpointing, FlashAttention, backpropagation, mini-batch SGD,
reverse-mode AD, PTQ calibration, tiled GEMM, ring all-reduce, 1F1B pipeline,
continuous-batching scheduler, speculative decoding, power-of-two routing),
each integrated into existing prose with a motivating lead-in and a
systems-consequence follow-up.

Extension (book/quarto/_extensions/mlsysbook-ext/pseudocode):
- Vendored under the owned mlsysbook-ext/ namespace (moved from leovan/,
  version -mlsysbook-custom) and wired into the html, pdf, and epub filters.
- MIT Press cross-ref casing: @algo- -> 'algorithm N' mid-sentence,
  @Algo- -> 'Algorithm N' at sentence start.
- Right-aligned italic triangle comments (CLRS column convention).
- Static EPUB renderer (upstream supports only HTML via pseudocode.js and PDF
  via algpseudocodex; EPUB previously emitted raw \begin{algorithm}).
- Uses the algo- prefix: native @alg- collides with Quarto's algorithm theorem
  environment and FATALs the build.

Ref tooling (book/cli/commands): teach validate.py, bib.py, and info.py the
algo-/Algo- crossref prefix (LABEL_REF_PATTERN, EXCLUDED_CITATION_PREFIXES,
Algorithm label-def patterns, and a chunk-option label harvest that runs inside
the pseudocode fence) so check refs and check labels resolve @algo-/@Algo-
instead of misreading them as missing citations.

Verified rendering in HTML, PDF, and EPUB; check refs and check labels pass
book-wide.
2026-06-06 12:36:17 -04:00

1.7 KiB

MLSysBook Extensions

This directory contains Quarto extensions used by the MLSysBook project.

⚠️ CRITICAL WARNING - READ BEFORE MAKING CHANGES

Some extensions in this directory are HEAVILY CUSTOMIZED and should NEVER be reinstalled using quarto add.

🔍 Quick Safety Check

Before installing or updating any extension, ALWAYS check for:

  1. .CUSTOM_LOCK files in extension directories
  2. Version numbers ending in -mlsysbook-custom
  3. Warnings in extension _extension.yml files

📋 Extension Inventory

Extension Status Safe to Update?
`margin-video`🚫 **100% Custom**Never (MLSysBook only)
`mlsysbook-ext/pseudocode`🚫 **Customized** (casing, ▷ comments, EPUB)Never
`ute/custom-numbered-blocks`🚫 **Heavy Customization**Never
`nmfs-opensci/titlepage`🚫 **Customized**Never
`pandoc-ext/diagram` StandardYes
`quarto-ext/lightbox` StandardYes

🚨 Emergency Recovery

If you accidentally overwrote a custom extension:

# Check what changed
git status

# Restore from git if needed
git checkout HEAD -- book/_extensions/EXTENSION_NAME/

# Run protection check
python tools/scripts/check_custom_extensions.py

📚 Full Documentation

For complete details, see: CUSTOM_EXTENSIONS.md


When in doubt, DON'T reinstall - ask the team first!