Skip to content

Commit 5d82520

Browse files
hroncokStanFromIrelandefimov-mikhail
authored
[3.13] gh-141808: Don't remove the JIT stencils when building with PGO (GH-141809) (GH-142657) (#142955)
See: https://discuss.python.org/t/building-the-jit-with-pre-built-stencils/91838/12 (cherry picked from commit 8914148) (cherry picked from commit 73c80f6) Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
1 parent 98d97d7 commit 5d82520

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

Makefile.pre.in

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ check-app-store-compliance:
730730

731731
# Profile generation build must start from a clean tree.
732732
profile-clean-stamp:
733-
$(MAKE) clean
733+
$(MAKE) clean-profile
734734
touch $@
735735

736736
# Compile with profile generation enabled.
@@ -2972,7 +2972,6 @@ clean-retain-profile: pycremoval
29722972
-rm -rf Python/deepfreeze
29732973
-rm -f Python/frozen_modules/*.h
29742974
-rm -f Python/frozen_modules/MANIFEST
2975-
-rm -f jit_stencils.h
29762975
-find build -type f -a ! -name '*.gc??' -exec rm -f {} ';'
29772976
-rm -f Include/pydtrace_probes.h
29782977
-rm -f profile-gen-stamp
@@ -2991,13 +2990,21 @@ profile-removal:
29912990
rm -f profile-run-stamp
29922991
rm -f profile-bolt-stamp
29932992

2994-
.PHONY: clean
2995-
clean: clean-retain-profile clean-bolt
2993+
.PHONY: clean-profile
2994+
clean-profile: clean-retain-profile clean-bolt
29962995
@if test @DEF_MAKE_ALL_RULE@ = profile-opt -o @DEF_MAKE_ALL_RULE@ = bolt-opt; then \
29972996
rm -f profile-gen-stamp profile-clean-stamp; \
29982997
$(MAKE) profile-removal; \
29992998
fi
30002999

3000+
# gh-141808: The JIT stencils are deliberately kept in clean-profile
3001+
.PHONY: clean-jit-stencils
3002+
clean-jit-stencils:
3003+
-rm -f jit_stencils*.h
3004+
3005+
.PHONY: clean
3006+
clean: clean-profile clean-jit-stencils
3007+
30013008
.PHONY: clobber
30023009
clobber: clean
30033010
-rm -f $(BUILDPYTHON) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
When running ``make clean-retain-profile``, keep the
2+
generated JIT stencils. That way, the stencils are not generated twice when
3+
Profile-guided optimization (PGO) is used. It also allows distributors to
4+
supply their own pre-built JIT stencils.

0 commit comments

Comments
 (0)