Skip to content

Commit 05b7b1d

Browse files
jgmelberclaude
andcommitted
Add CI check for aie_api submodule pin regressing to a stale commit
third_party/aie_api tracks stock upstream Xilinx/aie_api directly (no fork, see #3262), after the local ADF-header patch was replaced by a compile-time define. The pin has since been silently reverted to a stale, divergent pre-#3262 commit twice by a merge/rebase from a branch based before the fix landed (#3292, #3330's regression from #3296). Add a CI job that fetches the pin and upstream's default branch tip directly from the submodule's own remote and fails if the pin is not an ancestor of upstream main, catching a third recurrence at PR time instead of after merge. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent cfbcf97 commit 05b7b1d

2 files changed

Lines changed: 83 additions & 0 deletions

File tree

.github/workflows/lintAndFormat.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,25 @@ jobs:
8484
- name: Check shared dependency versions agree
8585
run: python3 utils/check_shared_dep_versions.py
8686

87+
aie-api-submodule:
88+
89+
name: aie_api submodule pin is not stale
90+
91+
runs-on: ubuntu-latest
92+
93+
permissions:
94+
contents: read
95+
96+
steps:
97+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
98+
99+
# third_party/aie_api tracks stock upstream Xilinx/aie_api directly (no
100+
# fork, see #3262). The pin has twice been silently reverted to a stale
101+
# pre-#3262 commit by a merge/rebase from a branch based before the fix
102+
# landed (#3292, #3330). Fail fast on a third recurrence.
103+
- name: Verify aie_api pin is reachable from upstream main
104+
run: python3 utils/check_aie_api_submodule.py
105+
87106
clang-tidy-pylint:
88107

89108
name: Python and C/C++ Lint

utils/check_aie_api_submodule.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/usr/bin/env python3
2+
3+
# Copyright (C) 2026 Advanced Micro Devices, Inc.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
6+
"""Fail if third_party/aie_api is pinned to a commit that upstream doesn't know
7+
about.
8+
9+
third_party/aie_api tracks stock upstream Xilinx/aie_api directly (no fork,
10+
see #3262) after the local ADF-header patch was replaced by a compile-time
11+
define. The pinned commit has since been silently reverted to a stale,
12+
pre-#3262 commit twice (#3292, #3330), both times by a merge/rebase from a
13+
branch based before the fix landed. Guard against a third recurrence: the
14+
pin must be reachable from upstream's default branch.
15+
"""
16+
17+
import subprocess
18+
import sys
19+
20+
SUBMODULE_PATH = "third_party/aie_api"
21+
DEFAULT_BRANCH = "main"
22+
23+
24+
def run(*args):
25+
return subprocess.run(
26+
args, check=True, capture_output=True, text=True
27+
).stdout.strip()
28+
29+
30+
def main():
31+
url = run(
32+
"git", "config", "-f", ".gitmodules", "--get",
33+
f"submodule.{SUBMODULE_PATH}.url",
34+
)
35+
pinned = run("git", "ls-tree", "HEAD", "--", SUBMODULE_PATH).split()[2]
36+
37+
run("git", "fetch", "--quiet", "--force", url, f"{pinned}:refs/tmp/aie-api-pinned")
38+
run("git", "fetch", "--quiet", "--force", url, f"{DEFAULT_BRANCH}:refs/tmp/aie-api-main")
39+
40+
upstream_head = run("git", "rev-parse", "refs/tmp/aie-api-main")
41+
42+
is_ancestor = subprocess.run(
43+
[
44+
"git", "merge-base", "--is-ancestor",
45+
"refs/tmp/aie-api-pinned", "refs/tmp/aie-api-main",
46+
]
47+
).returncode == 0
48+
49+
if not is_ancestor:
50+
print(
51+
f"::error::{SUBMODULE_PATH} is pinned to {pinned}, which is not "
52+
f"reachable from {url}@{DEFAULT_BRANCH} ({upstream_head}). This "
53+
"usually means a merge/rebase silently reverted the submodule "
54+
"pointer to a stale, pre-defork commit (see #3262, #3292, #3330). "
55+
"Re-point it to a commit that is an ancestor of upstream "
56+
f"{DEFAULT_BRANCH}."
57+
)
58+
sys.exit(1)
59+
60+
print(f"OK: {SUBMODULE_PATH} pin ({pinned}) is an ancestor of upstream {DEFAULT_BRANCH}.")
61+
62+
63+
if __name__ == "__main__":
64+
main()

0 commit comments

Comments
 (0)