Skip to content

Commit 80e4a2d

Browse files
committed
Merge branch 'main' of https://github.com/llvm/llvm-project into aligned_accessor
2 parents a863a60 + fa315ec commit 80e4a2d

File tree

12,015 files changed

+1012544
-608310
lines changed

Some content is hidden

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

12,015 files changed

+1012544
-608310
lines changed

.ci/metrics/metrics.py

Lines changed: 62 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
from dataclasses import dataclass
55
import sys
6+
import logging
67

78
import github
89
from github import Github
@@ -24,6 +25,7 @@ class JobMetrics:
2425
status: int
2526
created_at_ns: int
2627
workflow_id: int
28+
workflow_name: str
2729

2830

2931
@dataclass
@@ -43,40 +45,60 @@ def get_sampled_workflow_metrics(github_repo: github.Repository):
4345
Returns a list of GaugeMetric objects, containing the relevant metrics about
4446
the workflow
4547
"""
48+
queued_job_counts = {}
49+
running_job_counts = {}
4650

4751
# Other states are available (pending, waiting, etc), but the meaning
4852
# is not documented (See #70540).
4953
# "queued" seems to be the info we want.
50-
queued_workflow_count = len(
51-
[
52-
x
53-
for x in github_repo.get_workflow_runs(status="queued")
54-
if x.name in WORKFLOWS_TO_TRACK
55-
]
56-
)
57-
running_workflow_count = len(
58-
[
59-
x
60-
for x in github_repo.get_workflow_runs(status="in_progress")
61-
if x.name in WORKFLOWS_TO_TRACK
62-
]
63-
)
54+
for queued_workflow in github_repo.get_workflow_runs(status="queued"):
55+
if queued_workflow.name not in WORKFLOWS_TO_TRACK:
56+
continue
57+
for queued_workflow_job in queued_workflow.jobs():
58+
job_name = queued_workflow_job.name
59+
# Workflows marked as queued can potentially only have some jobs
60+
# queued, so make sure to also count jobs currently in progress.
61+
if queued_workflow_job.status == "queued":
62+
if job_name not in queued_job_counts:
63+
queued_job_counts[job_name] = 1
64+
else:
65+
queued_job_counts[job_name] += 1
66+
elif queued_workflow_job.status == "in_progress":
67+
if job_name not in running_job_counts:
68+
running_job_counts[job_name] = 1
69+
else:
70+
running_job_counts[job_name] += 1
71+
72+
for running_workflow in github_repo.get_workflow_runs(status="in_progress"):
73+
if running_workflow.name not in WORKFLOWS_TO_TRACK:
74+
continue
75+
for running_workflow_job in running_workflow.jobs():
76+
job_name = running_workflow_job.name
77+
if running_workflow_job.status != "in_progress":
78+
continue
79+
80+
if job_name not in running_job_counts:
81+
running_job_counts[job_name] = 1
82+
else:
83+
running_job_counts[job_name] += 1
6484

6585
workflow_metrics = []
66-
workflow_metrics.append(
67-
GaugeMetric(
68-
"workflow_queue_size",
69-
queued_workflow_count,
70-
time.time_ns(),
86+
for queued_job in queued_job_counts:
87+
workflow_metrics.append(
88+
GaugeMetric(
89+
f"workflow_queue_size_{queued_job}",
90+
queued_job_counts[queued_job],
91+
time.time_ns(),
92+
)
7193
)
72-
)
73-
workflow_metrics.append(
74-
GaugeMetric(
75-
"running_workflow_count",
76-
running_workflow_count,
77-
time.time_ns(),
94+
for running_job in running_job_counts:
95+
workflow_metrics.append(
96+
GaugeMetric(
97+
f"running_workflow_count_{running_job}",
98+
running_job_counts[running_job],
99+
time.time_ns(),
100+
)
78101
)
79-
)
80102
# Always send a hearbeat metric so we can monitor is this container is still able to log to Grafana.
81103
workflow_metrics.append(
82104
GaugeMetric("metrics_container_heartbeat", 1, time.time_ns())
@@ -157,7 +179,7 @@ def get_per_workflow_metrics(
157179
# longer in a testing state and we can directly assert the workflow
158180
# result.
159181
for step in workflow_job.steps:
160-
if step.conclusion != "success":
182+
if step.conclusion != "success" and step.conclusion != "skipped":
161183
job_result = 0
162184
break
163185

@@ -171,6 +193,10 @@ def get_per_workflow_metrics(
171193
# in nanoseconds.
172194
created_at_ns = int(created_at.timestamp()) * 10**9
173195

196+
logging.info(
197+
f"Adding a job metric for job {workflow_job.id} in workflow {workflow_run.id}"
198+
)
199+
174200
workflow_metrics.append(
175201
JobMetrics(
176202
workflow_run.name + "-" + workflow_job.name,
@@ -179,6 +205,7 @@ def get_per_workflow_metrics(
179205
job_result,
180206
created_at_ns,
181207
workflow_run.id,
208+
workflow_run.name,
182209
)
183210
)
184211

@@ -198,7 +225,7 @@ def upload_metrics(workflow_metrics, metrics_userid, api_key):
198225
"""
199226

