Skip to content

fix(ci): migrate LLVM build cache from runner.tool_cache to actions/cache#802

Merged
zhangstevenunity merged 1 commit into
hw-native-sys:mainfrom
mouliangyu:codex/llvm-github-cache
Jun 12, 2026
Merged

fix(ci): migrate LLVM build cache from runner.tool_cache to actions/cache#802
zhangstevenunity merged 1 commit into
hw-native-sys:mainfrom
mouliangyu:codex/llvm-github-cache

Conversation

@mouliangyu

Copy link
Copy Markdown
Contributor

背景

ci_sim.yml 目前把 LLVM 构建产物放在 runner.tool_cache 下,不同 LLVM 版本共享同一目录。当有人换 LLVM_REF/LLVM_TAG 时,各 runner 上残留的旧产物会互相污染,导致各种不一致的构建错误(如 smt.py 缺失、编译器不一致等)。

build_wheel.ymlbuild_wheel_mac.yml 已经在用 actions/cache@v4,本 PR 让 ci_sim.yml 对齐这个模式。

修改

  • Resolve LLVM cache key:新增步骤,通过 git ls-remote 获取 LLVM 源 SHA,构建 key llvm-build-<sha>-assert-v1
  • Restore LLVM build cache:构建前从 GitHub Cache 恢复 build 目录,continue-on-error: true 确保 cache 服务不可用时不会阻断流程
  • Build LLVM/MLIR:当 CMakeCache 已存在(cache hit)时跳过 cmake,只跑 ninja 增量编译
  • Save LLVM build cache:仅在 cache miss 时保存,continue-on-error: true
  • 同时兼容 LLVM_TAG(未来 PR)和 LLVM_REF

效果

  • 不同 LLVM 版本 → 不同 cache key → 隔离
  • 同一 LLVM 版本 → 同一 cache key → 增量构建
  • 多人改 LLVM 版本不会互相污染

🤖 Generated with Claude Code

@gemini-code-assist

Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@reedhecre

reedhecre commented Jun 11, 2026

Copy link
Copy Markdown

Codex Review

该评论由 review 机器人自动更新。

Summary

Review failed at stage codex-review: exit=1

Findings

未生成结构化 findings,因为 review 过程提前失败。

Log Tail


===== STAGE clone @ 2026-06-11 20:00:34 =====
set -euo pipefail
rm -rf '/tmp/ptoas-pr-review-monitor/runs/20260611_200032_pr802/repo'
git clone --branch 'main' --depth 50 'https://github.com/hw-native-sys/PTOAS.git' '/tmp/ptoas-pr-review-monitor/runs/20260611_200032_pr802/repo'
cd '/tmp/ptoas-pr-review-monitor/runs/20260611_200032_pr802/repo'
git fetch origin 'refs/pull/802/head:pr-802' --depth 50
git fetch origin 'main' --depth 50 || true
git checkout -f 'pr-802'
git rev-parse HEAD
git diff --stat 'origin/main...HEAD' || true
Cloning into '/tmp/ptoas-pr-review-monitor/runs/20260611_200032_pr802/repo'...
From https://github.com/hw-native-sys/PTOAS
 * [new ref]         refs/pull/802/head -> pr-802
From https://github.com/hw-native-sys/PTOAS
 * branch            main       -> FETCH_HEAD
Switched to branch 'pr-802'
0b36f8b5d5d867f6acf03ed8977df9266eabe673
 .github/workflows/ci_sim.yml | 58 ++++++++++++++++++++++++++++++++++++++------
 1 file changed, 51 insertions(+), 7 deletions(-)
===== END STAGE clone rc=0 @ 2026-06-11 20:00:42 =====

