Skip to content

Commit 28d0b6e

Browse files
committed
Merge remote-tracking branch 'upstream/main' into rustify-snapshot-module
2 parents bb98537 + 1881187 commit 28d0b6e

File tree

312 files changed

+17343
-18718
lines changed

Some content is hidden

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

312 files changed

+17343
-18718
lines changed

.buildkite/common.py

Lines changed: 60 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
import subprocess
1414
from pathlib import Path
1515

16-
DEFAULT_INSTANCES = [
17-
"c5n.metal", # Intel Skylake
18-
"m5n.metal", # Intel Cascade Lake
19-
"m6i.metal", # Intel Icelake
20-
"m6a.metal", # AMD Milan
21-
"m6g.metal", # Graviton2
22-
"m7g.metal", # Graviton3
23-
]
16+
DEFAULT_INSTANCES = {
17+
"c5n.metal": "x86_64", # Intel Skylake
18+
"m5n.metal": "x86_64", # Intel Cascade Lake
19+
"m6i.metal": "x86_64", # Intel Icelake
20+
"m6a.metal": "x86_64", # AMD Milan
21+
"m6g.metal": "aarch64", # Graviton2
22+
"m7g.metal": "aarch64", # Graviton3
23+
}
2424

2525
DEFAULT_PLATFORMS = [
2626
("al2", "linux_5.10"),
@@ -145,7 +145,7 @@ def __call__(self, parser, namespace, value, option_string=None):
145145
"--instances",
146146
required=False,
147147
nargs="+",
148-
default=DEFAULT_INSTANCES,
148+
default=DEFAULT_INSTANCES.keys(),
149149
)
150150
COMMON_PARSER.add_argument(
151151
"--platforms",
@@ -188,6 +188,7 @@ def ab_revision_build(revision):
188188
"git branch $$branch_name $$commitish",
189189
f"git clone -b $$branch_name . build/{revision}",
190190
f"cd build/{revision} && ./tools/devtool -y build --release && cd -",
191+
"git branch -D $$branch_name",
191192
]
192193

193194

@@ -204,7 +205,9 @@ def shared_build():
204205
if rev_a is not None:
205206
rev_b = os.environ.get("REVISION_B")
206207
assert rev_b is not None, "REVISION_B environment variable not set"
207-
build_cmds = ab_revision_build(rev_a) + ab_revision_build(rev_b)
208+
build_cmds = ab_revision_build(rev_a)
209+
if rev_a != rev_b:
210+
build_cmds += ab_revision_build(rev_b)
208211
elif os.environ.get("BUILDKITE_PULL_REQUEST", "false") != "false":
209212
build_cmds = ab_revision_build(
210213
os.environ.get("BUILDKITE_PULL_REQUEST_BASE_BRANCH", "main")
@@ -229,7 +232,7 @@ class BKPipeline:
229232

230233
parser = COMMON_PARSER
231234

232-
def __init__(self, initial_steps=None, **kwargs):
235+
def __init__(self, with_build_step=True, **kwargs):
233236
self.steps = []
234237
self.args = args = self.parser.parse_args()
235238
# Retry one time if agent was lost. This can happen if we terminate the
@@ -252,42 +255,36 @@ def __init__(self, initial_steps=None, **kwargs):
252255
self.per_arch["platforms"] = [("al2", "linux_5.10")]
253256
self.binary_dir = args.binary_dir
254257
# Build sharing
255-
build_cmds, self.shared_build = shared_build()
256-
step_build = group("🏗️ Build", build_cmds, **self.per_arch)
257-
self.steps += [step_build, "wait"]
258-
259-
# If we run initial_steps before the "wait" step above, then a failure of the initial steps
260-
# would result in the build not progressing past the "wait" step (as buildkite only proceeds past a wait step
261-
# if everything before it passed). Thus put the initial steps after the "wait" step, but set `"depends_on": null`
262-
# to start running them immediately (e.g. without waiting for the "wait" step to unblock).
263-
#
264-
# See also https://buildkite.com/docs/pipelines/dependencies#explicit-dependencies-in-uploaded-steps
265-
if initial_steps:
266-
for step in initial_steps:
267-
step["depends_on"] = None
268-
269-
self.steps += initial_steps
270-
271-
def add_step(self, step, decorate=True):
258+
if with_build_step:
259+
build_cmds, self.shared_build = shared_build()
260+
self.build_group_per_arch(
261+
"🏗️ Build", build_cmds, depends_on_build=False, set_key=True
262+
)
263+
else:
264+
self.shared_build = None
265+
266+
def add_step(self, step, depends_on_build=True):
272267
"""
273268
Add a step to the pipeline.
274269
275270
https://buildkite.com/docs/pipelines/step-reference
276271
277272
:param step: a Buildkite step
278-
:param decorate: inject needed commands for sharing builds
273+
:param depends_on_build: inject needed commands for sharing builds
279274
"""
280-
if decorate and isinstance(step, dict):
275+
if depends_on_build and isinstance(step, dict):
281276
step = self._adapt_group(step)
282277
self.steps.append(step)
283278
return step
284279

285280
def _adapt_group(self, group):
286281
""""""
287-
prepend = [
288-
f'buildkite-agent artifact download "{self.shared_build}" .',
289-
f"tar xzf {self.shared_build}",
290-
]
282+
prepend = []
283+
if self.shared_build is not None:
284+
prepend = [
285+
f'buildkite-agent artifact download "{self.shared_build}" .',
286+
f"tar xzf {self.shared_build}",
287+
]
291288
if self.binary_dir is not None:
292289
prepend.extend(
293290
[
@@ -298,6 +295,10 @@ def _adapt_group(self, group):
298295

299296
for step in group["steps"]:
300297
step["command"] = prepend + step["command"]
298+
if self.shared_build is not None:
299+
step["depends_on"] = self.build_key(
300+
DEFAULT_INSTANCES[step["agents"]["instance"]]
301+
)
301302
return group
302303

303304
def build_group(self, *args, **kwargs):
@@ -306,15 +307,34 @@ def build_group(self, *args, **kwargs):
306307
307308
https://buildkite.com/docs/pipelines/group-step
308309
"""
310+
depends_on_build = kwargs.pop("depends_on_build", True)
309311
combined = overlay_dict(self.per_instance, kwargs)
310-
return self.add_step(group(*args, **combined))
312+
return self.add_step(
313+
group(*args, **combined), depends_on_build=depends_on_build
314+
)
315+
316+
def build_key(self, arch):
317+
"""Return the Buildkite key for the build step, for the specified arch"""
318+
return self.shared_build.replace("$(uname -m)", arch).replace(".tar.gz", "")
311319

312-
def build_group_per_arch(self, *args, **kwargs):
320+
def build_group_per_arch(self, label, *args, **kwargs):
313321
"""
314322
Build a group, parametrizing over the architectures only.
323+
324+
kwargs consumed by this method and not passed down to `group`:
325+
- `depends_on_build` (default: `True`): Whether the steps in this group depend on the artifacts from the shared compilation steps
326+
- `set_key`: If True, causes the generated steps to have a "key" field
315327
"""
328+
depends_on_build = kwargs.pop("depends_on_build", True)
329+
set_key = kwargs.pop("set_key", None)
316330
combined = overlay_dict(self.per_arch, kwargs)
317-
return self.add_step(group(*args, **combined))
331+
grp = group(label, *args, **combined)
332+
if set_key:
333+
for step in grp["steps"]:
334+
step["key"] = self.build_key(
335+
DEFAULT_INSTANCES[step["agents"]["instance"]]
336+
)
337+
return self.add_step(grp, depends_on_build=depends_on_build)
318338

319339
def to_dict(self):
320340
"""Render the pipeline as a dictionary."""
@@ -327,7 +347,9 @@ def to_json(self):
327347
def devtool_test(self, devtool_opts=None, pytest_opts=None):
328348
"""Generate a `devtool test` command"""
329349
cmds = []
330-
parts = ["./tools/devtool -y test", "--no-build"]
350+
parts = ["./tools/devtool -y test"]
351+
if self.shared_build is not None:
352+
parts.append("--no-build")
331353
if devtool_opts:
332354
parts.append(devtool_opts)
333355
parts.append("--")

.buildkite/pipeline_cpu_template.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class BkStep(str, Enum):
2323
cpu_template_test = {
2424
"rdmsr": {
2525
BkStep.COMMAND: [
26-
"tools/devtool -y test --no-build -- -s -ra -m nonci -n4 --log-cli-level=INFO integration_tests/functional/test_cpu_features.py -k 'test_cpu_rdmsr' "
26+
"tools/devtool -y test --no-build -- -m nonci -n4 --dist worksteal integration_tests/functional/test_cpu_features.py -k 'test_cpu_rdmsr' "
2727
],
2828
BkStep.LABEL: "📖 rdmsr",
2929
"instances": ["c5n.metal", "m5n.metal", "m6a.metal", "m6i.metal"],
@@ -34,13 +34,13 @@ class BkStep(str, Enum):
3434
"tools/devtool -y test --no-build -- -m no_block_pr integration_tests/functional/test_cpu_template_helper.py -k test_guest_cpu_config_change",
3535
],
3636
BkStep.LABEL: "🖐️ fingerprint",
37-
"instances": DEFAULT_INSTANCES,
37+
"instances": DEFAULT_INSTANCES.keys(),
3838
"platforms": DEFAULT_PLATFORMS,
3939
},
4040
"cpuid_wrmsr": {
4141
"snapshot": {
4242
BkStep.COMMAND: [
43-
"tools/devtool -y test --no-build -- -s -ra -m nonci -n4 --log-cli-level=INFO integration_tests/functional/test_cpu_features.py -k 'test_cpu_wrmsr_snapshot or test_cpu_cpuid_snapshot'",
43+
"tools/devtool -y test --no-build -- -m nonci -n4 --dist worksteal integration_tests/functional/test_cpu_features.py -k 'test_cpu_wrmsr_snapshot or test_cpu_cpuid_snapshot'",
4444
"mkdir -pv tests/snapshot_artifacts_upload/{instance}_{os}_{kv}",
4545
"sudo mv tests/snapshot_artifacts/* tests/snapshot_artifacts_upload/{instance}_{os}_{kv}",
4646
],
@@ -52,7 +52,7 @@ class BkStep(str, Enum):
5252
BkStep.COMMAND: [
5353
"buildkite-agent artifact download tests/snapshot_artifacts_upload/{instance}_{os}_{kv}/**/* .",
5454
"mv tests/snapshot_artifacts_upload/{instance}_{os}_{kv} tests/snapshot_artifacts",
55-
"tools/devtool -y test --no-build -- -s -ra -m nonci -n4 --log-cli-level=INFO integration_tests/functional/test_cpu_features.py -k 'test_cpu_wrmsr_restore or test_cpu_cpuid_restore'",
55+
"tools/devtool -y test --no-build -- -m nonci -n4 --dist worksteal integration_tests/functional/test_cpu_features.py -k 'test_cpu_wrmsr_restore or test_cpu_cpuid_restore'",
5656
],
5757
BkStep.LABEL: "📸 load snapshot artifacts created on {instance} {snapshot_os} {snapshot_kv} to {restore_instance} {restore_os} {restore_kv}",
5858
BkStep.TIMEOUT: 30,
@@ -117,11 +117,11 @@ def group_snapshot_restore(test_step):
117117
BkStep.COMMAND: restore_commands,
118118
BkStep.LABEL: restore_label,
119119
BkStep.TIMEOUT: test_step["restore"][BkStep.TIMEOUT],
120-
"agents": [
121-
f"instance={restore_instance}",
122-
f"kv={restore_kv}",
123-
f"os={restore_os}",
124-
],
120+
"agents": {
121+
"instance": restore_instance,
122+
"kv": restore_kv,
123+
"os": restore_os,
124+
},
125125
}
126126
)
127127

.buildkite/pipeline_perf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@
120120
# will pin steps running on instances "m6i.metal" with kernel version tagged "linux_6.1"
121121
# to a new kernel version tagged "linux_6.1-pinned"
122122
pins = {
123+
# TODO: Unpin when performance instability on m6i/5.10 has gone.
123124
"linux_5.10-pinned": {"instance": "m6i.metal", "kv": "linux_5.10"},
124-
"linux_6.1-pinned": {"instance": "m6i.metal", "kv": "linux_6.1"},
125125
}
126126

127127

.buildkite/pipeline_pr.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,23 @@
1414
"agents": {"ag": 1},
1515
}
1616

17+
changed_files = get_changed_files()
18+
DOC_ONLY_CHANGE = False
19+
if changed_files and all(f.suffix == ".md" for f in changed_files):
20+
DOC_ONLY_CHANGE = True
1721
pipeline = BKPipeline(
1822
priority=DEFAULT_PRIORITY,
1923
timeout_in_minutes=45,
20-
initial_steps=[
21-
{
22-
"command": "./tools/devtool -y checkstyle",
23-
"label": "🪶 Style",
24-
},
25-
],
24+
with_build_step=not DOC_ONLY_CHANGE,
2625
)
2726

28-
changed_files = get_changed_files()
27+
pipeline.add_step(
28+
{
29+
"command": "./tools/devtool -y checkstyle",
30+
"label": "🪶 Style",
31+
},
32+
depends_on_build=False,
33+
)
2934

3035
# run sanity build of devtool if Dockerfile is changed
3136
if any(x.parent.name == "devctr" for x in changed_files):
@@ -48,13 +53,14 @@
4853
):
4954
kani_grp = pipeline.build_group(
5055
"🔍 Kani",
51-
"./tools/devtool -y test -- ../tests/integration_tests/test_kani.py -n auto",
56+
"./tools/devtool -y test --no-build -- ../tests/integration_tests/test_kani.py -n auto",
5257
# Kani step default
5358
# Kani runs fastest on m6a.metal
54-
instances=["m6a.metal"],
59+
instances=["m6a.metal", "m7g.metal"],
5560
platforms=[("al2", "linux_5.10")],
5661
timeout_in_minutes=300,
5762
**DEFAULTS_PERF,
63+
depends_on_build=False,
5864
)
5965
# modify Kani steps' label
6066
for step in kani_grp["steps"]:
@@ -64,6 +70,7 @@
6470
pipeline.build_group(
6571
"📦 Build",
6672
pipeline.devtool_test(pytest_opts="integration_tests/build/"),
73+
depends_on_build=False,
6774
)
6875

6976
pipeline.build_group(

.buildkite/pipeline_pr_no_block.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
DEFAULT_PRIORITY = 1
1212

1313
pipeline = BKPipeline(
14+
with_build_step=False,
1415
timeout_in_minutes=45,
1516
# some non-blocking tests are performance, so make sure they get ag=1 instances
1617
priority=DEFAULT_PRIORITY + 1,

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ build/
33
src/
44
tests/
55
docs/
6+
resources/
7+
tools/test-popular-containers/
8+
test_results/

.github/CODEOWNERS

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# All markdown files
2-
*.md @xmarcalx @kalyazin @pb8o
2+
*.md @xmarcalx @kalyazin @pb8o @Manciukic
33

44
# But not the ones in docs/
55
docs/*.md
66

77
# Except these specific ones
8-
docs/getting-started.md @xmarcalx @kalyazin @pb8o
9-
docs/prod-host-setup.md @xmarcalx @kalyazin @pb8o
8+
docs/getting-started.md @xmarcalx @kalyazin @pb8o @Manciukic
9+
docs/prod-host-setup.md @xmarcalx @kalyazin @pb8o @Manciukic
1010

1111
# Also cover all "*policy*.md" documents
12-
**/*policy*.md @xmarcalx @kalyazin @pb8o
13-
**/*POLICY*.md @xmarcalx @kalyazin @pb8o
12+
**/*policy*.md @xmarcalx @kalyazin @pb8o @Manciukic
13+
**/*POLICY*.md @xmarcalx @kalyazin @pb8o @Manciukic
1414

1515
# Also these non-md files in the repository root
16-
THIRD_PARTY @xmarcalx @kalyazin @pb8o
17-
LICENSE @xmarcalx @kalyazin @pb8o
18-
NOTICE @xmarcalx @kalyazin @pb8o
19-
PGP-KEY.asc @xmarcalx @kalyazin @pb8o
16+
THIRD_PARTY @xmarcalx @kalyazin @pb8o @Manciukic
17+
LICENSE @xmarcalx @kalyazin @pb8o @Manciukic
18+
NOTICE @xmarcalx @kalyazin @pb8o @Manciukic
19+
PGP-KEY.asc @xmarcalx @kalyazin @pb8o @Manciukic

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ test_results/*
1212
*.profraw
1313
.DS_Store
1414
*.bin
15+
/resources/linux
16+
/resources/x86_64
17+
/resources/aarch64

.mailmap

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,18 @@ Alexandru Cihodaru <cihodar@amazon.com>
1818
Liviu Berciu <lberciu@amazon.com>
1919
Jonathan Woollett-Light <jcawl@amazon.co.uk> <jonathanwoollettlight@gmail.com>
2020
Jonathan Woollett-Light <jcawl@amazon.co.uk> <jonthanwoollettlight@gmail.com>
21-
Sudan Landge <sudanl@amazon.com> <sudan@amazon.co.uk>
21+
Sudan Landge <sudanl@amazon.co.uk> <119602619+sudanl0@users.noreply.github.com>
22+
Sudan Landge <sudanl@amazon.co.uk> <sudanl@amazon.com>
2223
karthik nedunchezhiyan <karthik.n@zohocorp.com>
2324
Babis Chalios <bchalios@amazon.es> <babis.chalios@gmail.com>
2425
Pablo Barbáchano <pablob@amazon.com>
2526
Nikita Kalyazin <kalyazin@amazon.co.uk> <kalyazin@amazon.com>
2627
Trăistaru Andrei Cristian <atc@amazon.com>
2728
Trăistaru Andrei Cristian <atc@amazon.com> <56828222+andreitraistaru@users.noreply.github.com>
28-
Sudan Landge <sudanl@amazon.com> <sudanl@amazon.co.uk>
2929
Takahiro Itazuri <itazur@amazon.com> <zulinx86@gmail.com>
30+
Jack Thomson <jackabt@amazon.co.uk> <jackabt@amazon.com>
31+
Ashwin Ginoria <aginoria@amazon.com> <ec2-user@ip-10-0-10-88.us-west-2.compute.internal>
32+
Muskaan Singla <msinglaa@amazon.com> <ec2-user@ip-172-31-1-28.us-west-2.compute.internal>
33+
Egor Lazarchuk <yegorlz@amazon.co.uk>
34+
Nikita Zakirov <zakironi@amazon.com> <ec2-user@ip-10-0-15-219.us-west-2.compute.internal>
35+
Tomoya Iwata <iwata.tomoya@classmethod.jp>

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.10.14

0 commit comments

Comments
 (0)