200227
if len(workflow_metrics) == 0:
201-
print("No metrics found to upload.", file=sys.stderr)
228+
logging.info("No metrics found to upload.")
202229
return
203230

204231
metrics_batch = []
@@ -227,16 +254,12 @@ def upload_metrics(workflow_metrics, metrics_userid, api_key):
227254
)
228255

229256
if response.status_code < 200 or response.status_code >= 300:
230-
print(
231-
f"Failed to submit data to Grafana: {response.status_code}", file=sys.stderr
232-
)
257+
logging.info(f"Failed to submit data to Grafana: {response.status_code}")
233258

234259

235260
def main():
236261
# Authenticate with Github
237262
auth = Auth.Token(os.environ["GITHUB_TOKEN"])
238-
github_object = Github(auth=auth)
239-
github_repo = github_object.get_repo("llvm/llvm-project")
240263

241264
grafana_api_key = os.environ["GRAFANA_API_KEY"]
242265
grafana_metrics_userid = os.environ["GRAFANA_METRICS_USERID"]
@@ -248,24 +271,24 @@ def main():
248271
# Enter the main loop. Every five minutes we wake up and dump metrics for
249272
# the relevant jobs.
250273
while True:
274+
github_object = Github(auth=auth)
275+
github_repo = github_object.get_repo("llvm/llvm-project")
276+
251277
current_metrics = get_per_workflow_metrics(github_repo, workflows_to_track)
252278
current_metrics += get_sampled_workflow_metrics(github_repo)
253-
# Always send a hearbeat metric so we can monitor is this container is still able to log to Grafana.
254-
current_metrics.append(
255-
GaugeMetric("metrics_container_heartbeat", 1, time.time_ns())
256-
)
257279

258280
upload_metrics(current_metrics, grafana_metrics_userid, grafana_api_key)
259-
print(f"Uploaded {len(current_metrics)} metrics", file=sys.stderr)
281+
logging.info(f"Uploaded {len(current_metrics)} metrics")
260282

261283
for workflow_metric in reversed(current_metrics):
262284
if isinstance(workflow_metric, JobMetrics):
263285
workflows_to_track[
264-
workflow_metric.job_name
286+
workflow_metric.workflow_name
265287
] = workflow_metric.workflow_id
266288

267289
time.sleep(SCRAPE_INTERVAL_SECONDS)
268290

269291

270292
if __name__ == "__main__":
293+
logging.basicConfig(level=logging.INFO)
271294
main()

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
/bolt/ @aaupov @maksfb @rafaelauler @ayermolo @dcci @yota9
132132

133133
# Bazel build system.
134-
/utils/bazel/ @rupprecht @keith
134+
/utils/bazel/ @rupprecht @keith @aaronmondal
135135

136136
# InstallAPI and TextAPI
137137
/llvm/**/TextAPI/ @cyndyishida

