Skip to content

Commit 69f2d16

Browse files
authored
Merge branch 'main' into dependabot/github_actions/actions/labeler-7
2 parents 67cc7cd + 04215a5 commit 69f2d16

1,226 files changed

Lines changed: 164219 additions & 48552 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
1-
<!-- PR Title
2-
[component] brief description
3-
component options:
4-
- BUILD
5-
- CI/CD
6-
- DOC
7-
- FRONTEND
8-
- BACKEND
9-
- AUTOTUNER
10-
- CACHE
11-
- LAYOUTS
12-
- PIPELINE
13-
- PROTON
14-
- TEST
15-
- OTHER
1+
<!-- PR Title Format:
2+
[TLE][BUILD][TEST][CI/CD][DOC][PROTON][BACKEND][FLIR] Brief description
3+
[LANGUAGE][AUTOTUNER][LAYOUT][PIPELINE][WarpSpecialization] Brief description
4+
Do not set the following title tags: [FEATURE][BUG][FixBug][Refine] ...
165
-->

.github/actions/check-backend-changed/action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ runs:
142142
break
143143
fi
144144
145-
# It is a code file. Check whether it lives inside third_party/
146-
if [[ "$file" == third_party/* ]]; then
147-
if [[ "$file" == third_party/${BACKEND}/* ]]; then
145+
# It is a code file. Check whether it lives inside third_party/ or .github/workflows/benchmark/
146+
if [[ "$file" == third_party/* ]] || [[ "$file" == .github/workflows/benchmark/* ]]; then
147+
if [[ "$file" == third_party/${BACKEND}/* ]] || [[ "$file" == .github/workflows/benchmark/${BACKEND}/* ]]; then
148148
echo "'$file' -> Backend '$BACKEND' file changed, need to run"
149149
SHOULD_SKIP=false
150150
break
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Copyright 2025- FlagOS Contributors
2+
#
3+
# Permission is hereby granted, free of charge, to any person obtaining a copy
4+
# of this software and associated documentation files (the "Software"), to deal
5+
# in the Software without restriction, including without limitation the rights
6+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
# copies of the Software, and to permit persons to whom the Software is
8+
# furnished to do so, subject to the following conditions:
9+
#
10+
# The above copyright notice and this permission notice shall be included in all
11+
# copies or substantial portions of the Software.
12+
#
13+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
# SOFTWARE.
20+
21+
name: 'Cleanup FlagTree Environment'
22+
description: 'Purge previous FlagTree installations to ensure a fresh build'
23+
24+
runs:
25+
using: 'composite'
26+
steps:
27+
- name: Purge previous FlagTree installations
28+
shell: bash
29+
run: |
30+
set -x
31+
echo "Starting environment cleanup..."
32+
33+
SITE_PACKAGES=$(python3 -c "import sysconfig; print(sysconfig.get_path('purelib'))")
34+
35+
# 1. Normalize the path to resolve symlinks and eliminate '..'
36+
SITE_PACKAGES=$(realpath -m "$SITE_PACKAGES" 2>/dev/null || readlink -f "$SITE_PACKAGES" 2>/dev/null || echo "$SITE_PACKAGES")
37+
38+
# 2. Reject if the path still contains '..' after normalization
39+
if [[ "$SITE_PACKAGES" == *".."* ]]; then
40+
echo "Error: Path contains '..' after normalization. Aborting."
41+
exit 1
42+
fi
43+
44+
# 3. Ensure it is a real, existing directory
45+
if [[ ! -d "$SITE_PACKAGES" ]]; then
46+
echo "Error: Directory '$SITE_PACKAGES' does not exist. Aborting."
47+
exit 1
48+
fi
49+
50+
# 4. Ensure it is an absolute path located in a standard Python directory
51+
# Check if it contains 'site-packages' or 'dist-packages' as the directory name
52+
if [[ ! "$SITE_PACKAGES" =~ ^/.*/python[^/]*/(site|dist)-packages/?$ ]]; then
53+
echo "Error: '$SITE_PACKAGES' is not a recognized Python package directory. Aborting."
54+
exit 1
55+
fi
56+
57+
# 5. Reject overly broad or critical system directories
58+
if [[ "$SITE_PACKAGES" == "/" ]] ||
59+
[[ "$SITE_PACKAGES" == "/root" ]] ||
60+
[[ "$SITE_PACKAGES" == "/home" ]] ||
61+
[[ "$SITE_PACKAGES" == "/usr" ]] ||
62+
[[ "$SITE_PACKAGES" == "/usr/lib" ]]; then
63+
echo "Error: Path '$SITE_PACKAGES' is too broad. Aborting."
64+
exit 1
65+
fi
66+
67+
# 1. Attempt to gracefully uninstall via pip
68+
python3 -m pip uninstall -y flagtree --break-system-packages || true
69+
70+
# 2. Remove temporary directories left by interrupted pip processes
71+
rm -rf "$SITE_PACKAGES"/~* || true
72+
73+
# 3. Force remove any remaining metadata and code directories
74+
rm -rf "$SITE_PACKAGES"/flagtree*dist-info || true
75+
rm -rf "$SITE_PACKAGES"/triton || true
76+
77+
echo "Environment cleanup completed."
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Copyright 2025- FlagOS Contributors
2+
#
3+
# Permission is hereby granted, free of charge, to any person obtaining a copy
4+
# of this software and associated documentation files (the "Software"), to deal
5+
# in the Software without restriction, including without limitation the rights
6+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
# copies of the Software, and to permit persons to whom the Software is
8+
# furnished to do so, subject to the following conditions:
9+
#
10+
# The above copyright notice and this permission notice shall be included in all
11+
# copies or substantial portions of the Software.
12+
#
13+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
# SOFTWARE.
20+
21+
name: 'Clear Cache if Labeled'
22+
description: 'Check if PR has specific backend ClearCache label and clear cache if present'
23+
24+
inputs:
25+
github-token:
26+
description: 'GitHub token for API access'
27+
required: true
28+
backend:
29+
description: 'The backend name to check for (e.g., mthreads)'
30+
required: true
31+
32+
runs:
33+
using: 'composite'
34+
steps:
35+
- name: Check specific ClearCache label
36+
id: check
37+
uses: actions/github-script@v6
38+
with:
39+
github-token: ${{ inputs.github-token }}
40+
script: |
41+
const backend = '${{ inputs.backend }}';
42+
const expectedLabel = `ClearCache:${backend}`;
43+
44+
if (context.eventName !== 'pull_request' && context.eventName !== 'pull_request_target') {
45+
console.log('ℹ️ Not a PR event, skipping label check');
46+
core.setOutput('has_clear_cache_label', 'false');
47+
return;
48+
}
49+
50+
if (!context.payload || !context.payload.pull_request) {
51+
console.log('⚠️ No pull_request payload found, skipping label check');
52+
core.setOutput('has_clear_cache_label', 'false');
53+
return;
54+
}
55+
56+
const prNumber = context.payload.pull_request.number;
57+
try {
58+
const { data: prData } = await github.rest.pulls.get({
59+
owner: context.repo.owner,
60+
repo: context.repo.repo,
61+
pull_number: prNumber
62+
});
63+
64+
const labels = (prData.labels || []).map(label => label.name);
65+
console.log(`Current PR labels:`, labels.join(', ') || '(no labels)');
66+
67+
const hasClearCache = labels.includes(expectedLabel);
68+
console.log(`🔍 Has "${expectedLabel}" label:`, hasClearCache ? '✅ YES' : '❌ NO');
69+
70+
core.setOutput('has_clear_cache_label', hasClearCache ? 'true' : 'false');
71+
} catch (err) {
72+
console.log('❌ Error checking PR labels:', err.message || err);
73+
core.setOutput('has_clear_cache_label', 'false');
74+
}
75+
76+
- name: Clear cache if label present
77+
id: cleanup
78+
if: steps.check.outputs.has_clear_cache_label == 'true'
79+
shell: bash
80+
run: |
81+
echo "========================================="
82+
echo "🧹 Clearing cache for ${{ inputs.backend }} backend."
83+
echo "========================================="
84+
85+
echo "-> Clearing cache..."
86+
echo "-> Remove ~/.triton/cache"
87+
rm -rf ~/.triton/cache || true
88+
echo "-> Remove ~/.flaggems"
89+
rm -rf ~/.flaggems || true
90+
echo "-> Clear cache done"

0 commit comments

Comments
 (0)