Skip to content

ci: bump pto-isa commit to d779cd0 to fix Tpush/Tpop a5sim bug - #1383

Closed
YunjiQin wants to merge 1 commit into
hw-native-sys:mainfrom
YunjiQin:fix/a5sim
Closed

YunjiQin wants to merge 1 commit into
hw-native-sys:mainfrom
YunjiQin:fix/a5sim

Conversation

@YunjiQin

Copy link
Copy Markdown
Collaborator

Summary

  • Bump pto-isa commit from 2c607938 to d779cd0 across ci.yml and daily_ci.yml. The new commit fixes a Tpush/Tpop bug on a5sim.
  • Remove four xfail markers in tests/st/runtime/test_cross_core.py for the cross-core Tpop / bidirect / multi-pipe tests on a5sim, now that the underlying 950 backend issue is resolved.

Testing

  • CI passes with the bumped pto-isa commit
  • Cross-core a5sim tests now pass without xfail

Removes xfail markers for cross-core Tpop tests on a5sim now that the
underlying 950 backend issue is fixed in pto-isa d779cd0.

@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 removes several pytest.xfail markers for the "a5sim" platform across multiple cross-core runtime tests, including C2V no-split, bidirectional, and multi-pipe scenarios. This indicates that these tests are now expected to pass on the simulator. I have no feedback to provide.

@coderabbitai

coderabbitai Bot commented May 15, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 294615b8-7568-4840-a706-2999d8829f7c

📥 Commits

Reviewing files that changed from the base of the PR and between aeca5d6 and b397553.

📒 Files selected for processing (3)
  • .github/workflows/ci.yml
  • .github/workflows/daily_ci.yml
  • tests/st/runtime/test_cross_core.py
💤 Files with no reviewable changes (1)
  • tests/st/runtime/test_cross_core.py

📝 Walkthrough

Walkthrough

Update GitHub Actions CI workflows to pin pto-isa to a new commit (d779cd0), replacing the previous commit (2c607938) across ci.yml and daily_ci.yml jobs. Remove pytest.xfail gating from five cross-core tests on the a5sim platform, enabling them to run unconditionally.

Changes

PTO-ISA Commit Pin and Cross-Core Test Enablement

Layer / File(s) Summary
CI Workflow pto-isa Commit Update
.github/workflows/ci.yml
system-tests, pypto-lib-model, and system-tests-a5sim jobs now reference pto-isa commit d779cd0 in both checkout operations and test --pto-isa-commit parameters, replacing 2c607938.
Daily CI Workflow pto-isa Commit Update
.github/workflows/daily_ci.yml
qwen3-pypto-lib and a5-system-tests jobs now check out and reference pto-isa commit d779cd0 in their test execution parameters, replacing 2c607938.
Cross-Core Tests Enable a5sim Platform
tests/st/runtime/test_cross_core.py
pytest.xfail gating for a5sim platform is removed from test_tpop_c2v_nosplit, test_tpop_bidirect_updown, test_tpop_bidirect_leftright, test_tpop_bidirect_nosplit, and test_multiple_pipes_nosplit; these tests now run unconditionally.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • hw-native-sys/pypto#1206: Both PRs update .github/workflows/daily_ci.yml to change which pto-isa/ptoas revision is checked out and/or used in a5-system-tests (and related qwen3 jobs), aligning CI test inputs to new pinned artifacts/commits.
  • hw-native-sys/pypto#1337: Both PRs update the Daily CI workflow's pto-isa pin and the corresponding --pto-isa-commit argument used by A5 system tests (though to different commit SHAs).
  • hw-native-sys/pypto#1090: Both PRs coordinate CI around tests/st/runtime/test_cross_core.py for a5sim cross-core coverage, alongside updating the --pto-isa-commit value used in CI.

Suggested labels

bug

Suggested reviewers

  • lyfne123

Poem

