Skip to content

Commit 8914148

Browse files
gh-141808: Don't remove the JIT stencils when building with PGO (#141809)
See: https://discuss.python.org/t/building-the-jit-with-pre-built-stencils/91838/12 Co-authored-by: Mikhail Efimov <[email protected]>
1 parent c5825ff commit 8914148

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

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

843843
# Compile with profile generation enabled.
@@ -3250,7 +3250,6 @@ clean-retain-profile: pycremoval
32503250
-rm -rf Python/deepfreeze
32513251
-rm -f Python/frozen_modules/*.h
32523252
-rm -f Python/frozen_modules/MANIFEST
3253-
-rm -f jit_stencils*.h
32543253
-find build -type f -a ! -name '*.gc??' -exec rm -f {} ';'
32553254
-rm -f Include/pydtrace_probes.h
32563255
-rm -f profile-gen-stamp
@@ -3269,13 +3268,21 @@ profile-removal:
32693268
rm -f profile-run-stamp
32703269
rm -f profile-bolt-stamp
32713270

3272-
.PHONY: clean
3273-
clean: clean-retain-profile clean-bolt
3271+
.PHONY: clean-profile
3272+
clean-profile: clean-retain-profile clean-bolt
32743273
@if test @DEF_MAKE_ALL_RULE@ = profile-opt -o @DEF_MAKE_ALL_RULE@ = bolt-opt; then \
32753274
rm -f profile-gen-stamp profile-clean-stamp; \
32763275
$(MAKE) profile-removal; \
32773276
fi
32783277

3278+
# gh-141808: The JIT stencils are deliberately kept in clean-profile
3279+
.PHONY: clean-jit-stencils
3280+
clean-jit-stencils:
3281+
-rm -f jit_stencils*.h
3282+
3283+
.PHONY: clean
3284+
clean: clean-profile clean-jit-stencils
3285+
32793286
.PHONY: clobber
32803287
clobber: clean
32813288
-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)