Skip to content

Commit f3ea4a6

Browse files
committed
Fix pgo profile upload
1 parent 139e632 commit f3ea4a6

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

mx.graalpython/mx_graalpython.py

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,8 @@ def libpythonvm_build_args():
294294
f"graalpy/{commit}",
295295
profile,
296296
],
297-
nonZeroIsFatal=False
297+
nonZeroIsFatal=False,
298+
env={"UPLOADER_PYTHON": sys.executable, **os.environ},
298299
)
299300
else:
300301
# Locally, we try to get a reasonable profile
@@ -314,7 +315,7 @@ def libpythonvm_build_args():
314315
or ",bench," in os.environ.get("LABELS", "")
315316
):
316317
mx.warn("PGO profile must exist for benchmarking and release, creating one now...")
317-
profile = graalpy_native_pgo_build_and_test([])
318+
profile = graalpy_native_pgo_build_and_test()
318319

319320
if os.path.isfile(profile or ""):
320321
print(invert(f"Automatically chose PGO profile {profile}. To disable this, set GRAALPY_PGO_PROFILE to an empty string'", blinking=True), file=sys.stderr)
@@ -329,7 +330,7 @@ def libpythonvm_build_args():
329330
return build_args
330331

331332

332-
def graalpy_native_pgo_build_and_test(_):
333+
def graalpy_native_pgo_build_and_test(args=None):
333334
"""
334335
Builds a PGO-instrumented GraalPy native standalone, runs the unittests to generate a profile,
335336
then builds a PGO-optimized GraalPy native standalone with the collected profile.
@@ -409,18 +410,22 @@ def graalpy_native_pgo_build_and_test(_):
409410
mx.log(mx.colorize(f"[PGO] Gzipped profile at: {iprof_gz_path}", color="yellow"))
410411

411412
if shutil.which("artifact_uploader"):
412-
run([
413-
"artifact_uploader",
414-
iprof_gz_path,
415-
str(SUITE.vc.tip(SUITE.dir)).strip(),
416-
"graalpy",
417-
"--lifecycle",
418-
"cache",
419-
"--artifact-repo-key",
420-
os.environ.get("ARTIFACT_REPO_KEY_LOCATION"),
421-
])
413+
run(
414+
[
415+
"artifact_uploader",
416+
iprof_gz_path,
417+
str(SUITE.vc.tip(SUITE.dir)).strip(),
418+
"graalpy",
419+
"--lifecycle",
420+
"cache",
421+
"--artifact-repo-key",
422+
os.environ.get("ARTIFACT_REPO_KEY_LOCATION"),
423+
],
424+
env={"UPLOADER_PYTHON": sys.executable, **os.environ},
425+
)
422426

423-
return iprof_gz_path
427+
if args is None:
428+
return iprof_gz_path
424429

425430

426431
def full_python(args, env=None):

0 commit comments

Comments
 (0)