Skip to content

fix(agentx): export AIPERF_VERSION so the aiperf mmap cache key tracks the pinned revision / 导出 AIPERF_VERSION 使 aiperf mmap 缓存键跟随固定的 aiperf 版本 - #3729

Closed
redhairdragon wants to merge 2 commits into
SemiAnalysisAI:mainfrom
redhairdragon:shenteng/aiperf-version-cache-key
Closed

redhairdragon wants to merge 2 commits into
SemiAnalysisAI:mainfrom
redhairdragon:shenteng/aiperf-version-cache-key

Conversation

@redhairdragon

Copy link
Copy Markdown

Description

aiperf namespaces its memory-mapped dataset cache key with AIPERF_VERSION (utils/aiperf/src/aiperf/dataset/mmap_cache.py, _aiperf_version() → os.environ.get("AIPERF_VERSION") or None). InferenceX never sets it, so the key carries no source-code component and any utils/aiperf change that alters the decoded dataset without bumping MANIFEST_VERSION keeps replaying the previously decoded dataset from a warm /aiperf_mmap_cache.

That happened with agentx-harness deb5421c (idle-gap cap moved from a load-time timeline warp to the runtime scheduler, MANIFEST_VERSION left at 26): the persistent cache on gb200-nv predates it and still serves the warped timeline under key e33b683c648e0cd197606a97c1e2a9f0 (dataset.dat 6.31 GiB), while a fresh cluster builds the unwarped dataset under the same key (6.30 GiB). Because trajectory_source.py samples the starting turn against the cached timestamps, the two caches pick different root_next / live branches for identical (seed, lane, trace, sample_time).

Measured on the same 16-GPU GB200 nodes, image and engine flags, aiperf CLI at the pinned 754356e9 in both arms, only the cache directory differing (fresh build vs a rebuild of the same key with aiperf @ be758d62, which reproduces the gb200-nv lane/credit signature line for line):

Config (Official job) Cache arm Mean ISL Total cache hit Out Tput/GPU (vs Official) In Tput/GPU (vs Official)
dcp16-dspark4 c16 (442689) fresh 754356e9 143.2k 83.41 % 15.04 (102.5 %) 1,762.9 (76.0 %)
be758d62 rebuild 186.5k 86.78 % 14.27 (97.2 %) 2,277.4 (98.2 %)
tp8pp2 c16 (442692) fresh 754356e9 125.4k 90.12 % 32.66 (107.0 %) 4,376.9 (92.0 %)
be758d62 rebuild 163.5k 92.13 % 30.43 (99.7 %) 4,733.8 (99.5 %)
tp8pp2 c72 (442688) fresh 754356e9 114.6k 92.34 % 64.15 (104.1 %) 8,615.6 (88.3 %)
be758d62 rebuild 136.5k 93.39 % 61.58 (99.9 %) 9,747.2 (99.9 %)
tp8pp2 c96 (442695) fresh 754356e9 103.5k 91.62 % 73.30 (103.6 %) 9,091.0 (93.2 %)
be758d62 rebuild 115.2k 91.81 % 69.45 (98.2 %) 9,574.2 (98.2 %)

Same hardware, fresh vs be758d62 arm: mean ISL −10…−23 %, prefix-cache hit −0.19…−3.37 pp, In Tput/GPU −5.0…−22.6 %. Warmup credits/records differ identically on every run (c16 17/177 vs 20/180; c72 76/796 vs 97/817; c96 101/1,061 vs 122/1,082; Official = the be758d62 values).

Change (inferencex-e2e/benchmarks/benchmark_lib.sh):

  • New export_aiperf_version() resolves the pinned utils/aiperf commit without git (the submodule's .git is a gitdir pointer file; rootless Enroot containers may not ship git): reads HEAD, follows a symbolic ref to a loose or packed ref, then falls back to git rev-parse, and finally to a content hash of src/aiperf/dataset/**/*.py (src-<12 hex>) when the gitdir is not mounted in the container. A preset AIPERF_VERSION is left untouched; if nothing resolves it warns and leaves the variable unset (today's behaviour).
  • install_agentic_deps() calls it before its early return, so the export is in place for every path that later runs $AIPERF_CLI profile (srt_agentic.sh, ensure_hf_cli inside the replay helper).
  • Each utils/aiperf bump now gets its own cache namespace (one rebuild, ≈6.3 GiB for the Kimi-K3 corpus), and a harness change can no longer be masked by a warm cache.

Companion fix upstream: SemiAnalysisAI/agentx-harness PR bumping MANIFEST_VERSION 26 → 27 (SemiAnalysisAI/agentx-harness#48). When that lands, the next utils/aiperf bump invalidates pre-deb5421c caches even without this export; this PR makes the invalidation independent of anyone remembering to bump the manifest.

Verification: bash -n; the helper was exercised standalone against (1) the real submodule checkout (detached HEAD via gitdir pointer → matches git rev-parse --short=12 HEAD), (2) a symbolic HEAD with a loose ref, (3) packed-refs only, (4) a relative gitdir pointer, (5) no .git → stable src- content hash that changes when a dataset source changes, (6) preset AIPERF_VERSION honoured, (7) nothing resolvable → warning, unset, rc 0, (8) value visible to child processes — 13/13 checks pass. pytest -c inferencex-e2e/pyproject.toml inferencex-e2e/infx/tests/ -n 4 (uv-synced test group, Python 3.12): the five modules that source benchmark_lib.sh (results/agentic/test_power_lifecycle.py, results/power/test_process_result.py, evals/test_run_eval_dispatch.py, evals/test_batched_eval.py, workflows/test_launch_layout.py) → 239 passed; the full infx/tests run gives the same 2,031 passed / 34 failed / 6 errors on this branch and on origin/main in the same environment (failures are local-only: utils/srt-slurm submodule not initialised in the worktree → srtctl import / Missing srt-slurm submodule, uv sync --locked publish-time resolution, GitPython refs/heads/.invalid).

Perf-changelog: not appended. This PR changes no recipe, engine or image; on clusters whose /aiperf_mmap_cache is already a post-deb5421c build the only effect is one cache rebuild. On gb200-nv (stale pre-deb5421c cache) the AgentX replay moves to the unwarped timeline that deb5421c already introduced upstream in July, so the next AgentX sweeps there will show the ISL / hit / In-Tput shift above. If maintainers prefer those curves re-generated explicitly, say so and I will append a changelog entry listing the affected kimik3-*gb200*agentic* config keys.

AI model disclosure

  • Model/version: Google Antigravity (agentic coding assistant, IDE runtime). The runtime does not expose the exact underlying model identifier, so it could not be verified.
  • Role: root-cause analysis of the aiperf cache key, A/B experiment design and log analysis, drafting of the shell change, its standalone tests and this description. A second Antigravity agent (same runtime, identifier likewise not exposed) independently re-derived the evidence table from the raw aiperf / InferenceX artifacts. Final review by the human author.

Related Issue

n/a (companion: SemiAnalysisAI/agentx-harness#48)

Type of Change

  • Bug fix
  • New feature
  • Configuration change
  • Documentation update
  • Other (please describe)

Checklist

  • I have completed the AI model disclosure and kept it current
  • I have tested my changes locally
  • I have updated documentation if necessary (n/a)
  • For every change that can affect benchmark performance and every recipe addition or modification, I have appended a new entry to the physical end of inferencex-e2e/perf-changelog.yaml and have not edited historical entries (not appended — no recipe/engine change; see "Perf-changelog" above)
  • If this PR can affect benchmark performance or adds or modifies a recipe, it carries exactly one primary sweep label (maintainer decision; see above)
  • Before merging via reuse, an authorized maintainer has commented /use <run_id> on this PR
中文

改动说明: aiperf 用 AIPERF_VERSION 给 mmap 数据集缓存键加命名空间(mmap_cache.py 的 _aiperf_version()),InferenceX 从未设置它,所以缓存键里没有任何源码成分。agentx-harness deb5421c 把 idle-gap 上限从"加载时压缩时间线"改成"运行时调度",但没有 bump MANIFEST_VERSION(仍为 26),导致 gb200-nv 上早于该提交生成的缓存一直以同一个键 e33b683c… 回放旧的(压缩过的)时间线(dataset.dat 6.31 GiB),而新集群生成的是未压缩版本(6.30 GiB)。trajectory_source.py 按缓存里的时间戳采样起始轮次,两种缓存会选出不同的 root_next / live 分支。

在同一批 GB200 节点、同一镜像与引擎参数、同一 aiperf CLI(754356e9)下只更换缓存目录做 A/B(见上表):平均 ISL 低 10–23%,前缀缓存命中率低 0.19–3.37 pp,每 GPU 输入吞吐低 5.0–22.6%;warmup credits/records 在每次运行中都以相同方式分叉(Official 等于 be758d62 一侧的值)。

本 PR: 在 benchmark_lib.sh 新增 export_aiperf_version(),不依赖 git 解析 utils/aiperf 固定的 commit(gitdir 指针文件 → HEAD → loose/packed ref → git rev-parse → 最后回退到 src/aiperf/dataset 源码内容哈希),在 install_agentic_deps() 的早退之前导出;已设置的 AIPERF_VERSION 不覆盖;无法解析时只打印 WARNING 并保持现状。之后每次 bump utils/aiperf 都会得到独立的缓存命名空间(一次性重建约 6.3 GiB)。

AI 模型使用说明: 使用 Google Antigravity(IDE 内的 agentic 编码助手)完成根因分析、A/B 实验设计与日志分析、shell 改动与独立测试、以及本说明;运行环境未暴露底层模型的确切标识,无法核实。另一 Antigravity agent(同一运行环境,同样无法核实标识)独立从原始日志复核了上表数据。最终由人工审阅。

关联 issue: 无;配套上游 PR:https://github.com/SemiAnalysisAI/agentx-harness/pull/48。

改动类型: Bug 修复。

验证: bash -n;辅助函数单独测试 8 类场景共 13 项检查全部通过(真实 submodule、loose ref、packed-refs、相对 gitdir 指针、无 .git 时的内容哈希稳定且随源码变化、预设值保留、不可解析时告警且 rc=0、子进程可见)。

注意事项: 未追加 perf-changelog 条目——本 PR 不改任何 recipe / 引擎 / 镜像;对已是新缓存的集群只会触发一次重建;对 gb200-nv 这类仍是旧缓存的集群,AgentX 回放会切换到 deb5421c 七月就已引入的未压缩时间线,后续 sweep 会出现上表所示的 ISL / 命中率 / 输入吞吐变化。如维护者希望显式重新生成这些曲线,我可以补一条列出受影响 kimik3-*gb200*agentic* config keys 的 changelog 条目。

…s the pinned revision / 导出 AIPERF_VERSION 使 aiperf mmap 缓存键跟随固定的 aiperf 版本

aiperf namespaces its memory-mapped dataset cache key with AIPERF_VERSION
(utils/aiperf/src/aiperf/dataset/mmap_cache.py, _aiperf_version). InferenceX
never set it, so the key carried no source-code component and a loader change
in utils/aiperf that did not bump MANIFEST_VERSION kept replaying the
previously decoded dataset from a warm /aiperf_mmap_cache. agentx-harness
deb5421c (idle-gap cap moved from a load-time timeline warp to the runtime
scheduler) was such a change: a cluster whose cache predates it replays the
warped timeline (6.31 GiB dataset.dat, key e33b683c...) while a fresh cluster
builds the unwarped one (6.30 GiB) under the same key, with 10-23% lower mean
ISL and 5-23% lower input throughput per GPU on the same hardware and engine
across four Kimi-K3 AgentX configs.

Resolve the pinned utils/aiperf commit without git (gitdir pointer file,
loose or packed ref), fall back to git rev-parse, then to a content hash of
src/aiperf/dataset when the gitdir is not mounted in the container, and
export it from install_agentic_deps before the aiperf CLI runs. A preset
AIPERF_VERSION is left untouched. Companion to the agentx-harness
MANIFEST_VERSION 26 -> 27 bump.

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants