Skip to content

feat(pto): implement tpush/tpop direct TPipe flow#213

Merged
zhangstevenunity merged 2 commits into
hw-native-sys:mainfrom
KurrinQu:feature/tpush-tpop-ops
Mar 20, 2026
Merged

feat(pto): implement tpush/tpop direct TPipe flow#213
zhangstevenunity merged 2 commits into
hw-native-sys:mainfrom
KurrinQu:feature/tpush-tpop-ops

Conversation

@KurrinQu

@KurrinQu KurrinQu commented Mar 7, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@KurrinQu KurrinQu force-pushed the feature/tpush-tpop-ops branch 3 times, most recently from 96533eb to 25c8b89 Compare March 9, 2026 01:00
@KurrinQu KurrinQu force-pushed the feature/tpush-tpop-ops branch 3 times, most recently from 426433c to 13fad76 Compare March 10, 2026 15:09
@zhangstevenunity

Copy link
Copy Markdown
Collaborator

@codex

@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: 30d617d5ad

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +28 to +30
if (auto tfreeOp = dyn_cast<TFreeOp>(&*it)) {
if (tfreeOp.getPipeHandle() == pipeHandle)
return true;

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 Match existing tfree to the current tpop, not just the pipe

This early-exit treats any later pto.tfree with the same pipe as covering the current pto.tpop, which is incorrect when a block has multiple tpop operations on one pipe. In that case, an explicit tfree intended for a later pop makes earlier pops skip auto-insertion, so some consumed slots are never released on A5 and FIFO progress can stall. The check needs to distinguish per-pop balancing instead of a boolean per pipe.

Useful? React with 👍 / 👎.

Comment on lines +42 to +43
for (auto it = std::next(startOp->getIterator()), end = block->end();
it != end; ++it) {

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 Track tile reads through nested regions before inserting tfree

The last-read search only walks sibling operations in the same block, so reads inside nested regions (for example scf.if/scf.for bodies after the tpop) are not considered. When that happens, lastRead stays null and tfree is inserted immediately after tpop, releasing the slot before nested consumers run, which can corrupt A5 pipe usage. This needs region-aware read tracking rather than top-level block scanning only.

Useful? React with 👍 / 👎.

Comment thread lib/PTO/Transforms/PTOToEmitC.cpp Outdated
Comment on lines +3881 to +3884
if (fifoAddrs.empty())
return rewriter.notifyMatchFailure(
op, "fifo_addrs must be present at EmitC lowering "
"(plan memory pass should have filled it in)");

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 Keep LOCAL initialize_pipe optionality consistent through lowering

Verifier logic allows location=LOCAL with zero fifo_addrs, but EmitC lowering unconditionally fails when the operand list is empty. That makes IR accepted by verification fail later in conversion ("fifo_addrs must be present ..."), which is a pipeline regression for the documented optional LOCAL form. Either require the operand up front in verifier/pipeline modes that cannot materialize it, or implement the missing materialization before this check.

Useful? React with 👍 / 👎.

@KurrinQu KurrinQu force-pushed the feature/tpush-tpop-ops branch 8 times, most recently from 4076a96 to a9da4f1 Compare March 13, 2026 13:26
@zhangstevenunity

Copy link
Copy Markdown
Collaborator

@codex review新版本

@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: 0a8e732c2f

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/PTO/Transforms/PTOLowerTPopPass.cpp Outdated
Comment on lines +102 to +103
rewriter.create<TPopInternalOp>(op.getLoc(), declaredTile.getTile(),
op.getPipeHandle());

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 Preserve tpop wait ordering during lowering

In the PTOLowerTPopPass path I inspected, tpop_internal is emitted at the get_fifo_tile site rather than at the original pto.tpop site. Since pto.tpop is the blocking wait, this can reorder side effects: a sequence like tpop; <independent work>; get_fifo_tile is lowered so the independent work runs before the wait, changing synchronization timing and potentially breaking producer/consumer scheduling assumptions.

Useful? React with 👍 / 👎.

Comment thread lib/PTO/Transforms/PTOToEmitC.cpp Outdated
Comment on lines +3899 to +3902
if (!localAddr)
return rewriter.notifyMatchFailure(
op, "local_addr must be present at EmitC lowering "
"(plan memory pass should have filled it in)");

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 Support omitted local_addr in pipe init lowering

initialize_l2g2l_pipe is defined/verified with optional local_addr, but EmitC conversion hard-fails when it is missing, so valid frontend IR using the documented optional form cannot be lowered. I also checked the surrounding pipeline and these init ops are only touched for liveness in memory planning, not rewritten to synthesize local_addr, so this path currently fails at conversion time instead of being supported.

Useful? React with 👍 / 👎.

@KurrinQu KurrinQu force-pushed the feature/tpush-tpop-ops branch 2 times, most recently from a1b7b1a to 8376850 Compare March 16, 2026 16:42
@KurrinQu KurrinQu force-pushed the feature/tpush-tpop-ops branch from 8376850 to 9eab9c4 Compare March 19, 2026 15:09
@KurrinQu KurrinQu marked this pull request as ready for review March 20, 2026 01:49
@zhangstevenunity zhangstevenunity merged commit 485fe80 into hw-native-sys:main Mar 20, 2026
10 checks passed
FangRui0 pushed a commit to FangRui0/PTOAS that referenced this pull request Apr 25, 2026
* Add OP for TPartAdd & TPartMul

* docs: add license headers to TPartAdd/TPartMul templates

Add PR386 OAT.3 license headers to tpartadd_template.py and tpartmul_template.py.

* fix-review: update license

* Add OP for TPartAdd & TPartMul: update cmakelist

---------

Co-authored-by: caojian5 <caojian5@huawei.com>
KurrinQu pushed a commit to KurrinQu/PTOAS that referenced this pull request Apr 28, 2026
* Add OP for TPartAdd & TPartMul

* docs: add license headers to TPartAdd/TPartMul templates

Add PR386 OAT.3 license headers to tpartadd_template.py and tpartmul_template.py.

* fix-review: update license

* Add OP for TPartAdd & TPartMul: update cmakelist

---------

Co-authored-by: caojian5 <caojian5@huawei.com>
Zhendong404 pushed a commit to Zhendong404/PTOAS that referenced this pull request May 1, 2026
* Add OP for TPartAdd & TPartMul

* docs: add license headers to TPartAdd/TPartMul templates

Add PR386 OAT.3 license headers to tpartadd_template.py and tpartmul_template.py.

* fix-review: update license

* Add OP for TPartAdd & TPartMul: update cmakelist

---------

Co-authored-by: caojian5 <caojian5@huawei.com>
FangRui0 pushed a commit to FangRui0/PTOAS that referenced this pull request May 14, 2026
* Add OP for TPartAdd & TPartMul

* docs: add license headers to TPartAdd/TPartMul templates

Add PR386 OAT.3 license headers to tpartadd_template.py and tpartmul_template.py.

* fix-review: update license

* Add OP for TPartAdd & TPartMul: update cmakelist

---------

Co-authored-by: caojian5 <caojian5@huawei.com>
zhangstevenunity pushed a commit that referenced this pull request May 29, 2026
* Add OP for TPartAdd & TPartMul

* docs: add license headers to TPartAdd/TPartMul templates

Add PR386 OAT.3 license headers to tpartadd_template.py and tpartmul_template.py.

* fix-review: update license

* Add OP for TPartAdd & TPartMul: update cmakelist

---------

Co-authored-by: caojian5 <caojian5@huawei.com>
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