Skip to content

test(dfx): mirror a2a3 DFX scene tests to a5#1246

Merged
ChaoZheng109 merged 1 commit into
hw-native-sys:mainfrom
doraemonmj:dfx-mirror-a5
Jul 2, 2026
Merged

test(dfx): mirror a2a3 DFX scene tests to a5#1246
ChaoZheng109 merged 1 commit into
hw-native-sys:mainfrom
doraemonmj:dfx-mirror-a5

Conversation

@doraemonmj

Copy link
Copy Markdown
Contributor

What

a5 only had dep_gen under tensormap_and_ringbuffer/dfx. This mirrors the
remaining a2a3 DFX scene tests so the two arches stay aligned:

  • args_dump--dump-args capture + manifest schema
  • l2_swimlane — swimlane records + mixed AIC/AIV variant
  • pmu--enable-pmu pmu.csv
  • scope_stats--enable-scope-stats NDJSON

Verbatim copies for the platform-agnostic helpers and orchestration kernels;
test files only swap the platform tokens (examples/a2a3examples/a5,
["a2a3sim","a2a3"]["a5sim","a5"], src/a2a3src/a5). All required
a5 platform collectors and example/mixed_example kernels already exist.

Test

All 7 a5 DFX cases pass on a5 hardware:

```
7 passed in 41.01s
```

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jul 2, 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: c9c86ae1-2013-4b66-be9d-46338df8cbca

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 adds new system-test suites under tensormap_and_ringbuffer/dfx covering args_dump, l2_swimlane, pmu, and scope_stats features. It introduces two orchestration kernels (partial_dump_orch.cpp, chained_mix_orch.cpp), a shared swimlane validation helper, and five new pytest scene-test modules validating dump/profiling artifacts.

Changes

DFX test suites

Layer / File(s) Summary
Args dump orchestration kernel and test
tests/st/a5/tensormap_and_ringbuffer/dfx/args_dump/kernels/orchestration/partial_dump_orch.cpp, tests/st/a5/tensormap_and_ringbuffer/dfx/args_dump/test_args_dump.py
Adds an orchestration kernel exercising multiple dump() selection modes (no-arg, scalar-only, ambiguous) and a test validating args_dump.json manifest schema, task/arg indices, func_id ranges, and dump_viewer compatibility.
Shared L2 swimlane validation helper
tests/st/a5/tensormap_and_ringbuffer/dfx/l2_swimlane/__init__.py, tests/st/a5/tensormap_and_ringbuffer/dfx/l2_swimlane/_swimlane_validate.py
Adds validate_perf_artifact and verify_sched_overhead_differential, cross-checking l2_swimlane_records.json against swimlane_converter and sched_overhead_analysis tool output including pop/fanout/fanin oracle comparisons.
L2 swimlane orchestration kernel and tests
.../l2_swimlane/kernels/orchestration/chained_mix_orch.cpp, .../l2_swimlane/test_l2_swimlane.py, .../l2_swimlane/test_l2_swimlane_mixed.py
Adds a 3-step chained MIX orchestration kernel using workspace slots, plus two scene tests validating swimlane artifacts and dumped func_id/duplicate-payload consistency.
PMU profiling test
tests/st/a5/tensormap_and_ringbuffer/dfx/pmu/test_pmu.py
Adds a scene test validating pmu.csv header prefix and row presence when --enable-pmu is set.
Scope stats test
tests/st/a5/tensormap_and_ringbuffer/dfx/scope_stats/test_scope_stats.py
Adds a scene test validating scope_stats.jsonl schema fields, required record fields, and minimum scope-boundary record counts when --enable-scope-stats is set.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant TestArgsDump
  participant partial_dump_orch
  participant args_dump.json
  participant dump_viewer

  TestArgsDump->>partial_dump_orch: run kernel with --dump-args
  partial_dump_orch->>args_dump.json: emit tensor/scalar dump records
  TestArgsDump->>args_dump.json: parse manifest
  TestArgsDump->>TestArgsDump: validate func_id, task_id, arg_index
  TestArgsDump->>dump_viewer: run subprocess smoke check
