Skip to content

Fix: raise timeout defaults and keep CI fast-fail - #1175

Merged
ChaoZheng109 merged 1 commit into
hw-native-sys:mainfrom
sunkaixuan2018:fix-issue-1165
Jun 27, 2026
Merged

ChaoZheng109 merged 1 commit into
hw-native-sys:mainfrom
sunkaixuan2018:fix-issue-1165

Conversation

@sunkaixuan2018

Copy link
Copy Markdown
Contributor

Summary

  • raise local/onboard timeout defaults to keep long-running PTO workloads from being reaped too early
  • keep CI fast-fail coverage by setting tighter timeout env values in CI and in the aicore timeout ST
  • update timeout docs and C++ timeout config tests for the new defaults

Fixes #1165

Validation

  • myserver: git diff --check
  • myserver: python3 -m py_compile tests/st/aicore_op_timeout/test_aicore_op_timeout.py
  • myserver: C++ timeout constant smoke check (issue1165 timeout constants ok)
  • myserver: test_runtime_timeout_config C++ UT, 9 passed
  • myserver a2a3 via task-submit: pytest tests/st/aicore_op_timeout/test_aicore_op_timeout.py --platform a2a3 --device $TASK_DEVICE --max-parallel 1 -q -s, 1 passed

@coderabbitai

coderabbitai Bot commented Jun 27, 2026 •

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b1ff426c-3d3f-492d-98ce-6e466530a312

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR raises timeout defaults for a2a3 and a5, sets CI environment overrides back to tight values, updates timeout-focused tests, and refreshes related documentation and operational notes.

Changes

Timeout defaults, CI overrides, and docs

Layer / File(s) Summary
Compiled timeout defaults
src/a2a3/platform/include/common/platform_config.h, src/a5/platform/include/common/platform_config.h, src/common/platform/onboard/aicpu/spin_hint.h, src/common/platform/sim/aicpu/spin_hint.h, src/a2a3/runtime/tensormap_and_ringbuffer/runtime/scheduler/scheduler_types.h, src/a5/runtime/tensormap_and_ringbuffer/runtime/scheduler/scheduler_types.h
PLATFORM_OP_EXECUTE_TIMEOUT_US, PLATFORM_ONBOARD_SCHEDULER_TIMEOUT_MS, PLATFORM_STREAM_SYNC_TIMEOUT_MS, and PLATFORM_SCHEDULER_TIMEOUT_MS are raised, and the adjacent timeout-chain comments are rewritten for the new ordering and platform variants.
CI overrides and ST regression
.github/workflows/ci.yml, tests/st/aicore_op_timeout/test_aicore_op_timeout.py, tests/st/aicore_op_timeout/kernels/aic/kernel_hang.cpp
CI jobs set PTO2 timeout env vars for onboard and sim runs, and the ST AICore timeout regression uses monkeypatch to apply the CI-tight values while updating the matching timeout comments.
Runtime timeout config tests
tests/ut/cpp/CMakeLists.txt, tests/ut/cpp/common/test_runtime_timeout_config.cpp
The runtime timeout config unit test target gains platform include paths, and the validation tests now read platform defaults and assert the updated ordering cases.
Timeout docs and notes
.claude/rules/running-onboard.md, docs/ci.md, docs/dfx/args-dump.md, docs/troubleshooting/local-timeout-defaults.md
The timeout-chain references, troubleshooting guide, CI note, and onboard triage row are updated to the new values and env overrides.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • hw-native-sys/simpler#1127: Introduces the PTO2 env-override mechanism that this PR uses in CI and documents against.
  • hw-native-sys/simpler#1035: Updates the same timeout-chain constants and related docs around op-execute, scheduler, and stream-sync budgets.
  • hw-native-sys/simpler#930: Adjusts scheduler timeout values and the surrounding timeout-chain commentary in the same platform area.

Poem

I hopped through timeouts, thump and cheer,
Ten-second waits now nestle near.
CI nibbles tight, while local runs may roam,
Yet hangs still wobble back to home.
🐇✨ I leave a carrot trail of hope.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description is clearly related to the PR and summarizes the timeout default, CI, and docs updates.
Linked Issues check ✅ Passed The changes align with #1165 by raising defaults, restoring CI fast-fail values, and updating docs/tests.
Out of Scope Changes check ✅ Passed The modified files all support the timeout-default change, CI overrides, or related documentation/tests.
Title check ✅ Passed The title accurately captures the main change: raising timeout defaults while preserving CI fast-fail behavior.

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

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 increases the default runtime timeouts (scheduler, op-execute, and stream-sync) to more production-friendly values across onboard and sim platforms, while updating tests, documentation, and CI configurations to support tighter environment-based overrides. Feedback on these changes suggests using ${CMAKE_CURRENT_SOURCE_DIR} instead of ${CMAKE_SOURCE_DIR} in tests/ut/cpp/CMakeLists.txt to avoid potential path resolution issues if the subdirectory is included in a larger build.

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.

Comment thread tests/ut/cpp/CMakeLists.txt

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/ci.yml (1)

444-447: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Add the PTO2 timeout overrides to the UT hardware jobs
st-onboard-a2a3 already has the tight PTO2_* env block, but both ut-a2a3 and ut-a5 still run without it. Add the same overrides to each UT job so the hardware tests use the intended fail-fast timeouts instead of the raised defaults.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml around lines 444 - 447, The UT hardware jobs are
missing the PTO2 timeout override environment block, so add the same tight
PTO2_* env settings used by st-onboard-a2a3 to both ut-a2a3 and ut-a5 in the CI
workflow. Update the job definitions for ut-a2a3 and ut-a5 so their hardware
tests use the intended fail-fast timeouts instead of the raised defaults.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/ut/cpp/CMakeLists.txt`:
- Around line 443-445: The test_runtime_timeout_config unit test only includes
the a2a3 platform headers, so it misses coverage for the a5 platform defaults.
Update the test setup around test_runtime_timeout_config in the CMake/test code
to add an a5-specific include path or a separate a5 variant that uses
src/a5/platform/include/common/platform_config.h, so both platform_config.h
implementations are exercised.

---

Outside diff comments:
In @.github/workflows/ci.yml:
- Around line 444-447: The UT hardware jobs are missing the PTO2 timeout
override environment block, so add the same tight PTO2_* env settings used by
st-onboard-a2a3 to both ut-a2a3 and ut-a5 in the CI workflow. Update the job
definitions for ut-a2a3 and ut-a5 so their hardware tests use the intended
fail-fast timeouts instead of the raised defaults.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 14eeeb05-b783-4c9f-98b7-5859626fd3d7

📥 Commits

Reviewing files that changed from the base of the PR and between 7e906a3 and f3ca628.

📒 Files selected for processing (15)
  • .claude/rules/running-onboard.md
  • .github/workflows/ci.yml
  • docs/ci.md
  • docs/dfx/args-dump.md
  • docs/troubleshooting/local-timeout-defaults.md
  • src/a2a3/platform/include/common/platform_config.h
  • src/a2a3/runtime/tensormap_and_ringbuffer/runtime/scheduler/scheduler_types.h
  • src/a5/platform/include/common/platform_config.h
  • src/a5/runtime/tensormap_and_ringbuffer/runtime/scheduler/scheduler_types.h
  • src/common/platform/onboard/aicpu/spin_hint.h
  • src/common/platform/sim/aicpu/spin_hint.h
  • tests/st/aicore_op_timeout/kernels/aic/kernel_hang.cpp
  • tests/st/aicore_op_timeout/test_aicore_op_timeout.py
  • tests/ut/cpp/CMakeLists.txt
  • tests/ut/cpp/common/test_runtime_timeout_config.cpp

Comment thread tests/ut/cpp/CMakeLists.txt
@sunkaixuan2018
sunkaixuan2018 force-pushed the fix-issue-1165 branch 5 times, most recently from 613112f to c04b819 Compare June 27, 2026 08:18
@sunkaixuan2018 sunkaixuan2018 changed the title Fix issue 1165 timeout defaults Fix: raise timeout defaults and keep CI fast-fail Jun 27, 2026
@ChaoZheng109

Copy link
Copy Markdown
Collaborator

Two review notes (otherwise this LGTM — faithfully implements #1165, keeps a2a3/a5 in parity, and the ST monkeypatch of the three env vars is the right way to keep the hang surfacing in <10s under the new 45/50s defaults).

Should fix — resolve_host_runtime_timeout_config is now orphaned

This PR switches the only production caller (device_runner_base.cpp::resolve_onboard_timeout_config) from resolve_host_runtime_timeout_config to the full resolve_runtime_timeout_config. After that, resolve_host_runtime_timeout_config (in src/common/platform/include/host/runtime_timeout_config.h) is referenced only by the HostConfigIgnoresSchedulerEnv unit test — i.e. a test that now exercises a function nothing in production uses.

Suggest either:

  • delete resolve_host_runtime_timeout_config and the HostConfigIgnoresSchedulerEnv test, or
  • add a short comment stating it's intentionally retained as API surface.

(The HostRuntimeTimeoutConfig struct itself is still needed — device_runner_base now constructs it manually — so only the resolver helper is dead.)

Nit — awkward comment reflow in kernel_hang.cpp

The edit left the sentence broken across three lines mid-phrase:

 * (PLATFORM_OP_EXECUTE_TIMEOUT_US) must reap it; this
 * kernel exists
 * to exercise the 3-layer host timeout chain added in PR #718.

Reflow to one line, e.g. * (PLATFORM_OP_EXECUTE_TIMEOUT_US) must reap it; this kernel exists / * to exercise the 3-layer host timeout chain added in PR #718.

- Raise a2a3 and a5 onboard timeout defaults for production workloads
- Restore CI fast-fail values with PTO2 timeout env overrides
- Keep host timeout ordering validation aligned with scheduler overrides
- Update docs and timeout config tests for the new defaults
@ChaoZheng109
ChaoZheng109 merged commit c080089 into hw-native-sys:main Jun 27, 2026
16 checks passed
ChaoWao added a commit to ChaoWao/simpler-fork that referenced this pull request Jun 27, 2026
Split the cross-repo qwen3 work into two focused skills:

- multi-repo-setup becomes the repo-relationship + per-repo setup/run
  skill: documents the import stack (pto-isa -> simpler -> pypto ->
  pypto-lib -> pypto-serving), clones/installs each layer, and hands off
  to each external repo's own .claude/skills/ + README rather than
  duplicating their run steps. Adds pypto-serving as a first-class repo.

- multi-repo-qwen-serving-setup becomes the concrete qwen3 guide: defers
  clone/install to multi-repo-setup, then gives the batch-1 / batch-16
  run commands, the prefill ring-sizing + op-timeout gotchas behind a
  generic 507018, how to read the per-token timing layers, and the
  kernel-level decode_layer scheduler-overhead DFX flow.

Corrects the timeout facts to the post-hw-native-sys#1175 compiled defaults
(op_execute 45s / stream_sync 50s / scheduler 10s, not the old
3s/4s/2s): a clean ~16.7s batch-16 prefill no longer trips the
op-timeout, so the PTO2_OP_EXECUTE_TIMEOUT_US / PTO2_STREAM_SYNC_TIMEOUT_MS
env overrides are only needed on a contended box, and breaking the
scheduler < op_execute < stream_sync ordering drops the whole override
set. Marks the [STRACE] host-trace markers / strace_timing.py /
docs/dfx/host-trace.md as pending simpler hw-native-sys#1177 (still OPEN, not landed).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ChaoWao added a commit to ChaoWao/simpler-fork that referenced this pull request Jun 27, 2026
Split the cross-repo qwen3 work into two focused skills:

- multi-repo-setup becomes the repo-relationship + per-repo setup/run
  skill: documents the import stack (pto-isa -> simpler -> pypto ->
  pypto-lib -> pypto-serving), clones/installs each layer, and hands off
  to each external repo's own .claude/skills/ + README rather than
  duplicating their run steps. Adds pypto-serving as a first-class repo.

- multi-repo-qwen-setup is the concrete qwen3 guide, covering BOTH the
  pypto-serving runner (batch-1 / batch-16 prefill/decode TPOT) and the
  pypto-lib decode_layer kernel (scheduler-overhead DFX). It defers
  clone/install to multi-repo-setup, then gives the run commands, the
  prefill ring-sizing + op-timeout gotchas behind a generic 507018, how
  to read the per-token timing layers, and the overhead-analysis flow.
  (Named multi-repo-qwen-setup, not -serving-setup, since it spans the
  serving runner and the kernel path, not serving alone.)

Corrects the timeout facts to the post-hw-native-sys#1175 compiled defaults
(op_execute 45s / stream_sync 50s / scheduler 10s, not the old
3s/4s/2s): a clean ~16.7s batch-16 prefill no longer trips the
op-timeout, so the PTO2_OP_EXECUTE_TIMEOUT_US / PTO2_STREAM_SYNC_TIMEOUT_MS
env overrides are only needed on a contended box, and breaking the
scheduler < op_execute < stream_sync ordering drops the whole override
set. Marks the [STRACE] host-trace markers / strace_timing.py /
docs/dfx/host-trace.md as pending simpler hw-native-sys#1177 (still OPEN, not landed).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ChaoWao added a commit to ChaoWao/simpler-fork that referenced this pull request Jun 28, 2026
Split the cross-repo qwen3 work into two focused skills:

- multi-repo-setup becomes the repo-relationship + per-repo setup/run
  skill: documents the import stack (pto-isa -> simpler -> pypto ->
  pypto-lib -> pypto-serving), clones/installs each layer, and hands off
  to each external repo's own .claude/skills/ + README rather than
  duplicating their run steps. Adds pypto-serving as a first-class repo.

- multi-repo-qwen-setup is the concrete qwen3 guide, covering BOTH the
  pypto-serving runner (batch-1 / batch-16 prefill/decode TPOT) and the
  pypto-lib decode_layer kernel (scheduler-overhead DFX). It defers
  clone/install to multi-repo-setup, then gives the run commands, the
  prefill ring-sizing + op-timeout gotchas behind a generic 507018, how
  to read the per-token timing layers, and the overhead-analysis flow.
  (Named multi-repo-qwen-setup, not -serving-setup, since it spans the
  serving runner and the kernel path, not serving alone.)

Corrects the timeout facts to the post-hw-native-sys#1175 compiled defaults
(op_execute 45s / stream_sync 50s / scheduler 10s, not the old
3s/4s/2s): a clean ~16.7s batch-16 prefill no longer trips the
op-timeout, so the PTO2_OP_EXECUTE_TIMEOUT_US / PTO2_STREAM_SYNC_TIMEOUT_MS
env overrides are only needed on a contended box, and breaking the
scheduler < op_execute < stream_sync ordering drops the whole override
set. Marks the [STRACE] host-trace markers / strace_timing.py /
docs/dfx/host-trace.md as pending simpler hw-native-sys#1177 (still OPEN, not landed).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ChaoWao added a commit to ChaoWao/simpler-fork that referenced this pull request Jun 28, 2026
Split the cross-repo qwen3 work into two focused skills:

- multi-repo-setup becomes the repo-relationship + per-repo setup/run
  skill: documents the import stack (pto-isa -> simpler -> pypto ->
  pypto-lib -> pypto-serving), clones/installs each layer, and hands off
  to each external repo's own .claude/skills/ + README rather than
  duplicating their run steps. Adds pypto-serving as a first-class repo.

- multi-repo-qwen-setup is the concrete qwen3 guide, covering BOTH the
  pypto-serving runner (batch-1 / batch-16 prefill/decode TPOT) and the
  pypto-lib decode_layer kernel (scheduler-overhead DFX), framed up front
  as two distinct paths (different repos, entry points, what they measure).
  It defers clone/install to multi-repo-setup, then gives the run commands,
  the prefill ring-sizing + op-timeout gotchas behind a generic 507018, how
  to read the per-token timing layers, and the overhead-analysis flow.

The timeout facts use the post-hw-native-sys#1175 compiled defaults (op_execute 45s /
stream_sync 50s / scheduler 10s): a clean ~16.7s batch-16 prefill no longer
trips the op-timeout, so the PTO2_OP_EXECUTE_TIMEOUT_US /
PTO2_STREAM_SYNC_TIMEOUT_MS env overrides are only needed on a contended
box, and breaking the scheduler < op_execute < stream_sync ordering drops
the whole override set. The per-token timing section uses the [STRACE]
host-trace markers + strace_timing.py / docs/dfx/host-trace.md landed in
simpler hw-native-sys#1177.

The §7 host-instrumentation rebuild uses an $ARCH variable and a find-based
copy (python-version-agnostic), matching multi-repo-setup Step 3.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ChaoWao added a commit to ChaoWao/simpler-fork that referenced this pull request Jun 28, 2026
Split the cross-repo qwen3 work into two focused skills:

- multi-repo-setup becomes the repo-relationship + per-repo setup/run
  skill: documents the import stack (pto-isa -> simpler -> pypto ->
  pypto-lib -> pypto-serving), clones/installs each layer, and hands off
  to each external repo's own .claude/skills/ + README rather than
  duplicating their run steps. Adds pypto-serving as a first-class repo.

- multi-repo-qwen-setup is the concrete qwen3 guide, covering BOTH the
  pypto-serving runner (batch-1 / batch-16 prefill/decode TPOT) and the
  pypto-lib decode_layer kernel (scheduler-overhead DFX), framed up front
  as two distinct paths (different repos, entry points, what they measure).
  It defers clone/install to multi-repo-setup, then gives the run commands,
  the prefill ring-sizing + op-timeout gotchas behind a generic 507018, how
  to read the per-token timing layers, and the overhead-analysis flow.

The timeout facts use the post-hw-native-sys#1175 compiled defaults (op_execute 45s /
stream_sync 50s / scheduler 10s): a clean ~16.7s batch-16 prefill no longer
trips the op-timeout, so the PTO2_OP_EXECUTE_TIMEOUT_US /
PTO2_STREAM_SYNC_TIMEOUT_MS env overrides are only needed on a contended
box, and breaking the scheduler < op_execute < stream_sync ordering drops
the whole override set. The per-token timing section uses the [STRACE]
host-trace markers + strace_timing.py / docs/dfx/host-trace.md landed in
simpler hw-native-sys#1177.

The §7 host-instrumentation rebuild uses an $ARCH variable and a find-based
copy (python-version-agnostic), matching multi-repo-setup Step 3.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ChaoWao added a commit that referenced this pull request Jun 28, 2026
…1178)

Split the cross-repo qwen3 work into two focused skills:

- multi-repo-setup becomes the repo-relationship + per-repo setup/run
  skill: documents the import stack (pto-isa -> simpler -> pypto ->
  pypto-lib -> pypto-serving), clones/installs each layer, and hands off
  to each external repo's own .claude/skills/ + README rather than
  duplicating their run steps. Adds pypto-serving as a first-class repo.

- multi-repo-qwen-setup is the concrete qwen3 guide, covering BOTH the
  pypto-serving runner (batch-1 / batch-16 prefill/decode TPOT) and the
  pypto-lib decode_layer kernel (scheduler-overhead DFX), framed up front
  as two distinct paths (different repos, entry points, what they measure).
  It defers clone/install to multi-repo-setup, then gives the run commands,
  the prefill ring-sizing + op-timeout gotchas behind a generic 507018, how
  to read the per-token timing layers, and the overhead-analysis flow.

The timeout facts use the post-#1175 compiled defaults (op_execute 45s /
stream_sync 50s / scheduler 10s): a clean ~16.7s batch-16 prefill no longer
trips the op-timeout, so the PTO2_OP_EXECUTE_TIMEOUT_US /
PTO2_STREAM_SYNC_TIMEOUT_MS env overrides are only needed on a contended
box, and breaking the scheduler < op_execute < stream_sync ordering drops
the whole override set. The per-token timing section uses the [STRACE]
host-trace markers + strace_timing.py / docs/dfx/host-trace.md landed in
simpler #1177.

The §7 host-instrumentation rebuild uses an $ARCH variable and a find-based
copy (python-version-agnostic), matching multi-repo-setup Step 3.
doraemonmj pushed a commit to doraemonmj/simpler_wc that referenced this pull request Jul 1, 2026
- Raise a2a3 and a5 onboard timeout defaults for production workloads
- Restore CI fast-fail values with PTO2 timeout env overrides
- Keep host timeout ordering validation aligned with scheduler overrides
- Update docs and timeout config tests for the new defaults
doraemonmj pushed a commit to doraemonmj/simpler_wc that referenced this pull request Jul 1, 2026
…w-native-sys#1178)

Split the cross-repo qwen3 work into two focused skills:

- multi-repo-setup becomes the repo-relationship + per-repo setup/run
  skill: documents the import stack (pto-isa -> simpler -> pypto ->
  pypto-lib -> pypto-serving), clones/installs each layer, and hands off
  to each external repo's own .claude/skills/ + README rather than
  duplicating their run steps. Adds pypto-serving as a first-class repo.

- multi-repo-qwen-setup is the concrete qwen3 guide, covering BOTH the
  pypto-serving runner (batch-1 / batch-16 prefill/decode TPOT) and the
  pypto-lib decode_layer kernel (scheduler-overhead DFX), framed up front
  as two distinct paths (different repos, entry points, what they measure).
  It defers clone/install to multi-repo-setup, then gives the run commands,
  the prefill ring-sizing + op-timeout gotchas behind a generic 507018, how
  to read the per-token timing layers, and the overhead-analysis flow.

The timeout facts use the post-hw-native-sys#1175 compiled defaults (op_execute 45s /
stream_sync 50s / scheduler 10s): a clean ~16.7s batch-16 prefill no longer
trips the op-timeout, so the PTO2_OP_EXECUTE_TIMEOUT_US /
PTO2_STREAM_SYNC_TIMEOUT_MS env overrides are only needed on a contended
box, and breaking the scheduler < op_execute < stream_sync ordering drops
the whole override set. The per-token timing section uses the [STRACE]
host-trace markers + strace_timing.py / docs/dfx/host-trace.md landed in
simpler hw-native-sys#1177.

The §7 host-instrumentation rebuild uses an $ARCH variable and a find-based
copy (python-version-agnostic), matching multi-repo-setup Step 3.
ChaoWao added a commit to ChaoWao/simpler-fork that referenced this pull request Jul 27, 2026
Fixes hw-native-sys#1484

The example carried pypto codegen last refreshed on 2026-06-25, cited a
provenance file upstream had deleted (`models/qwen3/14b/decode_layer.py`), and
covered 2 of Qwen3-14B's 40 layers. Re-harvested from `decode_fwd.py`'s
`decode_fwd_layers` at pypto-lib `45be52c` with `_CHUNK_NLAYERS = 40`, and the
README now records that commit plus the ptoas and pto-isa pins so the next drift
is detectable rather than archaeological.

Scaling to the full model is nearly free. The generated orchestration loops over
layers (`for (int64_t i = 0; i < 40; i += 1)`) instead of unrolling them, so
going from 2 to 40 moves a trip count and leaves the kernel set the same size.
The lib chunks its dispatches because a 40-layer one used to exceed a 2000 ms
stream-sync timeout; simpler raised that to 50 s in hw-native-sys#1175 and a 40-layer step is
~40 ms, so the constraint is gone.

What did change is attention. Since pypto-lib hw-native-sys#765 and hw-native-sys#796 it is a CANN
FusedInferAttentionScore extern rather than generated kernels, folding per-head
QK-norm, RoPE, the paged KV write, the flash inner loop and the online softmax
into one mixed AIC+2xAIV task behind an FFTS barrier. Seven kernels go away
(`rope_qkv`, `qk_gamma`, `qk_recip`, `fa_work_build`, `fa_fused_aic`/`_aiv`,
`online_softmax`, `attn_fence`) and the harvested extern arrives under
`kernels/paged_attention_cce/`. Its `vendor/` subtree is CANN source under
Huawei copyright; the tree is copied verbatim, because `kernel/fai_body.hpp`
reaches its dependencies by relative include and splitting it would mean
re-patching on every refresh. Verbatim also means our header, formatting and
language lint must leave it alone, hence the carve-out.

That extern also moves the paged KV layout from NSND to vLLM's BSND
(`[page, token, kv_head, dim]`, so `slot_mapping` is directly the row index),
which the golden now models for both the attention read and the KV write-back.

The previous harvest needed one hand-edit, replacing a `[[block_local]] static`
in `fa_fused_aiv` that the AICore loader rejected. That kernel no longer exists
and the current codegen emits no such construct, so this harvest is unmodified
codegen throughout.

Verification: the case passes on device with output and all 40 layers' KV caches
matching the torch reference at RTOL=5e-2 / ATOL=1e-1, in ~5 min wall on an idle
die, with no ring-sizing overrides — per-layer intermediates live inside that
iteration's scope, so the live set does not grow with layer count. The fixture
is 38.05 GiB (24.61 weights + 13.44 paged KV) against 64 GiB of HBM.

The l0-swimlane docs used this example as their "real SPMD workload", shrinking
the generated fa_fused via `--set-arg 0=96` on its work-item count. The extern
takes its work distribution from runtime tiling metadata instead, so no
`--set-arg` shrinks it and those references are removed rather than repointed.
The dfx buffer-capacity row measured at 2 layers is dropped for the same reason:
it would now be a stale number rather than a wrong one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ChaoWao added a commit to ChaoWao/simpler-fork that referenced this pull request Jul 27, 2026
Fixes hw-native-sys#1484

The example carried pypto codegen last refreshed on 2026-06-25, cited a
provenance file upstream had deleted (`models/qwen3/14b/decode_layer.py`), and
covered 2 of Qwen3-14B's 40 layers. Re-harvested from `decode_fwd.py`'s
`decode_fwd_layers` at pypto-lib `45be52c` with `_CHUNK_NLAYERS = 40`, and the
README now records that commit plus the ptoas and pto-isa pins so the next drift
is detectable rather than archaeological.

Scaling to the full model is nearly free. The generated orchestration loops over
layers (`for (int64_t i = 0; i < 40; i += 1)`) instead of unrolling them, so
going from 2 to 40 moves a trip count and leaves the kernel set the same size.
The lib chunks its dispatches because a 40-layer one used to exceed a 2000 ms
stream-sync timeout; simpler raised that to 50 s in hw-native-sys#1175 and a 40-layer step is
~40 ms, so the constraint is gone.

What did change is attention. Since pypto-lib hw-native-sys#765 and hw-native-sys#796 it is a CANN
FusedInferAttentionScore extern rather than generated kernels, folding per-head
QK-norm, RoPE, the paged KV write, the flash inner loop and the online softmax
into one mixed AIC+2xAIV task behind an FFTS barrier. Seven kernels go away
(`rope_qkv`, `qk_gamma`, `qk_recip`, `fa_work_build`, `fa_fused_aic`/`_aiv`,
`online_softmax`, `attn_fence`) and the harvested extern arrives under
`kernels/paged_attention_cce/`. Its `vendor/` subtree is CANN source under
Huawei copyright; the tree is copied verbatim, because `kernel/fai_body.hpp`
reaches its dependencies by relative include and splitting it would mean
re-patching on every refresh. Verbatim also means our header, formatting and
language lint must leave it alone, hence the carve-out.

That extern also moves the paged KV layout from NSND to vLLM's BSND
(`[page, token, kv_head, dim]`, so `slot_mapping` is directly the row index),
which the golden now models for both the attention read and the KV write-back.

The previous harvest needed one hand-edit, replacing a `[[block_local]] static`
in `fa_fused_aiv` that the AICore loader rejected. That kernel no longer exists
and the current codegen emits no such construct, so this harvest is unmodified
codegen throughout.

Verification: the case passes on device with output and all 40 layers' KV caches
matching the torch reference at RTOL=5e-2 / ATOL=1e-1, in ~5 min wall on an idle
die, with no ring-sizing overrides — per-layer intermediates live inside that
iteration's scope, so the live set does not grow with layer count. The fixture
is 38.05 GiB (24.61 weights + 13.44 paged KV) against 64 GiB of HBM.

The l0-swimlane docs used this example as their "real SPMD workload", shrinking
the generated fa_fused via `--set-arg 0=96` on its work-item count. The extern
takes its work distribution from runtime tiling metadata instead, so no
`--set-arg` shrinks it and those references are removed rather than repointed.
The dfx buffer-capacity row measured at 2 layers is dropped for the same reason:
it would now be a stale number rather than a wrong one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ChaoWao added a commit to ChaoWao/simpler-fork that referenced this pull request Jul 27, 2026
Fixes hw-native-sys#1484

The example carried pypto codegen last refreshed on 2026-06-25, cited a
provenance file upstream had deleted (`models/qwen3/14b/decode_layer.py`), and
covered 2 of Qwen3-14B's 40 layers. Re-harvested from `decode_fwd.py`'s
`decode_fwd_layers` at pypto-lib `45be52c` with `_CHUNK_NLAYERS = 40`, and the
README now records that commit plus the ptoas and pto-isa pins so the next drift
is detectable rather than archaeological.

Scaling to the full model is nearly free. The generated orchestration loops over
layers (`for (int64_t i = 0; i < 40; i += 1)`) instead of unrolling them, so
going from 2 to 40 moves a trip count and leaves the kernel set the same size.
The lib chunks its dispatches because a 40-layer one used to exceed a 2000 ms
stream-sync timeout; simpler raised that to 50 s in hw-native-sys#1175 and a 40-layer step is
~40 ms, so the constraint is gone.

What did change is attention. Since pypto-lib hw-native-sys#765 and hw-native-sys#796 it is a CANN
FusedInferAttentionScore extern rather than generated kernels, folding per-head
QK-norm, RoPE, the paged KV write, the flash inner loop and the online softmax
into one mixed AIC+2xAIV task behind an FFTS barrier. Seven kernels go away
(`rope_qkv`, `qk_gamma`, `qk_recip`, `fa_work_build`, `fa_fused_aic`/`_aiv`,
`online_softmax`, `attn_fence`) and the harvested extern arrives under
`kernels/vendor/paged_attention_cce/`.

That extern needs CANN devkit headers, which nothing could express: every incore
compiled against the same fixed include set, even though
`KernelCompiler.compile_incore` has always taken `extra_include_dirs`. The
scene-test `CALLABLE` now carries a per-incore `extra_include_dirs`, resolved
when the kernel is compiled rather than when its module is imported — sim and
macOS runners collect a case declaring a CANN dependency without having CANN.
Entries may use `$VAR` and may name directories that do not exist here, so one
candidate list spans SDK layouts; an unset variable or a set where nothing
survived raises, which beats a "file not found" from four includes deep in
vendored code.

The harvested tree is copied verbatim and must stay that way: `fai_body.hpp`
reaches its dependencies by relative include, and reformatting it would make the
next refresh diff against our copy instead of against upstream — the exact drift
this example exists to expose. It therefore lives under `kernels/vendor/`, and
the repo's header, formatting and language lint skip anything below a `vendor/`
directory. Keying the carve-out on the directory rather than on this operator's
name means the next harvested extern needs no lint change at all.

The extern also moves the paged KV layout from NSND to vLLM's BSND
(`[page, token, kv_head, dim]`, so `slot_mapping` is directly the row index),
which the golden now models for both the attention read and the KV write-back.

The previous harvest needed one hand-edit, replacing a `[[block_local]] static`
in `fa_fused_aiv` that the AICore loader rejected. That kernel no longer exists
and the current codegen emits no such construct, so this harvest is unmodified
codegen throughout.

At 40 layers the case takes ~5 min against a 38.05 GiB fixture (24.61 weights +
13.44 paged KV, bf16) — over half the onboard sweep's 600 s session budget. It
runs as its own CI step on a dedicated device instead, keeping that sweep's short
timeout meaningful as a hang detector.

Verification: passes on device with output and all 40 layers' KV caches matching
the torch reference at RTOL=5e-2 / ATOL=1e-1, with no ring-sizing overrides —
per-layer intermediates live inside that iteration's scope, so the live set does
not grow with layer count.

The l0-swimlane docs used this example as their "real SPMD workload", shrinking
the generated fa_fused via `--set-arg 0=96` on its work-item count. The extern
takes its work distribution from runtime tiling metadata instead, so no
`--set-arg` shrinks it and those references are removed rather than repointed.
The dfx buffer-capacity row measured at 2 layers is dropped for the same reason:
it would now be a stale number rather than a wrong one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ChaoWao added a commit that referenced this pull request Jul 27, 2026
)

Fixes #1484

The example carried pypto codegen last refreshed on 2026-06-25, cited a
provenance file upstream had deleted (`models/qwen3/14b/decode_layer.py`), and
covered 2 of Qwen3-14B's 40 layers. Re-harvested from `decode_fwd.py`'s
`decode_fwd_layers` at pypto-lib `45be52c` with `_CHUNK_NLAYERS = 40`, and the
README now records that commit plus the ptoas and pto-isa pins so the next drift
is detectable rather than archaeological.

Scaling to the full model is nearly free. The generated orchestration loops over
layers (`for (int64_t i = 0; i < 40; i += 1)`) instead of unrolling them, so
going from 2 to 40 moves a trip count and leaves the kernel set the same size.
The lib chunks its dispatches because a 40-layer one used to exceed a 2000 ms
stream-sync timeout; simpler raised that to 50 s in #1175 and a 40-layer step is
~40 ms, so the constraint is gone.

What did change is attention. Since pypto-lib #765 and #796 it is a CANN
FusedInferAttentionScore extern rather than generated kernels, folding per-head
QK-norm, RoPE, the paged KV write, the flash inner loop and the online softmax
into one mixed AIC+2xAIV task behind an FFTS barrier. Seven kernels go away
(`rope_qkv`, `qk_gamma`, `qk_recip`, `fa_work_build`, `fa_fused_aic`/`_aiv`,
`online_softmax`, `attn_fence`) and the harvested extern arrives under
`kernels/vendor/paged_attention_cce/`.

That extern needs CANN devkit headers, which nothing could express: every incore
compiled against the same fixed include set, even though
`KernelCompiler.compile_incore` has always taken `extra_include_dirs`. The
scene-test `CALLABLE` now carries a per-incore `extra_include_dirs`, resolved
when the kernel is compiled rather than when its module is imported — sim and
macOS runners collect a case declaring a CANN dependency without having CANN.
Entries may use `$VAR` and may name directories that do not exist here, so one
candidate list spans SDK layouts; an unset variable or a set where nothing
survived raises, which beats a "file not found" from four includes deep in
vendored code.

The harvested tree is copied verbatim and must stay that way: `fai_body.hpp`
reaches its dependencies by relative include, and reformatting it would make the
next refresh diff against our copy instead of against upstream — the exact drift
this example exists to expose. It therefore lives under `kernels/vendor/`, and
the repo's header, formatting and language lint skip anything below a `vendor/`
directory. Keying the carve-out on the directory rather than on this operator's
name means the next harvested extern needs no lint change at all.

The extern also moves the paged KV layout from NSND to vLLM's BSND
(`[page, token, kv_head, dim]`, so `slot_mapping` is directly the row index),
which the golden now models for both the attention read and the KV write-back.

The previous harvest needed one hand-edit, replacing a `[[block_local]] static`
in `fa_fused_aiv` that the AICore loader rejected. That kernel no longer exists
and the current codegen emits no such construct, so this harvest is unmodified
codegen throughout.

At 40 layers the case takes ~5 min against a 38.05 GiB fixture (24.61 weights +
13.44 paged KV, bf16) — over half the onboard sweep's 600 s session budget. It
runs as its own CI step on a dedicated device instead, keeping that sweep's short
timeout meaningful as a hang detector.

Verification: passes on device with output and all 40 layers' KV caches matching
the torch reference at RTOL=5e-2 / ATOL=1e-1, with no ring-sizing overrides —
per-layer intermediates live inside that iteration's scope, so the live set does
not grow with layer count.

The l0-swimlane docs used this example as their "real SPMD workload", shrinking
the generated fa_fused via `--set-arg 0=96` on its work-item count. The extern
takes its work distribution from runtime tiling metadata instead, so no
`--set-arg` shrinks it and those references are removed rather than repointed.
The dfx buffer-capacity row measured at 2 layers is dropped for the same reason:
it would now be a stale number rather than a wrong one.
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.

[Feature] Raise compiled timeout defaults to production-friendly values; CI restores tight values via #1127 env overrides

2 participants