Skip to content

tools: count a comparison binary's faults from its post-load prompt - #729

Merged
juliankang4 merged 5 commits into
midagedev:mainfrom
juliankang4:fix-binary-timed-fault-window
Oct 23, 2026
Merged

juliankang4 merged 5 commits into
midagedev:mainfrom
juliankang4:fix-binary-timed-fault-window

Conversation

@juliankang4

Copy link
Copy Markdown
Collaborator

비교 도구가 binary 비교 arm의 모델 적재 중 page fault를 추론 구간 fault로 세어 정상 binary를 cold로 거부하던 문제를 고칩니다.

Part of #565. Tracked in #699.

What and why

tools/ref/depth-qwen3moe.sh counts a row's major page faults over the row's timed window and tags the row [cold] when the count crosses a threshold. A bin: arm (a second binary) and an arm under mem= ran generate_qwen3moe --tokens, which prints prompt_ids before it loads the model. The runner had no marker for the end of the load, so it charged the whole process, load included, to the timed window. The row showed this as timed ? (a one-arm run prints its prompt ids before its load: the whole process).

A binary that faulted only while loading was therefore tagged cold. Under BLOOMERY_WARM_ROWS=1 it was retried and then dropped as FAIL ... rc=cold, so a binary with a healthy timed window could be rejected from a comparison. The whole-process fallback came in with eb7f26d07, and the warm retry and drop policy with b37c3f73b.

The runner now asks each bin: or current-binary arm whether it supports --arm, by running it with a value-less --arm and CUDA_VISIBLE_DEVICES=-1. The parser refuses that argument with generate_qwen3moe: --arm needs a value and exit code 1, before it opens a file or a GPU. Only that exact message with exit code 1 counts as support. Supporting arms run with --arm, which prints prompt_ids after the load, and the existing majflt_mark, LG_FED_RE and lease_filter start the timed fault count there. The whole-process count is kept beside it. An arm whose binary does not answer the probe that way, or whose run prints no marker, keeps the whole-process count and the row says timed ?. The cold_check threshold, the retry and drop rules and the refusal of mem= with warm rows are unchanged.

tools/ref/depth-qwen3moe-stub.sh gains a fault-windows group (--fault-windows runs only it): load-only faults, timed faults, a binary without --arm, a missing marker, a probe that exits with another code, and the same cases under mem= for both the comparison binary and the current binary. The stub's two build trees are the same fixture, so its runs now declare the existing BLOOMERY_AB_AA=1. The existing majflt case now expects timed 0 for the comparison binary's row.

Release notes: Fixed: a comparison binary's load-time page faults no longer count against its timed window, so it is no longer rejected as cold when only its load faulted.

Code shape

  • No second copy. The fix reuses majflt_mark, LG_FED_RE and lease_filter. bin: and mem= arms share ours_arm.
  • Model code holds only architecture facts. No model code changes.
  • Dead code is gone. The pre-load marker text and its comments are replaced.
  • No silent failure. An arm the probe cannot confirm, or a run with no marker, is labelled timed ? and judged on the whole process.
  • Comments state what is true now.
  • No relaxed gate. The cold threshold and the retry and drop rules are unchanged.
  • cargo fmt and cargo clippy are clean on what I touched; the lint count did not go up. No Rust file changed; I checked the two shell files with bash -n and the self-test below.

Duplication found or removed (path:line): none.

What I ran

Self-test of the runner against fixture binaries, on Linux:

DEPTH_QWEN3MOE_STUB_SHOW=0 DEPTH_QWEN3MOE_RUNNER=<main's tools/ref/depth-qwen3moe.sh> \
  bash tools/ref/depth-qwen3moe-stub.sh --fault-windows
depth-qwen3moe-stub: 9 checks, 4 failed

The four failures on the old runner were bin-load-faults (the load-only run was rejected), bin-timed-faults (the timed count was not separated), and mem-faults-load and mem-faults-timed (the same two cases under mem=).

A second FAIL-first covers the probe's exit-code check, run against the change without that check:

depth-qwen3moe-stub: 9 checks, 2 failed

Those were bin-fallback-PROBE_RC-70 (a probe that exits with code 70 was taken as support) and mem-faults-legacy (a capped current binary without --arm).

With this change:

DEPTH_QWEN3MOE_STUB_SHOW=1 bash tools/ref/depth-qwen3moe-stub.sh
depth-qwen3moe-stub: 95 checks, 0 failed

In that run the load-only bin: row reads majflt 100000 (timed 0; and keeps its mean, and the timed-fault row is tagged cold and rejected. The binary without --arm, the missing marker and the unrecognized probe results keep timed ? and the whole-process count. Both mem= arms follow the same pattern.

Not run here: the repository's full check loop, cargo clippy and a comparison on a real model. The self-test uses fixture binaries. Its mem= cases cover how arguments reach the arm and where the fault window starts, not the kernel's memory limit.

Reproduction

bash tools/ref/depth-qwen3moe-stub.sh --fault-windows
bash tools/ref/depth-qwen3moe-stub.sh

Point DEPTH_QWEN3MOE_RUNNER at a copy of main's runner to see the first group fail.

What I ran into

Rows from earlier comparison runs cannot be re-labelled: their timed ? column shows they counted the whole process, so whether those binaries were warm during inference is unknown. This does not block this change.

Hardware

A Linux container on a DGX Spark (GB10). The self-test opens no GPU.

AI help

AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.

@github-actions github-actions Bot added the tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo label Oct 23, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict: CLEAN: The runner excludes load faults from supported binaries' timed windows and preserves labelled whole-process fallbacks.

Checked

Duplicates: 0 new functions, types or constants. Grepped the new input-state array and fixture controls; no duplicate owner. Existing marker, counter and capture owners are reused.

Complexity: no Rust functions changed; no crapper results. The added branches select the input flag, wrap the command and select the fault window. This is tool code, outside the inference hot path.

Silent failure: 3 paths followed: failed support probe, failed output filter and missing prompt marker. The caller observes a labelled whole-process count or a failed arm.

Tests: shell syntax checks passed. Fixture assertions cover load-only faults, timed faults, unsupported binaries, missing markers, probe exit codes and both capped arms. The support probe requires exit code 1 at tools/ref/depth-qwen3moe.sh:2135.

Mutation checks: the updated majflt assertion and load/timed cases protect the command and marker selection at tools/ref/depth-qwen3moe.sh:2426: reverting to --tokens turns them red. Forcing --arm on unsupported binaries turns both legacy cases red. Replacing a missing mark with timed zero at tools/ref/depth-qwen3moe.sh:2446 turns the missing-marker case red.

Gates: cold thresholds and retry/drop rules are unchanged. FAIL-first evidence covers the new accounting and probe checks.

Escape catalog: no matching C1–C4 pattern in the added code. Probe and run exit codes are captured directly; command arguments stay in arrays.

Notes

Dryer and crapper did not run because no Rust file changed.

The PR reports 95 fixture checks passing; the validator did not rerun the fixture suite. No GPU gate run is supplied.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

@juliankang4

Copy link
Copy Markdown
Collaborator Author

The review is done and the contribution check passed, so I'm merging this.

@juliankang4
juliankang4 merged commit faab48a into midagedev:main Oct 23, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant