Skip to content

Commit accaa7a

Browse files
committed
Merge branch 'main' into mlir-call-attrs-llvm
2 parents 8ad4384 + 9216419 commit accaa7a

File tree

7,415 files changed

+1286804
-208823
lines changed

Some content is hidden

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

7,415 files changed

+1286804
-208823
lines changed

.ci/generate-buildkite-pipeline-premerge

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,8 @@ if [[ "${windows_projects}" != "" ]]; then
128128
limit: 2
129129
timeout_in_minutes: 150
130130
env:
131-
CC: 'cl'
132-
CXX: 'cl'
133-
LD: 'link'
131+
MAX_PARALLEL_COMPILE_JOBS: '16'
132+
MAX_PARALLEL_LINK_JOBS: '4'
134133
commands:
135134
- 'C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat -arch=amd64 -host_arch=amd64'
136135
- 'bash .ci/monolithic-windows.sh "$(echo ${windows_projects} | tr ' ' ';')" "$(echo ${windows_check_targets})"'

.ci/metrics/metrics.py

Lines changed: 132 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,67 @@ class JobMetrics:
2626
workflow_id: int
2727

2828

29-
def get_metrics(github_repo: github.Repository, workflows_to_track: dict[str, int]):
29+
@dataclass
30+
class GaugeMetric:
31+
name: str
32+
value: int
33+
time_ns: int
34+
35+
36+
def get_sampled_workflow_metrics(github_repo: github.Repository):
37+
"""Gets global statistics about the Github workflow queue
38+
39+
Args:
40+
github_repo: A github repo object to use to query the relevant information.
41+
42+
Returns:
43+
Returns a list of GaugeMetric objects, containing the relevant metrics about
44+
the workflow
45+
"""
46+
47+
# Other states are available (pending, waiting, etc), but the meaning
48+
# is not documented (See #70540).
49+
# "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+
)
64+
65+
workflow_metrics = []
66+
workflow_metrics.append(
67+
GaugeMetric(
68+
"workflow_queue_size",
69+
queued_workflow_count,
70+
time.time_ns(),
71+
)
72+
)
73+
workflow_metrics.append(
74+
GaugeMetric(
75+
"running_workflow_count",
76+
running_workflow_count,
77+
time.time_ns(),
78+
)
79+
)
80+
# Always send a hearbeat metric so we can monitor is this container is still able to log to Grafana.
81+
workflow_metrics.append(
82+
GaugeMetric("metrics_container_heartbeat", 1, time.time_ns())
83+
)
84+
return workflow_metrics
85+
86+
87+
def get_per_workflow_metrics(
88+
github_repo: github.Repository, workflows_to_track: dict[str, int]
89+
):
3090
"""Gets the metrics for specified Github workflows.
3191
3292
This function takes in a list of workflows to track, and optionally the
@@ -43,14 +103,14 @@ def get_metrics(github_repo: github.Repository, workflows_to_track: dict[str, in
43103
Returns a list of JobMetrics objects, containing the relevant metrics about
44104
the workflow.
45105
"""
46-
workflow_runs = iter(github_repo.get_workflow_runs())
47-
48106
workflow_metrics = []
49107

50108
workflows_to_include = set(workflows_to_track.keys())
51109

52-
while len(workflows_to_include) > 0:
53-
workflow_run = next(workflow_runs)
110+
for workflow_run in iter(github_repo.get_workflow_runs()):
111+
if len(workflows_to_include) == 0:
112+
break
113+
54114
if workflow_run.status != "completed":
55115
continue
56116

@@ -70,34 +130,6 @@ def get_metrics(github_repo: github.Repository, workflows_to_track: dict[str, in
70130
workflow_jobs = workflow_run.jobs()
71131
if workflow_jobs.totalCount == 0:
72132
continue
73-
if workflow_jobs.totalCount > 1:
74-
raise ValueError(
75-
f"Encountered an unexpected number of jobs: {workflow_jobs.totalCount}"
76-
)
77-
78-
created_at = workflow_jobs[0].created_at
79-
started_at = workflow_jobs[0].started_at
80-
completed_at = workflow_jobs[0].completed_at
81-
82-
job_result = int(workflow_jobs[0].conclusion == "success")
83-
if job_result:
84-
# We still might want to mark the job as a failure if one of the steps
85-
# failed. This is required due to use setting continue-on-error in
86-
# the premerge pipeline to prevent sending emails while we are
87-
# testing the infrastructure.
88-
# TODO(boomanaiden154): Remove this once the premerge pipeline is no
89-
# longer in a testing state and we can directly assert the workflow
90-
# result.
91-
for step in workflow_jobs[0].steps:
92-
if step.conclusion != "success":
93-
job_result = 0
94-
break
95-
96-
queue_time = started_at - created_at
97-
run_time = completed_at - started_at
98-
99-
if run_time.seconds == 0:
100-
continue
101133

102134
if (
103135
workflows_to_track[workflow_run.name] is None
@@ -110,20 +142,45 @@ def get_metrics(github_repo: github.Repository, workflows_to_track: dict[str, in
110142
):
111143
break
112144

113-
# The timestamp associated with the event is expected by Grafana to be
114-
# in nanoseconds.
115-
created_at_ns = int(created_at.timestamp()) * 10**9
116-
117-
workflow_metrics.append(
118-
JobMetrics(
119-
workflow_run.name,
120-
queue_time.seconds,
121-
run_time.seconds,
122-
job_result,
123-
created_at_ns,
124-
workflow_run.id,
145+
for workflow_job in workflow_jobs:
146+
created_at = workflow_job.created_at
147+
started_at = workflow_job.started_at
148+
completed_at = workflow_job.completed_at
149+
150+
job_result = int(workflow_job.conclusion == "success")
151+
if job_result:
152+
# We still might want to mark the job as a failure if one of the steps
153+
# failed. This is required due to use setting continue-on-error in
154+
# the premerge pipeline to prevent sending emails while we are
155+
# testing the infrastructure.
156+
# TODO(boomanaiden154): Remove this once the premerge pipeline is no
157+
# longer in a testing state and we can directly assert the workflow
158+
# result.
159+
for step in workflow_job.steps:
160+
if step.conclusion != "success":
161+
job_result = 0
162+
break
163+
164+
queue_time = started_at - created_at
165+
run_time = completed_at - started_at
166+
167+
if run_time.seconds == 0:
168+
continue
169+
170+
# The timestamp associated with the event is expected by Grafana to be
171+
# in nanoseconds.
172+
created_at_ns = int(created_at.timestamp()) * 10**9
173+
174+
workflow_metrics.append(
175+
JobMetrics(
176+
workflow_run.name + "-" + workflow_job.name,
177+
queue_time.seconds,
178+
run_time.seconds,
179+
job_result,
180+
created_at_ns,
181+
workflow_run.id,
182+
)
125183
)
126-
)
127184

128185
return workflow_metrics
129186

@@ -139,12 +196,27 @@ def upload_metrics(workflow_metrics, metrics_userid, api_key):
139196
metrics_userid: The userid to use for the upload.
140197
api_key: The API key to use for the upload.
141198
"""
199+
200+
if len(workflow_metrics) == 0:
201+
print("No metrics found to upload.", file=sys.stderr)
202+
return
203+
142204
metrics_batch = []
143205
for workflow_metric in workflow_metrics:
144-
workflow_formatted_name = workflow_metric.job_name.lower().replace(" ", "_")
145-
metrics_batch.append(
146-
f"{workflow_formatted_name} queue_time={workflow_metric.queue_time},run_time={workflow_metric.run_time},status={workflow_metric.status} {workflow_metric.created_at_ns}"
147-
)
206+
if isinstance(workflow_metric, GaugeMetric):
207+
name = workflow_metric.name.lower().replace(" ", "_")
208+
metrics_batch.append(
209+
f"{name} value={workflow_metric.value} {workflow_metric.time_ns}"
210+
)
211+
elif isinstance(workflow_metric, JobMetrics):
212+
name = workflow_metric.job_name.lower().replace(" ", "_")
213+
metrics_batch.append(
214+
f"{name} queue_time={workflow_metric.queue_time},run_time={workflow_metric.run_time},status={workflow_metric.status} {workflow_metric.created_at_ns}"
215+
)
216+
else:
217+
raise ValueError(
218+
f"Unsupported object type {type(workflow_metric)}: {str(workflow_metric)}"
219+
)
148220

149221
request_data = "\n".join(metrics_batch)
150222
response = requests.post(
@@ -176,16 +248,21 @@ def main():
176248
# Enter the main loop. Every five minutes we wake up and dump metrics for
177249
# the relevant jobs.
178250
while True:
179-
current_metrics = get_metrics(github_repo, workflows_to_track)
180-
if len(current_metrics) == 0:
181-
print("No metrics found to upload.", file=sys.stderr)
182-
continue
251+
current_metrics = get_per_workflow_metrics(github_repo, workflows_to_track)
252+
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+
)
183257

184258
upload_metrics(current_metrics, grafana_metrics_userid, grafana_api_key)
185259
print(f"Uploaded {len(current_metrics)} metrics", file=sys.stderr)
186260

187261
for workflow_metric in reversed(current_metrics):
188-
workflows_to_track[workflow_metric.job_name] = workflow_metric.workflow_id
262+
if isinstance(workflow_metric, JobMetrics):
263+
workflows_to_track[
264+
workflow_metric.job_name
265+
] = workflow_metric.workflow_id
189266

190267
time.sleep(SCRAPE_INTERVAL_SECONDS)
191268

.ci/monolithic-windows.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ echo "--- cmake"
5050
pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt
5151
pip install -q -r "${MONOREPO_ROOT}"/.ci/requirements.txt
5252

53+
export CC=cl
54+
export CXX=cl
55+
export LD=link
56+
5357
# The CMAKE_*_LINKER_FLAGS to disable the manifest come from research
5458
# on fixing a build reliability issue on the build server, please
5559
# see https://github.com/llvm/llvm-project/pull/82393 and
@@ -72,8 +76,8 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
7276
-D CMAKE_EXE_LINKER_FLAGS="/MANIFEST:NO" \
7377
-D CMAKE_MODULE_LINKER_FLAGS="/MANIFEST:NO" \
7478
-D CMAKE_SHARED_LINKER_FLAGS="/MANIFEST:NO" \
75-
-D LLVM_PARALLEL_COMPILE_JOBS=16 \
76-
-D LLVM_PARALLEL_LINK_JOBS=4
79+
-D LLVM_PARALLEL_COMPILE_JOBS=${MAX_PARALLEL_COMPILE_JOBS} \
80+
-D LLVM_PARALLEL_LINK_JOBS=${MAX_PARALLEL_LINK_JOBS}
7781

7882
echo "--- ninja"
7983
# Targets are not escaped as they are passed as separate arguments.

.github/CODEOWNERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp @nikic
2828
/llvm/lib/Transforms/InstCombine/ @nikic
2929

30-
/clang/include/clang/Sema/Sema.h @Endilll
3130
/clang/test/CXX/drs/ @Endilll
3231
/clang/www/cxx_dr_status.html @Endilll
3332
/clang/www/make_cxx_dr_status @Endilll

.github/new-prs-labeler.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,9 @@ llvm:regalloc:
730730
lldb:
731731
- lldb/**
732732

733+
lldb-dap:
734+
- lldb/tools/lldb-dap/**
735+
733736
backend:AMDGPU:
734737
- '**/*amdgpu*'
735738
- '**/*AMDGPU*'

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

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ jobs:
2323
runs-on: depot-ubuntu-22.04-16
2424
outputs:
2525
container-name: ${{ steps.vars.outputs.container-name }}
26+
container-name-agent: ${{ steps.vars.outputs.container-name-agent }}
2627
container-name-tag: ${{ steps.vars.outputs.container-name-tag }}
28+
container-name-agent-tag: ${{ steps.vars.outputs.container-name-agent-tag }}
2729
container-filename: ${{ steps.vars.outputs.container-filename }}
30+
container-agent-filename: ${{ steps.vars.outputs.container-agent-filename }}
2831
steps:
2932
- name: Checkout LLVM
3033
uses: actions/checkout@v4
@@ -36,25 +39,30 @@ jobs:
3639
tag=`date +%s`
3740
container_name="ghcr.io/$GITHUB_REPOSITORY_OWNER/ci-ubuntu-22.04"
3841
echo "container-name=$container_name" >> $GITHUB_OUTPUT
42+
echo "container-name-agent=$container_name-agent" >> $GITHUB_OUTPUT
3943
echo "container-name-tag=$container_name:$tag" >> $GITHUB_OUTPUT
44+
echo "container-name-agent-tag=$container_name-agent:$tag" >> $GITHUB_OUTPUT
4045
echo "container-filename=$(echo $container_name:$tag | sed -e 's/\//-/g' -e 's/:/-/g').tar" >> $GITHUB_OUTPUT
46+
echo "container-agent-filename=$(echo $container_name-agent:$tag | sed -e 's/\//-/g' -e 's/:/-/g').tar" >> $GITHUB_OUTPUT
4147
- name: Build container
4248
working-directory: ./.github/workflows/containers/github-action-ci/
4349
run: |
44-
podman build -t ${{ steps.vars.outputs.container-name-tag }} .
50+
podman build --target ci-container -t ${{ steps.vars.outputs.container-name-tag }} .
51+
podman build --target ci-container-agent -t ${{ steps.vars.outputs.container-name-agent-tag }} .
4552
4653
# Save the container so we have it in case the push fails. This also
4754
# allows us to separate the push step into a different job so we can
4855
# maintain minimal permissions while building the container.
4956
- name: Save container image
5057
run: |
51-
podman save ${{ steps.vars.outputs.container-name-tag }} > ${{ steps.vars.outputs.container-filename }}
58+
podman save ${{ steps.vars.outputs.container-name-tag }} > ${{ steps.vars.outputs.container-filename }}
59+
podman save ${{ steps.vars.outputs.container-name-agent-tag }} > ${{ steps.vars.outputs.container-agent-filename }}
5260
5361
- name: Upload container image
5462
uses: actions/upload-artifact@v4
5563
with:
5664
name: container
57-
path: ${{ steps.vars.outputs.container-filename }}
65+
path: "*.tar"
5866
retention-days: 14
5967

6068
- name: Test Container
@@ -86,3 +94,8 @@ jobs:
8694
podman login -u ${{ github.actor }} -p $GITHUB_TOKEN ghcr.io
8795
podman push ${{ needs.build-ci-container.outputs.container-name-tag }}
8896
podman push ${{ needs.build-ci-container.outputs.container-name }}:latest
97+
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

.github/workflows/clang-tests.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)