🐰 A new commit pins the way,
Tests once failed will run today,
With d779cd0 now in place,
Cross-core races find their pace,
No more xfail marks the day! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: bumping the pto-isa commit to fix a Tpush/Tpop a5sim bug, which aligns with all file modifications in the changeset.
Description check ✅ Passed The description is directly related to the changeset, detailing the pto-isa commit bump across CI workflows and removal of xfail markers, matching the actual file changes.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@YunjiQin
YunjiQin marked this pull request as draft May 19, 2026 06:48
@lyfne123 lyfne123 closed this May 21, 2026
@YunjiQin
YunjiQin deleted the fix/a5sim branch July 7, 2026 09:01
georgebisbas added a commit to georgebisbas/pypto that referenced this pull request Jul 20, 2026
- Replace O(P^2) RoundBarrier with O(1) NeighborBarrier in ring allreduce
  kernel (simpler PR hw-native-sys#1383 pattern): notify right, wait left per round
- Update codegen UT assertion: 'RoundBarrier' → 'NeighborBarrier'
- Fix doc wording: shape[0] 'must equal' qualified with compile-time
  constant nuance (EN+ZH pass docs)
- Fix Unicode minus signs (U+2212 → ASCII hyphen) in EN+ZH distributed_ops.md
YunjiQin pushed a commit that referenced this pull request Aug 28, 2026
…nCore composite (#2280)

## Summary

Replaces the **pull-model** engine of the ring allreduce on **both
rails** with a **TPUT push model** (remote write), enabling O(1)
`NeighborBarrier` on the HOST builtin and eliminating the pull-model NPU
memory-ordering gap.

- **HOST builtin** (`builtin.tensor.allreduce_ring`): reduce-scatter +
allgather converted from `TLOAD`/`TSTORE` pull to `pto::comm::TPUT` push
— `TPUT<AtomicAdd>` remote-accumulate for RS, non-atomic `TPUT` for AG.
Ordering is `pipe_barrier(PIPE_ALL)` around every transfer +
`dsb(DSB_DDR)` before `TNOTIFY` (mirrors the in-tree
allgather/all_to_all host builtins; not a GM fence). The O(P²)
`RoundBarrier` is replaced by the O(1) `NeighborBarrier` (notify/wait
the two ring neighbours only), which is NPU-safe because the TPUT write
pipeline orders the data ahead of the signal — the pull model could not
provide that.
- **InCore composite** (`LowerTensorRingAllReduceRule`): replaces
`pld.tile.remote_load` pulls with `pld.tile.put` pushes (non-atomic TPUT
+ local reduce, **preserving Sum/Max/Min/Prod**). Race-free per-subchunk
protocol: own-value read → ready barrier → push to right neighbour →
push-done barrier → local read+reduce+store; barrier credits stay 2 per
subchunk (signal shape unchanged). Ragged/arbitrary lengths and FP16 are
preserved via balanced segments + valid shapes, with the shared VEC
staging tile narrowed per transfer via `tile.set_validshape`.

## Requires PTOAS >= v0.55 (pypto pins v0.57)

**This PR depends on [PTOAS
v0.55](https://github.com/hw-native-sys/PTOAS/releases/tag/v0.55)**
(release:
[hw-native-sys/PTOAS#1069](hw-native-sys/PTOAS#1069),
fixed in [PR #1079](hw-native-sys/PTOAS#1079)).

The InCore composite's `pld.tile.put` transfers carry the **exact ragged
`valid_cols`** as the partition-view extent. PTOAS ≤ v0.54 rejects
dynamic partition-view shapes for `pto.comm.tput` (`'pto.comm.tput' op
expects dst to have a positive static shape`), so the pure push model
cannot compile below v0.55. The HOST builtin does not depend on this
(its kernel is hand-written), but the composite rail does.

The requirement is satisfied by the current pin: pypto now pins **PTOAS
v0.57** (via #2291). The PR is rebased onto current `main` (2026-08-26,
was 76 commits behind; re-rebased twice 2026-08-27 — first onto the
#2530 runtime bump adopting the `ChipTensor`→`TaskTensor` kernel rename,
then onto #2542 adopting the `42-lower_host_tensor_collectives` → `43-…`
docs rename, with the PR's ring-doc edits re-homed) and merges cleanly.
The UT tests pin the push structure (`pld.tile.put` + `tile.create`
staging tile instead of `pld.tile.remote_load`).

## Rebased — merge-order with #2279 (self-clearing signals) resolved

The rebase picked up #2279's self-clearing signal epilogue, which was
written for the **pull-model `RoundBarrier`** (reset every peer's cell
with `TNOTIFY(-1)` per round). That credit pattern does **not** match
the push model's `NeighborBarrier`:

- `NeighborBarrier` credits only the **two ring neighbours** per round —
a single cell when `nranks == 2`, where both neighbours are the same
peer and the cell carries two +1s.
- The #2279 loop would corrupt the unused cells to −1 and, for `nranks
== 2`, leave +1 stale credit in the one used cell — reintroducing the
exact stale-credit barrier failure #2279 fixed.

The epilogue now branches on `kUseNeighborBarrier`: it restores only the
two neighbour cells per used row with `TNOTIFY(-1, AtomicAdd)` (twice on
the shared cell when `nranks == 2`), keeping the all-peer reset for the
`RoundBarrier` fallback. The ring builtin is therefore **self-clearing
and signal-reuse-safe** across back-to-back calls, matching the other
host builtins (#2279). The ring signal-reuse ST
(`test_l3_host_tensor_allreduce_ring.py` reuse leg) is the NPU gate for
the adapted epilogue.

## Issues this PR addresses

- **#2242 (ring unaligned-data handling)**: the pull-model dcci-flush
tail gap (item 1) is **moot** — the push model needs no cacheline flush
(the receiver reads data the sender wrote remotely via TPUT, never a
locally-TSTORE'd line). The 32-byte transfer-alignment concern (item 2)
is handled by narrowing the staging tile's column mask
(`ColMaskInternal` / `tile.set_validshape`) to the exact (possibly
ragged) transfer extent, so partial tails transfer exactly and never
over-read/overwrite adjacent slots.
- **#2213 (PTOAS dynamic partition-view)**: closed as superseded by
#2524; the `>= v0.55` dependency it describes is satisfied by the v0.57
pin.

## Verification (NPU silicon, 910B2, PTOAS v0.55)

All on real NPUs (8x 910B2), P=2 and P=4:

- `tests/st/distributed/test_l3_host_tensor_allreduce_ring.py` — HOST
ring, P=2/4 ✅ (with `NeighborBarrier` enabled)
-
`tests/st/distributed/collectives/test_l3_tensor_allreduce_ring_intrinsic.py`
— InCore ring, P=2/4, sizes {1, 17, 4097, 65537} (ragged + >UB),
Sum/Max/Min/Prod, FP16 ✅
- `tests/st/distributed/collectives/test_l3_allreduce_ring.py` +
`test_l3_ring_sizing_prewarm.py` — no regression ✅
- UTs: `test_lower_host_tensor_collectives.py`,
`test_host_orch_distributed.py`, `test_lower_composite_ops.py` (+
numerical) all green ✅

**Total: 25/25 ST + 190 UT passed** (pre-rebase). The 2026-08-26 rebase
+ epilogue adaptation re-ran the ring UTs (173/174, the one failure is a
pre-existing parser `TileView(pad=…)` roundtrip gap on main, unrelated
to this PR); the 2026-08-27 re-rebases (onto the #2530 runtime bump and
the #2542 docs rename) each re-ran the same 173/174. NPU ST should be
re-confirmed for the signal-reuse leg.

## Trade-off note (ReduceOp)

The HOST builtin is `ReduceOp::kSum` only by construction, so its
`TPUT<AtomicAdd>` RS is fine. The composite keeps non-atomic push +
local reduce to preserve Sum/Max/Min/Prod; only a remote-atomic
`TPUT<AtomicAdd>` variant would be Sum-only (`AtomicType` has no
`AtomicMax/Min`).

## Follow-ups (not in this PR)

- **#2310** — lift the HOST-rail in-loop `pld.tensor.allreduce`
restriction via shared-signal synthesis (the other half of the #2279
review).
- **TPUT_ASYNC** (pto-isa) for an overlapped / IBing forward phase —
optional perf follow-on (simpler #1383 / plan 50).

## Review notes

- Addresses CodeRabbit feedback: the allgather ready-barrier rationale
is corrected (counters are per-round; the real guarantee is the previous
round's push-done barrier every rank passes before round k), and the
`nranks == 2` `NeighborBarrier` behaviour is documented.
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