Repository navigation
[Doc][TPU] Update TPU docs for TorchTPU, MPMD, and RL workloads - #66991
Conversation
…mentGroup, and RL Signed-off-by: Ryan O'Leary <[email protected]>
Signed-off-by: Ryan O'Leary <[email protected]>
Signed-off-by: Ryan O'Leary <[email protected]>
… doc structure Signed-off-by: Ryan O'Leary <[email protected]>
Signed-off-by: Ryan O'Leary <[email protected]>
Signed-off-by: Ryan O'Leary <[email protected]>
Manual TestingVerified the KubeRay manifests and code snippets on TPU v6e ( 1. KubeRay
|
5ea288b to
444f0bc
Compare
| - [TPUs in GKE](https://cloud.google.com/kubernetes-engine/docs/how-to/tpus) | ||
| - [TPU regions and zones](https://cloud.google.com/tpu/docs/regions-zones) | ||
| - [Cloud TPU system architecture](https://cloud.google.com/tpu/docs/system-architecture-tpu-vm) | ||
| - [Train a model on multi-host TPUs with Ray Train and TorchTPU](https://docs.cloud.google.com/kubernetes-engine/docs/tutorials/train-models-tpu-ray-torchtpu) |
There was a problem hiding this comment.
these guides are not public yet but will be before this is merged
…ER_CHIP on head Signed-off-by: Ryan O'Leary <[email protected]>
444f0bc to
b78d4b5
Compare
|
cc: @dstrodtman TPU docs update to cover the support added in the last few releases ahead of PyTorch conference. @liulehui PTAL at the relevant Train docs changes if you have time |
There was a problem hiding this comment.
Code Review
This pull request updates the documentation and code examples for running Ray and KubeRay on Google Cloud TPUs, specifically introducing support and configurations for TPU v6e and TPU7x. It covers SPMD/MPMD workloads, GKE node pool options, the SlicePlacementGroup scheduling utility, reinforcement learning patterns, and new TPU system metrics. The review feedback identifies several critical issues in the examples: the use of non-existent Ray versions (such as 2.59.0 and 2.58.0) which will cause deployment failures, and references to a non-existent model (Qwen/Qwen3-8B) which should be updated to a valid model like Qwen/Qwen2.5-7B-Instruct to ensure the examples are functional.
Signed-off-by: Ryan O'Leary <[email protected]>
e065807 to
f1dba2e
Compare
Signed-off-by: Ryan O'Leary <[email protected]>
| ``` | ||
|
|
||
|
|
||
| ## Multi-Host TPU autoscaling |
There was a problem hiding this comment.
Can we generalize this section to talk about TPU autoscaling in general and have a subsection on how multi-host autoscaling works?
There was a problem hiding this comment.
added a section below detailing autoscaling
Signed-off-by: Ryan O'Leary <[email protected]>
… GKE gcloud flags Signed-off-by: Ryan O'Leary <[email protected]>
…U intro Signed-off-by: Ryan O'Leary <[email protected]>
Signed-off-by: Ryan O'Leary <[email protected]>
Signed-off-by: Ryan O'Leary <[email protected]>
|
Fixed the outstanding comments and notes from offline discussion, should be ready to merge once CI passes cc: @andrewsykim @dstrodtman |
## Description A style and grammar pass on the prose that #66991 added to the TPU docs, against [Ray's writing-style guide](https://docs.ray.io/en/master/ray-contribute/writing-style.html). #66991 merged before the docs team could review it, so these edits land as a follow-up instead of review suggestions. The edits are scoped to the lines #66991 added. Other text on these pages is unchanged. The changes fall into these categories: - Long multi-clause sentences split into shorter ones. - Acronyms defined on first use, such as MPMD on the scheduling page. GKE is no longer defined twice on the KubeRay TPU page. - Lead-ins fixed so that each colon introduces the list, tab set, or code block that follows it, and a missing lead-in added before the TorchTPU training example. - Second person and present tense in place of a few passive or past-tense constructions. No technical claim, value, flag, code block, label, or link target changes. ### How meaning was checked Every changed sentence was compared with its original for semantic drift. The check verified each claim against the Ray source and the doc examples at this commit. It found two edits that had changed a claim, and both are fixed in this PR: - On the scheduling page, splitting a sentence had separated "On TPU7x" from the `RAY_TPU_RESOURCE_PER_CHIP=2` instruction. The instruction now says "on TPU7x" explicitly. - On the KubeRay TPU page, moving "For larger workloads" to the start of a sentence made multi-host scale-down sound conditional. The original scope is restored. Two edits add or reword descriptions of example code. Both were checked against the code: - The new TorchTPU lead-in says the example "runs one training step with TorchTPU on 16 per-device workers". The example makes a single `optimizer.step()` call with `num_workers=16` and `resources_per_worker={"TPU": 1}`. - On the Serve LLM TPU page, "This example serves `google/gemma-4-31B-it`" now names the vLLM-TPU example. That tab is the only one that uses that model. ## Questions for maintainers These are pre-existing issues the check surfaced. This PR doesn't change any of them: 1. **`system-metrics.md`:** The sentence "Exported on Google Cloud TPU nodes when the GKE TPU device plugin metric server is active" appears only on the `ray_tpu_tensorcore_utilization` row. In `reporter_agent.py`, all five `ray_tpu_*` gauges come from the same device-plugin scrape, and none are emitted when `TPU_DEVICE_PLUGIN_ADDR` is unset. Should the condition move to a lead-in that covers all five rows? Separately, a source comment says some TPU types don't report runtime metrics. On those types, `duty_cycle`, `memory_used`, and `memory_total` read 0. Is that worth documenting? 1. **`serve/llm/user-guides/tpu.md`:** The instruction "Set `model_source` to a local or mounted model path, or another path that all TPU hosts can read" sits between the descriptions of the two examples. The vLLM-TorchTPU example uses the Hugging Face ID `Qwen/Qwen3-8B`. Does the shared-path requirement apply only to vLLM-TPU, or to both engines? ## Additional information This PR was prepared with AI assistance (Claude Code) and reviewed by a human, who stands behind every change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
## Why are these changes needed? A rolling batch of small, independent docs fixes. Ray's `AGENTS.md` permits mechanical cleanups when they're bundled rather than opened one per PR, so they collect here. Each fix is its own commit, so a reviewer can drop any one without disturbing the rest. This stays a draft while it collects fixes. ### Fixes - **Show the never-run TorchTPU example as a plain code block** (`train/user-guides/using-accelerators.md`). #66991 added the TorchTPU example as a `testcode` block with `:skipif: True`. Since #66974, `writing-code-snippets.md` says not to do that, because the block never runs but reads as tested code. It's now a plain `python` block, like the JAX TPU example above it. It was the last `:skipif: True` block under `doc/source/`. - **Fix the broken PyTorch Neuron setup link** (`serve/tutorials/aws-neuron-core-inference-stable-diffusion.md`). AWS moved the Neuron setup page, so `frameworks/torch/torch-setup.html` returns 404 and the scheduled docs link check flags it. The link now points at `setup/torch-neuronx.html`, which the sibling `aws-neuron-core-inference.md` tutorial already uses. - **Link the GIL to the Python glossary** (`core/actors/async-api.md`). The Python wiki dropped its `/moin/` paths, so `wiki.python.org/moin/GlobalInterpreterLock` returns 404. The link now goes to the glossary entry in the official Python docs, `docs.python.org/3/glossary.html#term-global-interpreter-lock`. ## Related issue number None. ## Duplicate check Not a duplicate. `gh pr list --repo ray-project/ray --state open --search "using-accelerators skipif"` returns nothing, and #67194, which restyled the same TPU pages, left this block as it was. ## Testing - Both new link targets return 200, and the glossary page contains the `term-global-interpreter-lock` anchor. The two old URLs return 404. - `python doc/test_prose_doctest_targets.py` passes: "74 listed pages; every runnable page is accounted for." The page still has other runnable blocks, so it stays in `doctest[train-gpu]`. - `git grep -n skipif -- doc/source` now finds only the guide's instruction not to use it. - Extracting the page's examples is unaffected for runnable blocks: pytest-sphinx drops a `:skipif: True` block before it builds an example, so this block was never collected. - `pre-commit` passes on the changed file. AI assistance (Claude Code) was used to find and make these fixes. I reviewed every changed line. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Why are these changes needed?
Updates the Ray TPU documentation to cover per-device execution (
{"TPU": 1}) with TorchTPU, TPU v6e and TPU7x (Ironwood) cluster setup, MPMD and reinforcement learning (RL) scheduling, and TPU observability metrics:doc/source/kuberay/user-guides/tpu.md,gcp-gke-tpu-cluster.md,accelerators.md): Documents host-level ({"TPU": 4}, JAX / vLLM-TPU) vs. per-device ({"TPU": 1}, TorchTPU / vLLM-TorchTPU) scheduling,RAY_TPU_RESOURCE_PER_CHIP=2for dual-chiplet TPU7x hosts, GKE node pool setup for TPU v6e and TPU7x (including consumption options and multi-NIC DRANET networking),kuberay-tpu-webhook(v1.4.0+) environment variables,slice_placement_group+run_on_sliceexamples, and disaggregated vs. colocated RL architectures.doc/source/train/user-guides/using-accelerators.md): AddsTorchTrainerexamples on TPUs using thetpu_dist(TorchTPU) backend andresources_per_worker={"TPU": 1}.doc/source/serve/llm/user-guides/tpu.md,serve_tpu_multihost.py): Adds multi-host serving configuration and examples for vLLM-TorchTPU (placement_group_config={"bundle_per_worker": {"TPU": 1}}) alongside vLLM-TPU.doc/source/ray-observability/reference/system-metrics.md): Documents the five TPU system metrics (ray_tpu_tensorcore_utilization,ray_tpu_memory_bandwidth_utilization,ray_tpu_duty_cycle,ray_tpu_memory_used,ray_tpu_memory_total).Related issue number
#64055
Checks
Signed-off-by: ...)scripts/format.shto lint the changes in this PR.