Skip to content

docs(coding-style): document orch output direction (pl.Out / pl.InOut)#669

Merged
zhangqi-chen merged 1 commit into
hw-native-sys:mainfrom
YunjiQin:docs/orch-output-direction
Jul 2, 2026
Merged

docs(coding-style): document orch output direction (pl.Out / pl.InOut)#669
zhangqi-chen merged 1 commit into
hw-native-sys:mainfrom
YunjiQin:docs/orch-output-direction

Conversation

@YunjiQin

@YunjiQin YunjiQin commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

What

Documents the orchestration-output direction convention applied in #659, so the rule lives in the canonical coding-style guide.

Adds a subsection "Output parameter direction: pl.Out / pl.InOut" to §1 of docs/pypto-coding-style.md:

  • Every golden-compared output must declare a direction on the orchestration entry — a plain pl.Tensor is In, so its device→host copy-back is skipped and the tensor reads back as all-zeros on the host (golden silently fails).
  • Direction is decided by the TensorSpec:
    • is_output=True, no init_value → pure output → pl.Out[...]
    • is_output=True + init_value → inout (read-modify-write cache/state) → pl.InOut[...]
  • Annotate the entry only; @pl.jit.inline sub-kernels keep bare pl.Tensor (direction is stripped at splice and warns). Entry pl.InOut + bare-pl.Tensor inline is the correct pairing.

Docs-only; includes a short attention_csa_test example.

🤖 Generated with Claude Code

Add a subsection to section 1 spelling out the rule this PR applies:
every golden-compared output must declare a direction on the orchestration
entry (plain pl.Tensor is In → copy-back skipped → reads back all-zeros),
chosen by the TensorSpec — pl.Out for pure outputs, pl.InOut for
is_output+init_value inout caches/state. Annotate the entry only; inline
sub-kernels keep bare pl.Tensor (direction stripped at splice, warns).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 16c38758-4b2b-45bc-9c9e-77c913c5608c

📥 Commits

Reviewing files that changed from the base of the PR and between 8104075 and 045a221.

📒 Files selected for processing (1)
  • docs/pypto-coding-style.md

📝 Walkthrough

Walkthrough

This change adds a new documentation subsection to docs/pypto-coding-style.md describing required tensor output direction annotations (pl.Out/pl.InOut) on orchestration entries, the failure mode for bare pl.Tensor parameters, inline sub-kernel behavior, and an example.

Changes

Documentation update

Layer / File(s) Summary
Output parameter direction documentation
docs/pypto-coding-style.md
Adds a subsection explaining pl.Out/pl.InOut requirements, the all-zeros failure mode for bare pl.Tensor, inline sub-kernel handling, and an attention_csa_test example.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Poem

A rabbit hops through docs anew,
Marking In, Out, and InOut too,
No more zeros hiding in the night,
Each tensor's path now clear and bright,
Hop hop, hooray, the guide's in sight! 🐇📘

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the docs update about orchestration output directions.
Description check ✅ Passed The description matches the documented change and explains the new coding-style guidance.
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.

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the docs/pypto-coding-style.md documentation by adding a new section on output parameter direction using pl.Out and pl.InOut. It explains when to use these annotations based on TensorSpec properties, clarifies that they should only be applied to orchestration entries (and not inline sub-kernels), and provides a code example illustrating the correct usage. There are no review comments, so we have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@zhangqi-chen zhangqi-chen merged commit 9bf0138 into hw-native-sys:main Jul 2, 2026
6 of 7 checks passed
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