Merged
feat(PANKO-Pro): Add latency and on-chip memory tuning for single-file PyPTO-Pro JIT kernels #1077
feat(PANKO-Pro): Add latency and on-chip memory tuning for single-file PyPTO-Pro JIT kernels #1077
Merged
Tomomasa YamasakiAdd on 10 days ago
Tomomasa Yamasaki
Tomomasa YamasakiCollaborators
10 days ago

Was This PR authored or co-authored using generative AI tooling?

  1. AI Agent: Claude; OpenAI Codex
  2. AI Model: Claude Opus 5; GPT-6; GPT-6.2 Astra
  3. Prompt: Tune latency and on-chip memory for PyPTO-Pro operators defined in a single JIT source file, using the shared PANKO core. Preserve precision checks, verify retained candidates, and address review feedback.

The single-file commit records the display names Claude Opus 5, GPT-6 and GPT-6.2 Astra. Claude Code used Claude Opus 5. The OpenAI Codex sessions include GPT-6 and the GPT-6.2 Astra session that split out this adapter. Anthropic model reference · OpenAI model reference.

What this PR does / why we need it:

Review scope: This PR adds single-file PyPTO-Pro tuning on top of #922. GitCode compares this branch with master, so its Files changed tab also includes prerequisite changes.

Incremental diff against #922: 54 files, 10,316 additions and 29 deletions.

git diff d2e0dee7...fc81de7a

Merge order: #922 → #1077 → #1078.

This PR lets users run PANKO on an existing PyPTO-Pro operator whose JIT functions are defined in one Python file. PANKO searches for faster implementations and implementations that use less on-chip memory. It keeps candidates that offer different trade-offs, so users can choose a lower-memory implementation even when another is faster.

  • Find and edit candidates. The Pro adapter identifies editable JIT functions, preserves host wrappers and precision tests, and infers legal tile shapes. The autotuner can ask the coder for a structural change and then tune tile shapes using TPE.
  • Evaluate candidates consistently. Each candidate runs against the precision command fixed at initialization. NPU profiling supplies execution time. Declared buffer sizes and addresses supply the on-chip memory estimate. If an allocation size cannot be determined, the total remains unknown.
  • Select, verify and deliver. The shared core handles action selection, the evaluation budget, acceptance, rollback and stopping. After the search stops, PANKO restores each retained candidate and compares it with the baseline in A–B–B–A order. It exports the candidate sources and passes the selected implementation to an independent verifier. The shared core is introduced in PR #922.

Which issue this PR fixes

No linked issue.

Special notes for your reviewer:

This is the second PR in a three-part series.

  1. PR #922 introduces the shared PANKO core.
  2. This PR adds the PyPTO-Pro adapter for operators whose JIT functions live in one source file. A file may contain several JIT functions.
  3. The third PR extends the adapter to JIT functions spread across multiple source files and adds package restoration and export.

Change Type / 改动类型

Testing / 测试信息

The Pro host suite ran 65 tests: 64 passed, 1 skipped, 0 failed. It covers installation, baseline device selection, rejection of an incorrect candidate, tile-search budget accounting, fresh measurements for each verification stage, and restoration and export of retained Pareto candidates. Measurement tests use host fixtures.

Run the suite from the repository root:

python3 -m unittest discover -s cannbot-skills/plugins-official/pypto-pro-op-orchestrator/tests

Before and after the source-analysis refactor, the analysis outputs matched for 126 example kernels and two additional Softmax scope configurations. The comparison covered editable JIT boundaries, tile sites and inferred constraints. git diff --check also passed for the full diff against the shared-core base.

Checklist / 检查清单

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for Tomomasa Yamasaki's contribution.)
Tomomasa YamasakiTomomasa YamasakiCollaborators
10 days ago Created pull request, commit 05e65fa5
Tomomasa YamasakiTomomasa YamasakiCollaborators
10 days ago Associated issue: [Feature]: PANKO for PyPTO-Pro — a multi-objective search-based Stage 5 auto-tuner for Pro kernels
CANN-robotCANN-robotCollaborators
10 days ago Added label: stat/needs-squashai-co-authored
CANN-robotCANN-robotCollaborators
10 days ago Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
10 days ago Comments:

Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.


PR Approval Progress

✅ Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
repo-cann/pypto-gym ✅ wangzheng97, lim-jiunnbin (2/2) ✅ lim-jiunnbin (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

tomomasayamasaki, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
298 messages are collapsed here。 See more
lim-jiunnbin
lim-jiunnbinCollaborators
3 days ago Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
3 days ago Added label: approved
wangzheng97
wangzheng97Collaborators
3 days ago Comments:

/lgtm

likedislike
CANN-robotCANN-robotCollaborators
3 days ago Added label: lgtm
CANN-robotCANN-robotCollaborators
3 days ago Merged pull request