Skip to content

Refactor: bind the a2a3 hbg dep_gen test to its own output dir - #2132

Merged
ChaoWao merged 1 commit into
hw-native-sys:mainfrom
ChaoWao:hbg-depgen-outdir-snapshot
Sep 5, 2026
Merged

Refactor: bind the a2a3 hbg dep_gen test to its own output dir#2132
ChaoWao merged 1 commit into
hw-native-sys:mainfrom
ChaoWao:hbg-depgen-outdir-snapshot

Conversation

@ChaoWao

@ChaoWao ChaoWao commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Both classes in the a2a3 host_build_graph dep_gen test located this invocation's output directory by comparing st_mtime against a second-granularity marker taken before the run:

run_marker = int(time.time())  # floor to whole seconds
matches = [p for p in outputs.glob(f"{safe_label}_*") if p.stat().st_mtime >= run_marker]
out_dir = max(matches, key=lambda p: p.stat().st_mtime)

Two problems, one shape: the floor to whole seconds means a leftover directory from an earlier run in the same second also matches, and a run that emitted nothing then silently validated that stale deps.json rather than failing. The case has accumulated 32 such directories on this dev box, so the leftovers are not hypothetical — only the collision window is narrow.

Identify the directory by set difference against a pre-run snapshot instead: only a directory this invocation created can appear in it, and an empty difference is the assertion failure it should always have been.

This is exactly the pattern #2082 introduced on the a5 side of the same test. The a2a3 copy is what was left behind, so the two halves of one test now read the same. import time goes with the marker.

Follow-up to #2126 / #2082; no production code changes.

Testing

The point of the change is an assertion that must fire where the old one did not, so it was checked directly rather than only by the suite going green. Passing the current directory set as dirs_before_run models "this run emitted nothing":

existing dirs for this case: 32
CONTROL FIRED: --enable-dep-gen is on and case 'default' ran, but no output dir
               was created this run — capture pipeline regression
accepts a fresh dir: tasks = 5 edges = 6

So it refuses an empty run and still accepts a genuine fresh directory. Under the old mtime logic the first case passed on stale data.

  • tests/st/a2a3/host_build_graph/dfx/dep_gen/ on a2a3sim — 2 passed
  • All DFX channels, one per invocation as CI runs them: 12 runs across a2a3sim/a5sim — no failures
  • a2a3 onboard (real silicon, via task-submit): all 7 channels, ONBOARD_DFX_RC=0
  • a2a3sim sweep — 44 passed; the one failure (TestSpmdPagedAttentionHighPerf::b4_h32_kv8_s512_bs128_fp16, max_diff=0.0625) is pre-existing and manual-only, reproduced identically on a clean base build, so the per-PR lane deselects it
  • ruff, ruff format, pyright

@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 42 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 4ef334ee-41b1-49f9-88ae-f0dd62a35e7f

📥 Commits

Reviewing files that changed from the base of the PR and between 222062e and 4054194.

📒 Files selected for processing (1)
  • tests/st/a2a3/host_build_graph/dfx/dep_gen/test_dep_gen.py

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.

Both test classes located this invocation's output directory by comparing
mtime against a second-granularity marker taken before the run. That
comparison floors to whole seconds, so a leftover directory from an earlier
run in the same second also matches — and a run that emitted nothing then
silently validated that stale deps.json instead of failing. The case has
accumulated 32 such directories on this box, so the leftovers are not
hypothetical.

Identify the directory by set difference against a pre-run snapshot: only a
directory this invocation created can be in it, and an empty difference is
the assertion failure it should always have been.

This is the pattern hw-native-sys#2082 introduced on the a5 side of the same test; the
a2a3 copy is what was left behind, so the two halves of one test now read
the same. `import time` goes with the marker.
@ChaoWao
ChaoWao merged commit 9475dc3 into hw-native-sys:main Sep 5, 2026
17 checks passed
@ChaoWao
ChaoWao deleted the hbg-depgen-outdir-snapshot branch September 5, 2026 03:21
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.

1 participant