https://github.com/python/cpython/commit/39ea54a64ba20d6c9ac12c874d158b4ff831673b commit: 39ea54a64ba20d6c9ac12c874d158b4ff831673b branch: main author: Zanie Blue <[email protected]> committer: itamaro <[email protected]> date: 2026-10-23T09:50:54-07:00 summary:
gh-160381: Show LLVM profile statistics after PGO training (#160373) LLVM PGO builds merge the training profiles without showing the profile-count distribution or functions with the hottest basic blocks. Run `llvm-profdata show --detailed-summary --topn=500` after merging to make it easier to compare training workloads. Addresses [astral-sh/python-build-standalone#1033](https://github.com/astral-sh/python-build-standalone/issues/1033) tracking upstreaming of this patch. files: M Makefile.pre.in M configure M configure.ac diff --git a/Makefile.pre.in b/Makefile.pre.in index 891f9a48e3e7f5..ba83a1be2fa713 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -50,6 +50,7 @@ GITBRANCH= @GITBRANCH@ PGO_PROF_GEN_FLAG=@PGO_PROF_GEN_FLAG@ PGO_PROF_USE_FLAG=@PGO_PROF_USE_FLAG@ LLVM_PROF_MERGER=@LLVM_PROF_MERGER@ +LLVM_PROF_SHOW=@LLVM_PROF_SHOW@ LLVM_PROF_FILE=@LLVM_PROF_FILE@ LLVM_PROF_ERR=@LLVM_PROF_ERR@ DTRACE= @DTRACE@ @@ -857,6 +858,7 @@ profile-run-stamp: @ # FIXME: can't run for a cross build $(LLVM_PROF_FILE) $(RUNSHARED) ./$(BUILDPYTHON) $(PROFILE_TASK) $(LLVM_PROF_MERGER) + $(LLVM_PROF_SHOW) # Remove profile generation binary since we are done with it. $(MAKE) clean-retain-profile # This is an expensive target to build and it does not have proper diff --git a/configure b/configure index 895266d28916c4..efd9d7ace16713 100755 --- a/configure +++ b/configure @@ -938,6 +938,7 @@ LLVM_PROF_FOUND LLVM_PROFDATA LLVM_PROF_ERR LLVM_PROF_FILE +LLVM_PROF_SHOW LLVM_PROF_MERGER PGO_PROF_USE_FLAG PGO_PROF_GEN_FLAG @@ -9382,6 +9383,7 @@ fi + if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}llvm-profdata", so it can be a program name with args. set dummy ${ac_tool_prefix}llvm-profdata; ac_word=$2 @@ -9513,6 +9515,7 @@ printf "%s\n" "$as_me: llvm-profdata found via xcrun: ${LLVM_PROFDATA}" >&6;} fi fi LLVM_PROF_ERR=no +LLVM_PROF_SHOW=true case "$ac_cv_cc_name" in clang|icx) @@ -9521,6 +9524,7 @@ case "$ac_cv_cc_name" in PGO_PROF_USE_FLAG="-fprofile-instr-use=\"\$(shell pwd)/code.profclangd\"" LLVM_PROF_MERGER=" ${LLVM_PROFDATA} merge -output=\"\$(shell pwd)/code.profclangd\" \"\$(shell pwd)\"/*.profclangr " LLVM_PROF_FILE="LLVM_PROFILE_FILE=\"\$(shell pwd)/code-%p.profclangr\"" + LLVM_PROF_SHOW=" ${LLVM_PROFDATA} show --detailed-summary --topn=500 \"\$(shell pwd)/code.profclangd\" " if test $LLVM_PROF_FOUND = not-found then LLVM_PROF_ERR=yes diff --git a/configure.ac b/configure.ac index aae7e00105131b..7faf0c8a4ae662 100644 --- a/configure.ac +++ b/configure.ac @@ -2292,6 +2292,7 @@ fi AC_SUBST([PGO_PROF_GEN_FLAG]) AC_SUBST([PGO_PROF_USE_FLAG]) AC_SUBST([LLVM_PROF_MERGER]) +AC_SUBST([LLVM_PROF_SHOW]) AC_SUBST([LLVM_PROF_FILE]) AC_SUBST([LLVM_PROF_ERR]) AC_SUBST([LLVM_PROFDATA]) @@ -2316,6 +2317,7 @@ then fi fi LLVM_PROF_ERR=no +LLVM_PROF_SHOW=true case "$ac_cv_cc_name" in clang|icx) @@ -2328,6 +2330,10 @@ case "$ac_cv_cc_name" in \"\$(shell pwd)\"/*.profclangr ") LLVM_PROF_FILE="LLVM_PROFILE_FILE=\"\$(shell pwd)/code-%p.profclangr\"" + LLVM_PROF_SHOW=m4_normalize(" + ${LLVM_PROFDATA} show --detailed-summary --topn=500 + \"\$(shell pwd)/code.profclangd\" + ") if test $LLVM_PROF_FOUND = not-found then LLVM_PROF_ERR=yes _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
