Skip to content

[Maintain][Manifest] flip Var/Std/VarMean fwd ops to status: implemented#1430

Merged
lcy-seso merged 1 commit into
tile-ai:mainfrom
lcy-seso:fix/manifest/issue-1400
May 14, 2026
Merged

[Maintain][Manifest] flip Var/Std/VarMean fwd ops to status: implemented#1430
lcy-seso merged 1 commit into
tile-ai:mainfrom
lcy-seso:fix/manifest/issue-1400

Conversation

@lcy-seso
Copy link
Copy Markdown
Collaborator

Closes #1400

Summary

  • Flip VarFwdOp, StdFwdOp, VarMeanFwdOp from status: spec-only to status: implemented in tileops/manifest/reduction.yaml.
  • Diff is YAML-only; no signature/roofline/workloads/shape-rule edits (status flip carve-out).

Context

The issue body references impl PR #1397, which does not exist. The actual implementation already landed on main:

This PR is the spec-side flip aligning manifest status with the already-merged implementation and conformance tests.

Test plan

  • AC-1: tileops/manifest/reduction.yaml shows status: implemented for VarFwdOp, StdFwdOp, VarMeanFwdOp.
  • AC-2: python scripts/validate_manifest.py exits 0 (All manifest checks passed.).
  • AC-3: pytest tests/test_validate_manifest.py passes (218 passed, 3 warnings).
  • AC-4: PR diff touches only tileops/manifest/reduction.yaml (+3 / -3).

Copilot AI review requested due to automatic review settings May 12, 2026 02:58
@github-actions github-actions Bot added the maintain Ongoing monitoring, health tracking, and operational maintenance label May 12, 2026
@lcy-seso lcy-seso added automated PR produced by an autonomous agent pipeline needs-review Awaiting human review before merge labels May 12, 2026
@lcy-seso
Copy link
Copy Markdown
Collaborator Author

/gemini review

@lcy-seso lcy-seso marked this pull request as ready for review May 12, 2026 02:59
@lcy-seso lcy-seso requested a review from a team May 12, 2026 02:59
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aligns the reduction manifest with the already-landed implementation and conformance coverage by promoting the variance-family forward ops (VarFwdOp, StdFwdOp, VarMeanFwdOp) from status: spec-only to status: implemented in tileops/manifest/reduction.yaml.

Changes:

  • Flip VarFwdOp manifest status to implemented.
  • Flip StdFwdOp manifest status to implemented.
  • Flip VarMeanFwdOp manifest status to implemented.

Copy link
Copy Markdown
Contributor

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

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 status of VarFwdOp, StdFwdOp, and VarMeanFwdOp to implemented in the reduction manifest. However, several issues were identified in the underlying implementation: an AttributeError in roofline calculations due to incorrect dtype attribute access, incorrect handling of empty dimension lists in shape rules, and potential runtime errors related to non-contiguous tensor reshaping and type handling for dimension info.

ref_api: "torch.var"
family: reduction
status: spec-only # dim=None not yet implemented; update when impl lands
status: implemented
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.

high

While flipping the status to implemented is correct, I noticed a bug in the underlying implementation that will affect these ops. In tileops/ops/reduction/reduce.py, the eval_roofline method (line 180) attempts to access self.dtype.itemsize. However, torch.dtype objects do not have an itemsize attribute; the correct method is element_size(). This will cause an AttributeError when calculating roofline metrics for these newly implemented ops.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Verified false positive. torch.dtype.itemsize has existed since torch 2.1, and pyproject.toml pins torch>=2.1.0,<2.11.0. Local check on torch 2.9.1: torch.float16.itemsize == 2, torch.int64.itemsize == 8 — no AttributeError. No fix needed.

Comment thread tileops/manifest/reduction.yaml
Comment thread tileops/manifest/reduction.yaml
Copy link
Copy Markdown
Contributor

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

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 status of VarFwdOp, StdFwdOp, and VarMeanFwdOp from spec-only to implemented in the reduction manifest, indicating that these operations (torch.var, torch.std, and torch.var_mean) are now fully supported. I have no feedback to provide as there were no review comments.

Copy link
Copy Markdown
Contributor

@Ibuki-wind Ibuki-wind left a comment

Choose a reason for hiding this comment

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

Overall

The status flips are blocked because default construction still reduces the last axis while the manifest contract says dim=None full reduction.

Comment thread tileops/manifest/reduction.yaml
Comment thread tileops/manifest/reduction.yaml
Comment thread tileops/manifest/reduction.yaml
@lcy-seso
Copy link
Copy Markdown
Collaborator Author

Reviewer-feedback verification summary

After re-reading every comment on PRs #1428 / #1430 / #1431 and running targeted checks, the verified picture is:

Item Verdict Action
Constructor default dim=-1 vs manifest default: null (Sum/Mean/Amax/Amin/Var/Std/VarMean/All/Any/CountNonzero) ✅ Real Code-only prereq PR — flip default to None on _ReduceOpBase, _WelfordReduceOp, AllFwdOp, AnyFwdOp, CountNonzeroFwdOp; add explicit dim=-1 override on ProdFwdOp (its manifest type is int, default: -1).
_logical_reduce_kernel tail-row OOB on aligned-N path (All/Any/CountNonzero) ❌ False positive compute-sanitizer --tool memcheck clean across 16 shape configs (M ∈ {129, 257, 513, 1025} × N ∈ {128, 256, 512, 1024}); TileLang's T.copy inserts implicit row-bounds guards from the source extent. No fix needed.
self.dtype.itemsize AttributeError (gemini) ❌ False positive torch.dtype.itemsize exists since torch 2.1; pyproject.toml pins torch>=2.1.0,<2.11.0.
x.reshape(M, N) non-contiguous risk after flatten_for_multidim (gemini) ❌ False positive flatten_for_multidim already does .permute(perm).contiguous() before reshape.
_reshape_output not handling tuple (gemini) ❌ False positive normalize_dim always returns list[int]; tuple is unreachable through the public API.
shape_rules dim=[] semantics, missing dtypes in signature, hidden-state-reduce workload missing dim ⚠️ Real, manifest-only Outside the manifest-trust-model status-flip carve-out. Follow-up manifest-only PR will fix all three families together.

Plan:

  1. Open a code-only prereq PR ([Fix][Ops] reduction op constructor defaults: dim=-1 → dim=None) covering the 5 default flips + ProdFwdOp override + default-construction test updates.
  2. Once that lands, rebase [Maintain][Manifest] flip reduction Sum/Mean/Amax/Amin to implemented #1428 / [Maintain][Manifest] flip Var/Std/VarMean fwd ops to status: implemented #1430 / [Maintain][Manifest] flip All/Any/CountNonzero reduction ops to implemented #1431 and the status-flip claims become contract-true.
  3. Separately, file a manifest-only PR (signature dtype lists, shape_rules empty-list semantics, hidden-state-reduce workload) for the items the trust-model carve-out won't allow here.

Detailed per-comment verdicts are posted as inline replies on each thread.

Copy link
Copy Markdown
Contributor

@Ibuki-wind Ibuki-wind left a comment

Choose a reason for hiding this comment

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

Overall

The status flip overclaims implementation conformance; scalar input support is still missing for the flipped PyTorch variance reduction APIs.

Comment thread tileops/manifest/reduction.yaml
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
Contributor

@Ibuki-wind Ibuki-wind left a comment

Choose a reason for hiding this comment

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

Overall

These flips are still ahead of the implementation: the shared reduction base rejects 0-D tensors, but torch.var / torch.std / torch.var_mean accept scalar inputs and return 0-D outputs.

Comment thread tileops/manifest/reduction.yaml
Op implementations (incl. dim=None full reduction) and conformance
tests are in place; promote the three Welford reductions from
spec-only to implemented and drop the now-stale "not yet implemented"
comments.

Co-Authored-By: Ibuki 🍃 — a wind born from GPTs <[email protected]>
@lcy-seso lcy-seso force-pushed the fix/manifest/issue-1400 branch from e048b8c to 3dd3edd Compare May 14, 2026 05:29
Copy link
Copy Markdown
Contributor

@Ibuki-wind Ibuki-wind left a comment

Choose a reason for hiding this comment

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

Clean — no issues.

lcy-seso added a commit that referenced this pull request May 14, 2026
…mented (#1431)

Closes #1401

## Summary

- Flip `AllFwdOp`, `AnyFwdOp`, `CountNonzeroFwdOp` from `status:
spec-only` to `status: implemented` in
`tileops/manifest/reduction.yaml`.
- Single-file manifest-only change; no
signature/roofline/workloads/shape_rules edits.

## Context

Third of a sibling set:

- #1428 — issue #1399, Sum/Mean/Amax/Amin.
- #1430 — issue #1400, Var/Std/VarMean.
- This PR — issue #1401, All/Any/CountNonzero.

After all three merge, the remaining 7 spec-only reduction ops flip to
`implemented`, bringing the reduction family to 19/19 `status:
implemented`.

## Note on AC-5

AC-5 in the linked issue says "All 13 reduction.yaml ops are status:
implemented after merge." The literal count is stale — `reduction.yaml`
currently holds 19 ops (12 already `implemented` on `upstream/main`, 7
`spec-only` before this sibling set). The substantive intent —
"reduction family fully implemented after merge" — is satisfied once
#1428, #1430, and this PR all land.

## Test plan

- [x] AC-1: `tileops/manifest/reduction.yaml` shows `status:
implemented` for AllFwdOp, AnyFwdOp, CountNonzeroFwdOp.
- [x] AC-2: `python scripts/validate_manifest.py` exits 0.
- [x] AC-3: `pytest tests/test_validate_manifest.py` passes.
- [x] AC-4: PR diff touches only `tileops/manifest/reduction.yaml` (3
lines changed).
- [x] AC-5: Reduction family fully `implemented` after the three sibling
PRs merge (literal "13" is a stale count; see note above).

Co-authored-by: Ibuki 🍃 — a wind born from GPTs <[email protected]>
@lcy-seso lcy-seso merged commit b0ddd46 into tile-ai:main May 14, 2026
11 checks passed
@lcy-seso lcy-seso deleted the fix/manifest/issue-1400 branch May 14, 2026 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated PR produced by an autonomous agent pipeline maintain Ongoing monitoring, health tracking, and operational maintenance needs-review Awaiting human review before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Maintain][Manifest] flip variance reductions to implemented

3 participants