Skip to content

Commit 73c80f6

Browse files
StanFromIrelandhroncokefimov-mikhail
authored
[3.14] gh-141808: Don't remove the JIT stencils when building with PGO (GH-141809) (GH-142657)
See: https://discuss.python.org/t/building-the-jit-with-pre-built-stencils/91838/12 (cherry picked from commit 8914148) Co-authored-by: Miro Hrončok <[email protected]> Co-authored-by: Mikhail Efimov <[email protected]>
1 parent 27f27a6 commit 73c80f6

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
@@ -834,7 +834,7 @@ check-app-store-compliance:
834834

835835
# Profile generation build must start from a clean tree.
836836
profile-clean-stamp:
837-
$(MAKE) clean
837+
$(MAKE) clean-profile
838838
touch $@
839839

840840
# Compile with profile generation enabled.
@@ -3222,7 +3222,6 @@ clean-retain-profile: pycremoval
32223222
-rm -rf Python/deepfreeze
32233223
-rm -f Python/frozen_modules/*.h
32243224
-rm -f Python/frozen_modules/MANIFEST
3225-
-rm -f jit_stencils.h
32263225
-find build -type f -a ! -name '*.gc??' -exec rm -f {} ';'
32273226
-rm -f Include/pydtrace_probes.h
32283227
-rm -f profile-gen-stamp
@@ -3241,13 +3240,21 @@ profile-removal:
32413240
rm -f profile-run-stamp
32423241
rm -f profile-bolt-stamp
32433242

3244-
.PHONY: clean
3245-
clean: clean-retain-profile clean-bolt
3243+
.PHONY: clean-profile
3244+
clean-profile: clean-retain-profile clean-bolt
32463245
@if test @DEF_MAKE_ALL_RULE@ = profile-opt -o @DEF_MAKE_ALL_RULE@ = bolt-opt; then \
32473246
rm -f profile-gen-stamp profile-clean-stamp; \
32483247
$(MAKE) profile-removal; \
32493248
fi
32503249

3250+
# gh-141808: The JIT stencils are deliberately kept in clean-profile
3251+
.PHONY: clean-jit-stencils
3252+
clean-jit-stencils:
3253+
-rm -f jit_stencils*.h
3254+
3255+
.PHONY: clean
3256+
clean: clean-profile clean-jit-stencils
3257+
32513258
.PHONY: clobber
32523259
clobber: clean
32533260
-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)