Loading
sequenceDiagram
  participant Test
  participant validate_perf_artifact
  participant l2_swimlane_records.json
  participant sched_overhead_analysis
  participant verify_sched_overhead_differential

  Test->>validate_perf_artifact: run(case_label)
  validate_perf_artifact->>l2_swimlane_records.json: read_perf_data
  validate_perf_artifact->>sched_overhead_analysis: run subprocess with deps.json
  sched_overhead_analysis-->>validate_perf_artifact: stdout metrics
  validate_perf_artifact->>verify_sched_overhead_differential: compare oracle vs stdout
Loading

Possibly related PRs

  • hw-native-sys/simpler#792: Adds the unified args_dump.json schema/behavior directly exercised by this PR's new partial-dump orchestration kernel and test.
  • hw-native-sys/simpler#1028: Introduces the selective scalar Arg::dump behavior specifically exercised by the new mixed/ambiguous dump() test cases here.
  • hw-native-sys/simpler#1072: Provides the renamed dump-args APIs/artifacts and dump-viewer expectations that this PR's tests rely on.

Poem

A rabbit hops through logs so neat,
Dump files stacked in tidy sheets,
Swimlanes trace each task's swift race,
PMU counts at steady pace,
Scope stats bloom in JSONL trails,
Three cheers for tests that never fail! 🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: mirroring DFX scene tests from a2a3 to a5.
Description check ✅ Passed The description matches the changeset and clearly describes the mirrored a5 DFX tests and added coverage.
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.

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 adds system tests for DFX profiling features on the tensormap_and_ringbuffer runtime. It introduces orchestration kernels and test cases to validate argument dumping (args_dump), L2 swimlane profiling (l2_swimlane) for AIV-only and mixed AIC+AIV chained workloads, PMU profiling (pmu), and scope statistics (scope_stats). These tests verify the correct generation and schema of profiling artifacts such as args_dump.json, l2_swimlane_records.json, pmu.csv, and scope_stats.jsonl. There are no review comments provided, so I have no feedback to address.

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.

@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: 3

🧹 Nitpick comments (1)
tests/st/a5/tensormap_and_ringbuffer/dfx/scope_stats/test_scope_stats.py (1)

53-88: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Optional: mutable default class attributes flagged by Ruff (RUF012).

CALLABLE (Line 53-79) and CASES (Line 81-88) are mutable dict/list class attributes without ClassVar annotation. Since these are read-only declarative metadata consumed by the scene_test framework and mirror the pattern used across sibling DFX test files, this is low-risk, but you could silence the hint with typing.ClassVar annotations if the team wants a clean lint pass.

🤖 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 `@tests/st/a5/tensormap_and_ringbuffer/dfx/scope_stats/test_scope_stats.py`
around lines 53 - 88, The class-level declarative metadata in the test scope
stats fixture is being flagged as mutable default attributes by Ruff. Update the
test class that defines CALLABLE and CASES to annotate these attributes with
typing.ClassVar so Ruff recognizes them as intentional read-only metadata,
keeping the existing structure and names used by the scene_test framework.

Source: Linters/SAST tools

