Skip to content

Commit 47a2e29

Browse files
committed
pgo: add darwin pipeline
1 parent 46a3979 commit 47a2e29

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

src/ci/stage-build.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,49 @@ def supports_bolt(self) -> bool:
208208
return False
209209

210210

211+
class DarwinPipeline(Pipeline):
212+
def __init__(self):
213+
self.checkout_dir = Path(os.getcwd())
214+
215+
def checkout_path(self) -> Path:
216+
return self.checkout_dir
217+
218+
def downloaded_llvm_dir(self) -> Path:
219+
return self.checkout_path() / "citools" / "clang-rust"
220+
221+
def build_root(self) -> Path:
222+
return self.checkout_path()
223+
224+
def opt_artifacts(self) -> Path:
225+
return Path("/tmp/tmp-multistage/opt-artifacts")
226+
227+
def build_rustc_perf(self):
228+
# rustc-perf version from 2022-07-22
229+
perf_commit = "3c253134664fdcba862c539d37f0de18557a9a4c"
230+
rustc_perf_zip_path = self.opt_artifacts() / "perf.zip"
231+
232+
def download_rustc_perf():
233+
download_file(
234+
f"https://github.com/rust-lang/rustc-perf/archive/{perf_commit}.zip",
235+
rustc_perf_zip_path
236+
)
237+
with change_cwd(self.opt_artifacts()):
238+
unpack_archive(rustc_perf_zip_path)
239+
move_path(Path(f"rustc-perf-{perf_commit}"), self.rustc_perf_dir())
240+
delete_file(rustc_perf_zip_path)
241+
242+
retry_action(download_rustc_perf, "Download rustc-perf")
243+
244+
with change_cwd(self.rustc_perf_dir()):
245+
cmd([self.cargo_stage_0(), "build", "-p", "collector"], env=dict(
246+
RUSTC=str(self.rustc_stage_0()),
247+
RUSTC_BOOTSTRAP="1"
248+
))
249+
250+
def supports_bolt(self) -> bool:
251+
return False
252+
253+
211254
def get_timestamp() -> float:
212255
return time.time()
213256

@@ -576,6 +619,8 @@ def create_pipeline() -> Pipeline:
576619
return LinuxPipeline()
577620
elif sys.platform in ("cygwin", "win32"):
578621
return WindowsPipeline()
622+
elif sys.platform == "darwin":
623+
return DarwinPipeline()
579624
else:
580625
raise Exception(f"Optimized build is not supported for platform {sys.platform}")
581626

0 commit comments

Comments
 (0)