===== STAGE codex-review @ 2026-06-11 20:00:42 =====
set -euo pipefail
cd '/tmp/ptoas-pr-review-monitor/runs/20260611_200032_pr802/repo'
'codex' exec -C '/tmp/ptoas-pr-review-monitor/runs/20260611_200032_pr802/repo' -s read-only -c 'model_provider="codereview"' -c 'model="gpt-5.4"' -c 'model_reasoning_effort="xhigh"' --output-schema '/tmp/ptoas-pr-review-monitor/runs/20260611_200032_pr802/review_schema.json' -o '/tmp/ptoas-pr-review-monitor/runs/20260611_200032_pr802/codex_last_message.json' --color never - < '/tmp/ptoas-pr-review-monitor/runs/20260611_200032_pr802/review_prompt.txt'
OpenAI Codex v0.115.0 (research preview)
--------
workdir: /tmp/ptoas-pr-review-monitor/runs/20260611_200032_pr802/repo
model: gpt-5.4
provider: codereview
approval: never
sandbox: read-only
reasoning effort: xhigh
reasoning summaries: none
session id: 019eb68e-5b55-7380-a7b2-136576ce5bd3
--------
user
你现在在审查 GitHub PR。

仓库:hw-native-sys/PTOAS
PR:#802 fix(ci): migrate LLVM build cache from runner.tool_cache to actions/cache
作者:mouliangyu
base branch:origin/main
head branch:HEAD(当前已 checkout 到 PR head)

要求:
1. 只审查这个 PR 相对 origin/main 的改动,必要时可以看上下文文件。
2. 重点找真实的 correctness / regression / contract mismatch / CI / runtime / compatibility 问题。
3. 不要提纯风格建议,不要提低价值猜测。
4. 严格按优先级输出:
   - P1:高概率会导致错误结果、编译/运行失败、严重回归、发布阻断
   - P2:重要缺陷、行为回归、遗漏校验/测试、较大兼容性问题
   - P3:次要但明确可改的问题
5. 如果没有问题,summary 直接写:未检查到 PR #802 存在问题,并返回 findings=[]。
6. 如果有问题,summary 简洁概括,findings 里每条都要给出:
   - severity
   - title
   - body(说明为什么是问题,尽量具体)
   - file(尽量给相对路径)
   - line(能确定就填整数,否则 null)

建议先查看:
- git status --short
- git diff --stat origin/main...HEAD
- git diff --unified=80 origin/main...HEAD

最终输出必须严格匹配 JSON schema。

mcp startup: no servers
ERROR: exceeded retry limit, last status: 429 Too Many Requests, request id: 33e66588-fa7d-4abc-a048-2c62bdadaf31
Warning: no last agent message; wrote empty content to /tmp/ptoas-pr-review-monitor/runs/20260611_200032_pr802/codex_last_message.json
===== END STAGE codex-review rc=1 @ 2026-06-11 20:00:46 =====

@mouliangyu mouliangyu force-pushed the codex/llvm-github-cache branch 3 times, most recently from 956adfc to 87b0ce7 Compare June 11, 2026 11:36
Replace the runner-local tool cache with a git-SHA-keyed GitHub Actions
cache so that different LLVM versions (or refs/tags) never share stale
build artifacts.  When someone changes LLVM_REF or LLVM_TAG the cache
key changes and the build tree starts fresh.

Key changes:
- Resolve the LLVM source SHA via git ls-remote and embed it in the
  cache key (llvm-build-<sha>-assert-v1).
- Restore the build directory from cache before building; skip cmake
  configure when a valid CMakeCache already exists.
- Save the build directory to cache after a fresh build.
- Both restore and save steps use continue-on-error so the pipeline
  is not blocked when a self-hosted runner lacks cache service access.
- Accept LLVM_TAG as an alternative to LLVM_REF for forward
  compatibility with upcoming LLVM version upgrades.

Co-Authored-By: Claude <noreply@anthropic.com>
@mouliangyu mouliangyu force-pushed the codex/llvm-github-cache branch from 87b0ce7 to 0b36f8b Compare June 11, 2026 11:59
@zhangstevenunity zhangstevenunity merged commit 2170f47 into hw-native-sys:main Jun 12, 2026
10 checks passed
@reedhecre

Copy link
Copy Markdown

A3 板测完成(有跳过)

  • 触发方式:merged
  • 源码提交:2170f47bd4a4
  • 结果汇总:OK 221 / FAIL 0 / SKIP 1
  • 日志:/home/zhongxuan/ptoas-board-monitor/runtime/logs/20260612_094005_merged_pr802.log
  • 结果 TSV:/home/zhongxuan/ptoas-board-monitor/runtime/logs/20260612_094005_merged_pr802.tsv

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.

3 participants