🤖 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/st/a5/tensormap_and_ringbuffer/dfx/l2_swimlane/_swimlane_validate.py`:
- Around line 60-65: The validation helper in validate_perf_artifact currently
returns silently when no matching output directory is found, which lets broken
captures pass unnoticed. Update validate_perf_artifact to fail loudly when
matches is empty instead of returning, so test_l2_swimlane.py and
test_l2_swimlane_mixed.py surface missing output directories or sanitize
mismatches. Keep the existing l2_swimlane_records.json existence check, but make
the no-match path assert with a clear error message tied to _outputs_dir and
_sanitize_for_filename.

In `@tests/st/a5/tensormap_and_ringbuffer/dfx/pmu/test_pmu.py`:
- Line 16: The smoke test in test_pmu.py only checks header membership instead
of the documented ordered prefix, so a reordered header can still pass. Update
the header validation logic in the smoke/assertion path to verify that the
leading columns in the parsed header match the expected prefix in order, using
the existing header-related checks around the documented header assertion rather
than just `header_cols` membership.
- Around line 92-98: The artifact lookup in _validate_pmu_artifact can silently
pass when no output directory is found and can also validate a stale directory
from a prior run. Change the logic so the test fails explicitly if
_outputs_dir().glob(...) returns no matches, and ensure the selected directory
corresponds to the current test invocation rather than just the newest mtime
entry; use the existing _sanitize_for_filename and _outputs_dir helpers to
locate the current PMU run and assert against that exact directory before
checking pmu.csv.

---

Nitpick comments:
In `@tests/st/a5/tensormap_and_ringbuffer/dfx/scope_stats/test_scope_stats.py`:
- Around line 53-88: The class-level declarative metadata in the test scope
stats fixture is being flagged as mutable default attributes by Ruff. Update the
test class that defines CALLABLE and CASES to annotate these attributes with
typing.ClassVar so Ruff recognizes them as intentional read-only metadata,
keeping the existing structure and names used by the scene_test framework.
🪄 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: 844342b8-b714-4e1f-86c1-21f49ff33e5c

📥 Commits

Reviewing files that changed from the base of the PR and between c506ff2 and 423dff8.

📒 Files selected for processing (9)
  • tests/st/a5/tensormap_and_ringbuffer/dfx/args_dump/kernels/orchestration/partial_dump_orch.cpp
  • tests/st/a5/tensormap_and_ringbuffer/dfx/args_dump/test_args_dump.py
  • tests/st/a5/tensormap_and_ringbuffer/dfx/l2_swimlane/__init__.py
  • tests/st/a5/tensormap_and_ringbuffer/dfx/l2_swimlane/_swimlane_validate.py
  • tests/st/a5/tensormap_and_ringbuffer/dfx/l2_swimlane/kernels/orchestration/chained_mix_orch.cpp
  • tests/st/a5/tensormap_and_ringbuffer/dfx/l2_swimlane/test_l2_swimlane.py
  • tests/st/a5/tensormap_and_ringbuffer/dfx/l2_swimlane/test_l2_swimlane_mixed.py
  • tests/st/a5/tensormap_and_ringbuffer/dfx/pmu/test_pmu.py
  • tests/st/a5/tensormap_and_ringbuffer/dfx/scope_stats/test_scope_stats.py

Comment on lines +60 to +65
safe_label = _sanitize_for_filename(case_label)
matches = sorted(_outputs_dir().glob(f"{safe_label}_*"), key=lambda p: p.stat().st_mtime)
if not matches:
return
perf = matches[-1] / "l2_swimlane_records.json"
assert perf.exists(), f"l2_swimlane_records.json missing under {matches[-1]} — swimlane capture failed?"

@coderabbitai coderabbitai Bot Jul 2, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Silent no-op when the output directory isn't found masks broken validation.

If matches is empty (e.g. label/sanitize mismatch, or the case failed to produce an output dir), validate_perf_artifact just returns without asserting anything. Callers (test_l2_swimlane.py, test_l2_swimlane_mixed.py) treat this as a green test, defeating the purpose of the differential gate — a capture regression that also breaks directory creation would silently pass instead of failing loudly.

💡 Suggested fix: fail loudly instead of silently skipping
     safe_label = _sanitize_for_filename(case_label)
     matches = sorted(_outputs_dir().glob(f"{safe_label}_*"), key=lambda p: p.stat().st_mtime)
-    if not matches:
-        return
+    assert matches, f"no output directory found for case '{case_label}' (glob: {safe_label}_*)"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
safe_label = _sanitize_for_filename(case_label)
matches = sorted(_outputs_dir().glob(f"{safe_label}_*"), key=lambda p: p.stat().st_mtime)
if not matches:
return
perf = matches[-1] / "l2_swimlane_records.json"
assert perf.exists(), f"l2_swimlane_records.json missing under {matches[-1]} — swimlane capture failed?"
safe_label = _sanitize_for_filename(case_label)
matches = sorted(_outputs_dir().glob(f"{safe_label}_*"), key=lambda p: p.stat().st_mtime)
assert matches, f"no output directory found for case '{case_label}' (glob: {safe_label}_*)"
perf = matches[-1] / "l2_swimlane_records.json"
assert perf.exists(), f"l2_swimlane_records.json missing under {matches[-1]} — swimlane capture failed?"
🤖 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 `@tests/st/a5/tensormap_and_ringbuffer/dfx/l2_swimlane/_swimlane_validate.py`
around lines 60 - 65, The validation helper in validate_perf_artifact currently
returns silently when no matching output directory is found, which lets broken
captures pass unnoticed. Update validate_perf_artifact to fail loudly when
matches is empty instead of returning, so test_l2_swimlane.py and
test_l2_swimlane_mixed.py surface missing output directories or sanitize
mismatches. Keep the existing l2_swimlane_records.json existence check, but make
the no-match path assert with a clear error message tied to _outputs_dir and
_sanitize_for_filename.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

由于是A2A3与A5共有的,后续pr统一修改

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@doraemonmj, understood — deferring this to a follow-up PR that unifies the fix across both a2a3 and a5 makes sense given the shared helper. Let me know if you'd like me to open a tracking issue for this so it doesn't get lost.


🧠 Learnings used
Learnt from: poursoul
Repo: hw-native-sys/simpler PR: 1093
File: python/simpler/task_interface.py:34-44
Timestamp: 2026-06-22T03:34:22.769Z
Learning: In this repository (hw-native-sys/simpler), treat renamed public Python types/classes as a hard rename: when a type is renamed (e.g., ContinuousTensor → Tensor), remove the old name across the repo rather than adding backward-compatibility aliases for the old symbol. Also, when a PR claims “behavioral non-breaking,” interpret that as runtime/wire semantics only (not Python public API name stability); do not flag the PR for breaking Python API symbol names as long as runtime/wire behavior is preserved.

the AICore counters land in ``<output_prefix>/pmu.csv``, one data row per
task. The schema is fixed (see docs/dfx/pmu-profiling.md and
src/a5/platform/shared/host/pmu_collector.cpp's "Build CSV header"
block). Smoke asserts: file exists, header starts with the documented

@coderabbitai coderabbitai Bot Jul 2, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Header check doesn't verify the documented "starts with" ordering.

The docstring claims the smoke test asserts the header "header starts with the documented prefix", but the implementation only checks that each required column exists somewhere in header_cols (membership), not that they appear as a leading, ordered prefix. A header with the same columns in a different order would incorrectly pass.

🐛 Proposed fix to check prefix order
-        header_cols = lines[0].split(",")
-        for col in _REQUIRED_HEADER_PREFIX:
-            assert col in header_cols, f"header missing required column '{col}': {header_cols}"
+        header_cols = lines[0].split(",")
+        actual_prefix = tuple(header_cols[: len(_REQUIRED_HEADER_PREFIX)])
+        assert actual_prefix == _REQUIRED_HEADER_PREFIX, (
+            f"header does not start with required prefix {_REQUIRED_HEADER_PREFIX}: {header_cols}"
+        )

Also applies to: 101-103

🤖 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 `@tests/st/a5/tensormap_and_ringbuffer/dfx/pmu/test_pmu.py` at line 16, The
smoke test in test_pmu.py only checks header membership instead of the
documented ordered prefix, so a reordered header can still pass. Update the
header validation logic in the smoke/assertion path to verify that the leading
columns in the parsed header match the expected prefix in order, using the
existing header-related checks around the documented header assertion rather
than just `header_cols` membership.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

由于是A2A3与A5共有的,后续pr统一修改

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@doraemonmj, understood — thanks for confirming this is shared between A2A3 and A5, and that the ordered-prefix fix will be addressed together in a follow-up PR. No action needed here for now.


🧠 Learnings used
Learnt from: poursoul
Repo: hw-native-sys/simpler PR: 1093
File: python/simpler/task_interface.py:34-44
Timestamp: 2026-06-22T03:34:22.769Z
Learning: In this repository (hw-native-sys/simpler), treat renamed public Python types/classes as a hard rename: when a type is renamed (e.g., ContinuousTensor → Tensor), remove the old name across the repo rather than adding backward-compatibility aliases for the old symbol. Also, when a PR claims “behavioral non-breaking,” interpret that as runtime/wire semantics only (not Python public API name stability); do not flag the PR for breaking Python API symbol names as long as runtime/wire behavior is preserved.

Comment on lines +92 to +98
def _validate_pmu_artifact(self, case):
safe_label = _sanitize_for_filename(f"TestPmu_{case['name']}")
matches = sorted(_outputs_dir().glob(f"{safe_label}_*"), key=lambda p: p.stat().st_mtime)
if not matches:
return
csv = matches[-1] / "pmu.csv"
assert csv.exists(), f"pmu.csv missing under {matches[-1]} — PMU capture failed?"

@coderabbitai coderabbitai Bot Jul 2, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Silent skip + stale-directory risk in artifact lookup.

Two issues in _validate_pmu_artifact:

  • Line 95-96: if no output directory matches the glob, the method silently returns without any assertion — a capture failure that fails to even produce an output dir would pass the test instead of failing it.
  • Line 94: matches[-1] picks the most recent directory by mtime, but does not confirm it corresponds to the current test invocation. A stale directory left over from a prior run/session with the same case label would satisfy the glob and be validated instead of (or in addition to) the current run's actual output, masking a real capture regression in the current run.
🐛 Proposed fix to fail-fast instead of silently skipping
         safe_label = _sanitize_for_filename(f"TestPmu_{case['name']}")
         matches = sorted(_outputs_dir().glob(f"{safe_label}_*"), key=lambda p: p.stat().st_mtime)
-        if not matches:
-            return
+        assert matches, f"no output directory found for {safe_label}_* — PMU output not produced?"
         csv = matches[-1] / "pmu.csv"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def _validate_pmu_artifact(self, case):
safe_label = _sanitize_for_filename(f"TestPmu_{case['name']}")
matches = sorted(_outputs_dir().glob(f"{safe_label}_*"), key=lambda p: p.stat().st_mtime)
if not matches:
return
csv = matches[-1] / "pmu.csv"
assert csv.exists(), f"pmu.csv missing under {matches[-1]} — PMU capture failed?"
def _validate_pmu_artifact(self, case):
safe_label = _sanitize_for_filename(f"TestPmu_{case['name']}")
matches = sorted(_outputs_dir().glob(f"{safe_label}_*"), key=lambda p: p.stat().st_mtime)
assert matches, f"no output directory found for {safe_label}_* — PMU output not produced?"
csv = matches[-1] / "pmu.csv"
assert csv.exists(), f"pmu.csv missing under {matches[-1]} — PMU capture failed?"
🤖 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 `@tests/st/a5/tensormap_and_ringbuffer/dfx/pmu/test_pmu.py` around lines 92 -
98, The artifact lookup in _validate_pmu_artifact can silently pass when no
output directory is found and can also validate a stale directory from a prior
run. Change the logic so the test fails explicitly if _outputs_dir().glob(...)
returns no matches, and ensure the selected directory corresponds to the current
test invocation rather than just the newest mtime entry; use the existing
_sanitize_for_filename and _outputs_dir helpers to locate the current PMU run
and assert against that exact directory before checking pmu.csv.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

由于是A2A3与A5共有的,后续pr统一修改

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@doraemonmj, understood — thanks for the context. Since this logic is shared between the a2a3 and a5 scenes, deferring the fix to a follow-up PR that updates both consistently makes sense. I'll hold off on further pushback here.


🧠 Learnings used
Learnt from: poursoul
Repo: hw-native-sys/simpler PR: 1093
File: python/simpler/task_interface.py:34-44
Timestamp: 2026-06-22T03:34:22.769Z
Learning: In this repository (hw-native-sys/simpler), treat renamed public Python types/classes as a hard rename: when a type is renamed (e.g., ContinuousTensor → Tensor), remove the old name across the repo rather than adding backward-compatibility aliases for the old symbol. Also, when a PR claims “behavioral non-breaking,” interpret that as runtime/wire semantics only (not Python public API name stability); do not flag the PR for breaking Python API symbol names as long as runtime/wire behavior is preserved.

@doraemonmj

doraemonmj commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

当前 a5 DFX 用例测试内容梳理

本 PR 镜像过来的 7 个用例各自校验的内容(便于后续查漏补缺):

用例 触发标志 工作负载 断言内容
args_dump --dump-args {1,2,3} partial_dump_orch(5 task,4 个带 dump(...) 标记) args_dump/args_dump.json 存在且可解析;bin_file 指向的文件存在且非空;统一 schema(每条含 kind,无 legacy tensor_dump.json/kernel_args_dump.json);func_id 数组落在声明范围 0/1/2 且覆盖全部已派发 kernel;level 1(partial):精确 7 条 tensor 条目 + 逐 task 的 tensor/scalar 选择(no-arg dump() 全选、scalar-only、mixed 排除 input e、重复 scalar 标记为 ambiguous);level 2/3(full):标记被忽略,5 个 task 全 dump;level 3:bin_file=null、不写 args.binbin_size==0
l2_swimlane --enable-l2-swimlane vector_example(5 task,AIV-only) l2_swimlane_records.json schema(l2_swimlane_level ∈ {1..4}、每条记录必需字段);swimlane_converter 工具 smoke;sched_overhead_analysis 工具 smoke(输出含各 section header、Avg scheduler loop iteration > 0);差分门禁:解析脚本打印的 Pop hit/miss、Fanout、Fanin 与 oracle 交叉核对
l2_swimlane_mixed --enable-l2-swimlane chained_mix_orch(3 步,每步 AIC matmul + AIV add) 同上 swimlane 校验(补足 AIV-only 缺失的 MIX/AIC 泳道 + DAG stats);外加 #1181:每个 MIX task 是 2-way 协作(func 0 MATMUL + func 1 AIV ADD)共享 6-tensor payload,每条 dump 的 func_id == [0,1],payload slot 不重复
pmu --enable-pmu N vector_example(5 task) pmu.csv 存在且非空;header 以文档化的必需列前缀开头(thread_id, core_id, task_id, func_id, core_type, pmu_total_cycles);至少 1 行数据行
scope_stats --enable-scope-stats vector_example(outer executor scope + 1 个内层 PTO2_SCOPE()) scope_stats/scope_stats.jsonl 存在非空;metadata version==6fatal==falsedropped==0、含 dep_pool_max;≥4 条 begin/end 记录,每条含必需字段(task/heap/dep_pool start-end)
dep_gen --enable-dep-gen vector_example deps.json 由 host replay 产出,含 example_orchestration.cpp 文档化的精确 6 条边;capture 路径(submit_trace.bin)隐式覆盖
dep_gen_chain --enable-dep-gen chain_barrier_orch(N 生产者 INOUT X + 1 barrier,>64 显式 dep) 溢出链回归:barrier task 在 deps.json 中必须恰好有 N 个前驱,验证每条显式 dep 边跨 writer→host collector→replay→deps.json 往返不被截断(n=64 基线 / >64 触发 chain)

⚠️ 可能的遗漏点(后续可提 issue 弥补)

  1. CI 未给 a5 DFX 挂载 per-feature smoke step。 .github/workflows/ci.yml 里 a2a3 有 4 个专门的带标志 step(dep_gen smoke / l2_swimlane smoke / PMU smoke / args_dump smoke),而 st-sim-a5 job 只跑默认 pytest examples tests/st --platform a5sim,不带任何 --enable-*。这些用例在没有对应标志时校验逻辑是 skip/no-op 的 —— 因此当前这批 a5 DFX 用例在 CI 里只被收集、不被真正校验。要真正获得覆盖,需要在 st-sim-a5 下补齐对应的 4 个 smoke step(镜像 a2a3 的写法,路径换成 tests/st/a5/...)。

本地验证

7 个 a5 DFX 用例已在 a5 真实硬件通过(第 6 张卡,task-submit --device 5,mj conda 环境),各用例均带上对应 --enable-* 标志:7 passed in 41.01s

a5 only had dep_gen under tensormap_and_ringbuffer/dfx. Mirror the
remaining a2a3 DFX cases so the two arches stay aligned:

- args_dump  (--dump-args capture + manifest schema)
- l2_swimlane (swimlane records + mixed AIC/AIV variant)
- pmu        (--enable-pmu pmu.csv)
- scope_stats (--enable-scope-stats NDJSON)

Verbatim copies for the platform-agnostic helpers and orchestration
kernels; test files only swap the platform tokens (examples/a2a3 ->
examples/a5, ["a2a3sim","a2a3"] -> ["a5sim","a5"], src/a2a3 -> src/a5).
All required a5 platform collectors and example/mixed_example kernels
already exist. Collected clean on a5sim.
@ChaoZheng109 ChaoZheng109 merged commit 4d5fbe4 into hw-native-sys:main Jul 2, 2026
16 checks passed
@doraemonmj doraemonmj deleted the dfx-mirror-a5 branch July 2, 2026 07:54
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