Skip to content

docs(user): wire the Distributed Programming chapter into the manual - #2221

Merged
YunjiQin merged 1 commit into
hw-native-sys:mainfrom
georgebisbas:docs/pr4-wire-chapters
Aug 6, 2026
Merged

docs(user): wire the Distributed Programming chapter into the manual#2221
YunjiQin merged 1 commit into
hw-native-sys:mainfrom
georgebisbas:docs/pr4-wire-chapters

Conversation

@georgebisbas

@georgebisbas georgebisbas commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Split out of #2162 — the final piece of the split, wiring the Distributed Programming chapter into the existing manual:

  • index.md (+ zh): new Contents/capability-table rows for the distributed chapter, a 4th reading path ("I want to run across multiple devices"), dropped the now-superseded dev-doc pointer for distributed collectives in favor of the real chapter.
  • 00-getting_started.md (+ zh): short pointer paragraphs from the existing benchmark/distributed sections into the distributed chapter.
  • 02-operation_reference.md (+ zh): new "Distributed / Collective Operations" capability matrix, cross-linking into the distributed chapter.
  • distributed/01-collectives.md (+ zh): accuracy fixes to the merged chapter — the HOST builtin path now also lowers mode="ring" (merged in feat(distributed): host-orchestrated ring allreduce with builtin.tensor.allreduce_ring #2094), so the "HOST builtin is mesh-only / ring is InCore-only" claims are corrected; HOST ring is Sum+FP32-only with signal [2*(NR-1)+1, NR], and test_l3_host_tensor_allreduce_ring.py is listed as the runnable host-ring example.

Scope note: Distributed chapter only

This PR originally also wired the Performance & Benchmarking chapter. That chapter's PR #2220 was closed unmerged (2026-07-31), so the performance/* pages do not exist on main. The dangling performance/* links introduced here were dropped (both index.md and 00-getting_started.md), so mkdocs build --strict passes on this branch alone. The Performance chapter can be re-wired in a follow-up once it lands under a new vehicle.

Verification

  • npx markdownlint-cli2 --config tests/lint/.markdownlint.yaml — pass
  • python3 tests/lint/check_docs_en_zh_parity.py — pass
  • python3 tests/lint/check_docs_nav.py — pass
  • pre-commit run --files <changed files> — pass
  • mkdocs build --strict — passes on this branch alone: all performance/* links removed and every remaining link in the touched files resolves (verified with a link scan; the distributed/ chapter exists on main via docs(user): add the Distributed Programming chapter #2219).

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2b653ba7-c113-4ab5-8043-184d3abdfbee

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The user manual adds distributed programming examples, collective-operation references, benchmarking guidance, and updated navigation in English and Chinese.

Changes

User manual documentation

Layer / File(s) Summary
Getting-started distributed and performance guides
docs/en/user/00-getting_started.md, docs/zh/user/00-getting_started.md
Adds benchmarking references and mesh allreduce examples with distributed tensors, rank coordination, remote loads, accumulation, and output staging.
Collective operation reference
docs/en/user/02-operation_reference.md, docs/zh/user/02-operation_reference.md
Documents the pld.* distributed and collective APIs and their supported modes, reductions, atomics, data types, and operational constraints.
Manual navigation and capability updates
docs/en/user/index.md, docs/zh/user/index.md
Adds distributed programming and performance reading paths, contents entries, capability entries, and updated documentation references.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Poem

A rabbit hops through ranks in flight,
With allreduce sums aligned just right.
It links the guides from page to page,
And maps each collective on the stage.
Performance notes now greet the light.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly describes the primary change: integrating the Distributed Programming chapter into the user manual.
Description check ✅ Passed The description accurately explains the documentation updates, scope, dependencies, and validation results.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/en/user/00-getting_started.md`:
- Around line 271-320: Clarify before or after the HelloAllReduce snippet that
it is only the device-side InCore function and is not a complete runnable
program. State that a host orchestrator, ir.compile, and distributed worker
setup are omitted, matching the limitation documented in the Chinese
counterpart.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 41f3f0b4-e821-4ea6-85ff-41d4f6f7c769

📥 Commits

Reviewing files that changed from the base of the PR and between 4389165 and d7944f0.

📒 Files selected for processing (6)
  • docs/en/user/00-getting_started.md
  • docs/en/user/02-operation_reference.md
  • docs/en/user/index.md
  • docs/zh/user/00-getting_started.md
  • docs/zh/user/02-operation_reference.md
  • docs/zh/user/index.md

Comment thread docs/en/user/00-getting_started.md

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d7944f0209

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread docs/en/user/00-getting_started.md Outdated

### Benchmarking (`benchmark`)

The full benchmarking guide is at [performance/00-methodology.md](performance/00-methodology.md)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid linking to absent performance pages

In this worktree there is no docs/en/user/performance/ or docs/zh/user/performance/ page set (rg --files docs | rg '/performance/' returns nothing), but this commit adds links to performance/00-methodology.md, performance/index.md, and performance/02-distributed.md from both EN and ZH user docs. Until the performance chapter is added in the same branch or these links are kept as non-links, the user manual has dead links and strict docs builds will fail on this commit by itself.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed: the dangling performance/* links were removed from the en/zh index and getting-started pages (the Performance chapter PR #2220 was closed unmerged). mkdocs build --strict now passes on this branch alone.

Comment thread docs/en/user/02-operation_reference.md Outdated

| Operation | API | Modes | ReduceOp | Atomic | Supported dtypes | Notes |
| --------- | --- | ----- | -------- | ------ | ---------------- | ----- |
| AllReduce | `pld.tensor.allreduce` | `mesh` (InCore + HOST), `ring` (InCore only) | `Sum`, `Max`, `Min`, `Prod` | — | FP16, FP32 — a hard compile-time check (`allreduce.cpp`), both InCore and HOST | Mesh: O(N) remote traffic. Ring: O(N/P) traffic, 2(P-1) steps; currently InCore-only. |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include HOST ring allreduce in the matrix

For HOST orchestrator code, pld.tensor.allreduce(..., mode="ring") is supported and lowers to builtin.tensor.allreduce_ring (covered by tests/ut/ir/transforms/test_lower_host_tensor_collectives.py::test_host_allreduce_ring_lowers_to_ring_builtin), with explicit signal and Sum/FP32 constraints documented in the DSL docstring. This new operation matrix instead says ring is InCore-only, so users consulting the operation reference will incorrectly conclude valid HOST ring allreduce programs are unsupported.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed: the AllReduce matrix row now lists ring as InCore + HOST, notes the HOST ring variant is Sum+FP32 only (4-byte) with signal [2*(NR-1)+1, NR], and references #2094.

@georgebisbas georgebisbas changed the title docs(user): wire the Distributed and Performance chapters into the manual docs(user): wire the Distributed Programming chapter into the manual Aug 3, 2026

@YunjiQin YunjiQin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs-only review. I verified the rest of the diff against origin/main sources and it holds up: the HOST ring Sum+FP32 narrowing matches CheckSupportedSumFp32BuiltinVariant, the [2*(NR-1)+1, NR] signal shape matches DeduceBuiltinTensorAllReduceRingType, the per-collective builtin dtype claims match the builtin.tensor.* deducers in src/ir/op/distributed/collective.cpp, the NotifyOp / WaitCmp / AtomicType values match ir.pyi, and the Hello World matches tests/st/distributed/collectives/test_l3_allreduce.py verbatim. test_l3_host_tensor_allreduce_ring.py and the whole user/distributed/ chapter are on main, so every link here resolves.

Three things to fix before merge.

1. index.md drops the performance-chapter placeholder (en + zh)

The "What is not here yet" intro went from "tutorials, distributed programming, performance optimization, and accuracy debugging each get their own chapter" to "tutorials and accuracy debugging". Dropping distributed programming is right; dropping performance optimization is not — #2220 was closed unmerged, so that chapter still does not exist, and the reading path higher up in the same file still says "The dedicated performance chapter is not written yet". As it stands the file contradicts itself.

  • docs/en/user/index.md: — tutorials and accuracy debugging each get their own chapter— tutorials, performance optimization, and accuracy debugging each get their own chapter
  • docs/zh/user/index.md: —— 教程、精度定位各自成章—— 教程、性能优化、精度定位各自成章

2. Capability matrix drops the "per step" qualifier on the traffic figures (en + zh)

The new AllReduce row in 02-operation_reference.md says:

Mesh: O(N) remote traffic. Ring: O(N/P) traffic, 2(P-1) steps.

distributed/01-collectives.md — the page this matrix links into — qualifies both as per-step (O(N) remote traffic per step, O(N/P) remote traffic per step, and the table header Remote traffic per step). Without the qualifier, O(N/P) sitting immediately next to "2(P-1) steps" reads as ring's total traffic, which is really ~2N per rank. Please match the chapter's wording so the two pages agree:

Mesh: O(N) per step. Ring: O(N/P) per step, 2(P-1) steps.

3. The user-manual matrix cites an internal C++ file and a PR number (en + zh)

Same AllReduce row: hard compile-time check in `allreduce.cpp` and HOST ring builtin merged (#2094). A user-manual reader can neither verify nor act on either, and both go stale — the file on a refactor, the PR reference once the change is just part of a release. Suggest FP16, FP32 (mesh; hard compile-time check) and dropping the (#2094) clause; the implementation-side detail already lives in the dev docs.


Separately, and not blocking this PR: now that the HOST column advertises ring, the manual has no place stating the remaining host-ring constraints — NR ≤ 16, a statically-known src shape (no dynamic extents), and numel divisible by NR, all enforced in collective.cpp / lower_host_tensor_collectives_pass.cpp. The existing "compile-time-known NR" note in 01-collectives.md sits in the InCore-composite context only. That reads like a gap in the distributed chapter itself rather than in this wiring PR, so I'll raise it on its own.

@georgebisbas

Copy link
Copy Markdown
Contributor Author

Addressed — commit 81028522:

  1. Restored "performance optimization" to the "What is not here yet" intro (en + zh).
  2. AllReduce traffic figures now qualified per step, matching distributed/01-collectives.md (en + zh).
  3. Dropped the allreduce.cpp / #2094 references from the user-manual matrix (en + zh).

Thanks for verifying the rest of the diff against origin/main.

@georgebisbas
georgebisbas requested a review from YunjiQin August 5, 2026 12:29
@georgebisbas
georgebisbas force-pushed the docs/pr4-wire-chapters branch 2 times, most recently from 3b7883d to 9c22265 Compare August 6, 2026 09:33
- Add the distributed reading path plus Contents and capability rows to
  the user-manual index (en + zh), replacing the dev-doc distributed
  pointer
- Point the getting-started distributed section at the chapter with a
  mesh allreduce Hello World (InCore kernel form)
- Add the pld.* collective capability matrix to the ops catalog's
  Distributed section (en + zh), cross-linking the distributed chapter
- Fix HOST-builtin ring allreduce claims: Sum + FP32 only with signal
  [2*(NR-1)+1, NR]; ring is no longer InCore-only
- Drop dangling performance/* links (the performance chapter PR closed
  unmerged) and keep the performance placeholder in "What is not here
  yet"
@georgebisbas
georgebisbas force-pushed the docs/pr4-wire-chapters branch from 9c22265 to 40db420 Compare August 6, 2026 09:36
@YunjiQin
YunjiQin merged commit bf61c8d into hw-native-sys:main Aug 6, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants