Skip to content

[Docs] JAX, Pallas, and TPU execution architecture guide - #1

Draft
Tar-ive wants to merge 1 commit into
mainfrom
cursor/jax-pallas-architecture-guide-cb45
Draft

Tar-ive wants to merge 1 commit into
mainfrom
cursor/jax-pallas-architecture-guide-cb45

Conversation

@Tar-ive

@Tar-ive Tar-ive commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Adds a developer guide that explains why this repository is written in JAX and Pallas, what mathematics those languages encode, how they compile, and how the resulting programs run on a TPU.

Why

JAX (often heard as "Jacks") and Pallas (often heard as "Palace") are easy to treat as "just Python." In tpu-inference they are the whole lowering path: models and layers are JAX array programs; attention, MoE, and collectives are Pallas kernels; XLA and Mosaic (C++ compilers) emit TPU machine code. There was no single document that walked that path from transformer math down to the MXU.

What landed

  • New guide: docs/developer_guides/jax_pallas_architecture.md
    • Why these languages exist (two-language problem, systolic arrays, ragged inference)
    • The math they compute (einsum, RMSNorm, RoPE, online softmax / FlashAttention, MoE, GSPMD)
    • Where JAX stops and Pallas starts in this repo
    • Compilation: Python → jaxpr → StableHLO/HLO → XLA/Mosaic C++ → TPU VLIW (not generated C++ source)
    • Architecture-level execution: HBM/VMEM/SMEM, MXU, VPU, SparseCore, ICI, VLIW issue slots
    • A request walk through TPUWorkerCompilationManager → RPA
    • 15 diagrams
  • Wired into MkDocs nav (with Mermaid fences) and the docs home / JAX model-dev pages

Tests

Docs-only. No runtime tests. Mermaid is GitHub-native and enabled in MkDocs via pymdownx.superfences custom fences.

Open in Web Open in Cursor 

Explain why JAX and Pallas are used in tpu-inference, the linear-algebra
they encode, how they lower through XLA/Mosaic (C++ compilers) to TPU
machine code, and how kernels execute on the MXU, VMEM, SparseCore, and ICI.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: Saksham Adhikari <Tar-ive@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

2 participants