9 Commits

Author SHA1 Message Date
Vijay Janapa Reddi
0a4b3520ca build(tinytorch/pdf): single-source deps via requirements files
CI workflows repeated a ~20-line tlmgr install block inline. Consolidate
to two requirements files that work locally and in CI:
  pdf/apt-requirements.txt - system packages (librsvg2-bin)
  pdf/tex-requirements.txt - 24 TeX packages

New Makefile target 'make install-deps' reads both files, calling
apt-get + tlmgr. Skips sections when the tool is not on PATH (no-op
on macOS, effective on Ubuntu CI).

CI workflows simplified to 'make install-deps && make pdf', matching
local dev exactly. Adding a dependency now means editing one file,
not two.
2026-04-23 15:09:44 -04:00
Vijay Janapa Reddi
0e1f1caae7 build(tinytorch/pdf): make clean also removes root-level *_files dirs
Quarto's post-render cleanup leaves *_files/ auxiliary dirs around
when chapter sources live outside the project root (our case:
pdf/_quarto.yml references ../modules/*.qmd). These accumulated
at both pdf/modules/*_files and pdf/getting-started_files etc.
Add a rm -rf *_files to the Quarto project's root so all stale
auxiliary dirs get cleaned with one command.
2026-04-23 14:22:46 -04:00
Vijay Janapa Reddi
a79cd272aa build(tinytorch/pdf): guarantee single canonical PDF at pdf/_build/
The user was confused about which PDF was 'official' when Quarto's
post-render cleanup error occasionally left a stray copy at the
top-level pdf/ dir. This tightens the Makefile so every build ends
with exactly ONE TinyTorch-Guide.pdf:

  - pre-build: rm -f pdf/TinyTorch-Guide.pdf (stray from past runs)
  - post-build: if top-level copy exists after _build/ produced one,
                rm it — _build/ is authoritative
  - end banner: prominently prints
      FINAL PDF (the only shippable file):
      pdf/_build/TinyTorch-Guide.pdf (X.XM)
    in a box — impossible to miss

make clean also upgraded to remove pdf/.quarto/ cache and any
index.tex/log/aux intermediates, so a full reset leaves zero PDFs
anywhere in the repo. .gitignore already covers all these; the
Makefile changes only affect local filesystem state.
2026-04-23 14:20:06 -04:00
Vijay Janapa Reddi
350f347baf fix(tinytorch/pdf): Makefile self-heal — move comments out of recipe
The mid-recipe '# ...' lines were being consumed as part of the joined
shell command (via backslash-newline continuation) and masked the
self-heal mv. Move the explanatory comment above the recipe so Make
recipe body is pure shell.
2026-04-23 13:36:18 -04:00
Vijay Janapa Reddi
32b13f39ff polish(tinytorch/pdf): professional lab-book preamble (Wave 1)
- Running headers: verso shows 'Chapter N · Title' on outer-left, recto
    shows 'N.M · Section' on outer-right, small caps navy. Wordmark
    centered. Page numbers on outer-edge in footer. Follows H&P / CLRS /
    Swift Book convention.

  - Book-style paragraph typography: parskip=0pt plus 0.5pt, parindent=1.2em.
    First-line indent instead of web-style paragraph gaps.

  - List of Figures + List of Tables: lof: true / lot: true in YAML front
    matter. One page each, makes 350-page guide's figures navigable.

  - Callout title convention documented in preamble comment. Six types
    keyed off emoji prefix (Check Your Understanding , Systems
    Implication , Historical Context 📚, Exercise 🎯, Pitfall ⚠️,
    Checkpoint 🚦). Reuses Quarto's 5 shipped classes; no new LaTeX.

  - Makefile self-heal: when Quarto post-render cleanup errors and
    leaves the PDF at top-level pdf/ instead of pdf/_build/, detect
    and move it to the canonical location.
2026-04-23 13:15:29 -04:00
Vijay Janapa Reddi
b2b9ee4fff chore(tinytorch/pdf): drop duplicate top-level PDF copy; use _build/ only
The Makefile was copying pdf/_build/TinyTorch-Guide.pdf up to
pdf/TinyTorch-Guide.pdf as "local-dev convenience" so `open
pdf/TinyTorch-Guide.pdf` would work. This created two copies of the
same artifact at different paths — confusing when the user asked which
was authoritative.

Simplify to a single source of truth at pdf/_build/TinyTorch-Guide.pdf:

  - Makefile: remove the `cp "$(PDF_BUILD)" "$(PDF_OUT)"` step. PDF_OUT
    now IS the _build path. Help text and distclean target updated
    accordingly.
  - tools/measure-pdf-images.py: default PDF path updated from
    pdf/TinyTorch-Guide.pdf to pdf/_build/TinyTorch-Guide.pdf.

CI workflows (tinytorch-build-pdfs.yml and tinytorch-update-pdfs.yml)
already point at pdf/_build/TinyTorch-Guide.pdf from the earlier
consistency pass (commit 7d9eab7ed era), so they're unaffected.

Local dev uses `open pdf/_build/TinyTorch-Guide.pdf` or an `open`
wrapper — one extra path segment, zero ambiguity about which file is
the real artifact.
2026-04-23 09:13:06 -04:00
Vijay Janapa Reddi
bedec16f5a Merge tinytorch-updates into dev 2026-04-22 18:20:55 -04:00
Vijay Janapa Reddi
35d02d8d7e polish(tinytorch/pdf): fix PDF output path + swap mermaid journey for SVG
Makefile:
- pdf/_quarto.yml writes to pdf/_build/ (via output-dir). The publish
  workflow (tinytorch-publish-live.yml) expects the artifact at the
  stable path pdf/TinyTorch-Guide.pdf. Copy _build/TinyTorch-Guide.pdf
  up to pdf/ after render so publish finds it.

getting-started.qmd:
- Replace the mermaid "Your TinyTorch Journey" graph with a figure div
  embedding 00_journey-diag-1.svg. Mermaid renders inconsistently in
  the PDF pipeline; a hand-authored SVG gives identical output across
  HTML and PDF and matches the book's figure grammar.

Diagrams:
- 00_journey-diag-1.svg: new 5-stage journey diagram (Install → Setup
  → Start → Complete → Milestone) with feedback loop back to Start.
- 00_big-picture-module-flow.svg: three-panel overview (Foundation,
  Architecture, Optimization) leading to Capstone. Staged for a
  future big-picture chapter; not yet referenced.

Style-guide conformance for both SVGs is a follow-up pass.
2026-04-22 18:06:52 -04:00
Vijay Janapa Reddi
edbea966bf refactor(tinytorch): rename site-quarto/ to quarto/
Brings the TinyTorch lab guide's Quarto project in line with
book/quarto/, the only other in-tree Quarto publication that builds
both web and PDF outputs from a single source. The previous name had
three redundancies:

  - already under tinytorch/, so "site-" prefix wasn't disambiguating
  - also produces the PDF lab guide, so "site-" was misleading
  - the top-level site/ dir made "site-quarto" read as "the site's
    quarto config" rather than "the tinytorch site, in quarto"

After this rename the convention is straightforward:

  book/quarto/        -> the textbook (web + PDF)
  tinytorch/quarto/   -> the TinyTorch lab guide (web + PDF)
  mlsysim/docs/       -> mlsysim API reference (kept as docs/, since it
                        really is API reference, not a publication)

Touches 7 GitHub workflows, both .gitignore files, the rename target's
own self-references (Makefile, _quarto.yml configs, STYLE.md,
measure-pdf-images.py), and 6 copies of subscribe-modal.js plus a few
shared scripts/configs whose comments documented the old path.

Verified: rebuilt pdf/TinyTorch-Guide.pdf (2.1M) cleanly from the new
location with 'make pdf' from tinytorch/quarto/.
2026-04-22 14:38:18 -04:00