.github/new-prs-labeler.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ clang:static analyzer:
499499
- clang/tools/scan-build/**
500500
- clang/utils/analyzer/**
501501
- clang/docs/analyzer/**
502+
- clang/test/Analysis/**
502503

503504
pgo:
504505
- llvm/lib/Transforms/Instrumentation/CGProfile.cpp

.github/workflows/build-ci-container-windows.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
container-filename: ${{ steps.vars.outputs.container-filename }}
2828
steps:
2929
- name: Checkout LLVM
30-
uses: actions/checkout@v4
30+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3131
with:
3232
sparse-checkout: .github/workflows/containers/github-action-ci-windows
3333
- name: Write Variables
@@ -46,7 +46,7 @@ jobs:
4646
run: |
4747
docker save ${{ steps.vars.outputs.container-name-tag }} > ${{ steps.vars.outputs.container-filename }}
4848
- name: Upload container image
49-
uses: actions/upload-artifact@v4
49+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
5050
with:
5151
name: container
5252
path: ${{ steps.vars.outputs.container-filename }}
@@ -63,7 +63,7 @@ jobs:
6363
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6464
steps:
6565
- name: Download container
66-
uses: actions/download-artifact@v4
66+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
6767
with:
6868
name: container
6969
- name: Push Container

.github/workflows/build-ci-container.yml

Lines changed: 42 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,31 @@ on:
2020
jobs:
2121
build-ci-container:
2222
if: github.repository_owner == 'llvm'
23-
runs-on: depot-ubuntu-22.04-16
24-
outputs:
25-
container-name: ${{ steps.vars.outputs.container-name }}
26-
container-name-agent: ${{ steps.vars.outputs.container-name-agent }}
27-
container-name-tag: ${{ steps.vars.outputs.container-name-tag }}
28-
container-name-agent-tag: ${{ steps.vars.outputs.container-name-agent-tag }}
29-
container-filename: ${{ steps.vars.outputs.container-filename }}
30-
container-agent-filename: ${{ steps.vars.outputs.container-agent-filename }}
23+
runs-on: ${{ matrix.runs-on }}
24+
strategy:
25+
matrix:
26+
include:
27+
# The arch names should match the names used on dockerhub.
28+
# See https://github.com/docker-library/official-images#architectures-other-than-amd64
29+
- arch: amd64
30+
runs-on: depot-ubuntu-22.04-16
31+
- arch: arm64v8
32+
runs-on: depot-ubuntu-22.04-arm-16
3133
steps:
3234
- name: Checkout LLVM
33-
uses: actions/checkout@v4
35+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3436
with:
3537
sparse-checkout: .github/workflows/containers/github-action-ci/
38+
# podman is not installed by default on the ARM64 images.
39+
- name: Install Podman
40+
if: runner.arch == 'ARM64'
41+
run: |
42+
sudo apt-get install podman
3643
- name: Write Variables
3744
id: vars
3845
run: |
39-
tag=`date +%s`
40-
container_name="ghcr.io/$GITHUB_REPOSITORY_OWNER/ci-ubuntu-22.04"
46+
tag=$(git rev-parse --short=12 HEAD)
47+
container_name="ghcr.io/$GITHUB_REPOSITORY_OWNER/${{ matrix.arch }}/ci-ubuntu-22.04"
4148
echo "container-name=$container_name" >> $GITHUB_OUTPUT
4249
echo "container-name-agent=$container_name-agent" >> $GITHUB_OUTPUT
4350
echo "container-name-tag=$container_name:$tag" >> $GITHUB_OUTPUT
@@ -59,9 +66,9 @@ jobs:
5966
podman save ${{ steps.vars.outputs.container-name-agent-tag }} > ${{ steps.vars.outputs.container-agent-filename }}
6067
6168
- name: Upload container image
62-
uses: actions/upload-artifact@v4
69+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
6370
with:
64-
name: container
71+
name: container-${{ matrix.arch }}
6572
path: "*.tar"
6673
retention-days: 14
6774

@@ -83,19 +90,30 @@ jobs:
8390
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8491
steps:
8592
- name: Download container
86-
uses: actions/download-artifact@v4
87-
with:
88-
name: container
93+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
8994

9095
- name: Push Container
9196
run: |
92-
podman load -i ${{ needs.build-ci-container.outputs.container-filename }}
93-
podman tag ${{ needs.build-ci-container.outputs.container-name-tag }} ${{ needs.build-ci-container.outputs.container-name }}:latest
97+
function push_container {
98+
image_name=$1
99+
latest_name=$(echo $image_name | sed 's/:[a-f0-9]\+$/:latest/g')
100+
podman tag $image_name $latest_name
101+
echo "Pushing $image_name ..."
102+
podman push $image_name
103+
echo "Pushing $latest_name ..."
104+
podman push $latest_name
105+
}
106+
94107
podman login -u ${{ github.actor }} -p $GITHUB_TOKEN ghcr.io
95-
podman push ${{ needs.build-ci-container.outputs.container-name-tag }}
96-
podman push ${{ needs.build-ci-container.outputs.container-name }}:latest
108+
for f in $(find . -iname *.tar); do
109+
image_name=$(podman load -q -i $f | sed 's/Loaded image: //g')
110+
push_container $image_name
97111
98-
podman load -i ${{ needs.build-ci-container.outputs.container-agent-filename }}
99-
podman tag ${{ needs.build-ci-container.outputs.container-name-agent-tag }} ${{ needs.build-ci-container.outputs.container-name-agent }}:latest
100-
podman push ${{ needs.build-ci-container.outputs.container-name-agent-tag }}
101-
podman push ${{ needs.build-ci-container.outputs.container-name-agent }}:latest
112+
if echo $image_name | grep '/amd64/'; then
113+
# For amd64, create an alias with the arch component removed.
114+
# This matches the convention used on dockerhub.
115+
default_image_name=$(echo $(dirname $(dirname $image_name))/$(basename $image_name))
116+
podman tag $image_name $default_image_name
117+
push_container $default_image_name
118+
fi
119+
done

.github/workflows/build-metrics-container.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ on:
2020
jobs:
2121
build-metrics-container:
2222
if: github.repository_owner == 'llvm'
23-
runs-on: ubuntu-latest
23+
runs-on: ubuntu-24.04
2424
outputs:
2525
container-name: ${{ steps.vars.outputs.container-name }}
2626
container-name-tag: ${{ steps.vars.outputs.container-name-tag }}
2727
container-filename: ${{ steps.vars.outputs.container-filename }}
2828
steps:
2929
- name: Checkout LLVM
30-
uses: actions/checkout@v4
30+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3131
with:
3232
sparse-checkout: .ci/metrics/
3333
- name: Write Variables
@@ -49,7 +49,7 @@ jobs:
4949
run: |
5050
podman save ${{ steps.vars.outputs.container-name-tag }} > ${{ steps.vars.outputs.container-filename }}
5151
- name: Upload Container Image
52-
uses: actions/upload-artifact@v4
52+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
5353
with:
5454
name: container
5555
path: ${{ steps.vars.outputs.container-filename }}
@@ -66,7 +66,7 @@ jobs:
6666
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6767
steps:
6868
- name: Download Container
69-
uses: actions/download-artifact@v4
69+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
7070
with:
7171
name: container
7272
- name: Push Container

.github/workflows/ci-post-commit-analyzer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
4545

4646
- name: Setup ccache
47-
uses: hendrikmuhs/ccache-action@v1
47+
uses: hendrikmuhs/ccache-action@a1209f81afb8c005c13b4296c32e363431bffea5 # v1.2.17
4848
with:
4949
# A full build of llvm, clang, lld, and lldb takes about 250MB
5050
# of ccache space. There's not much reason to have more than this,

.github/workflows/commit-access-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-22.04
1616
steps:
1717
- name: Fetch LLVM sources
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1919

2020
- name: Install dependencies
2121
run: |

0 commit comments

Comments
 (0)