Skip to content

Conversation

@hroncok
Copy link
Contributor

@hroncok hroncok commented Nov 20, 2025

@hroncok
Copy link
Contributor Author

hroncok commented Nov 20, 2025

I opened this as a draft, because keeping the files from being deleted when make clean is run might be surprising for somebody. An alternative solution for Fedora would be to add something like --with-jit-stencils PATH to configure, which would replace JIT building with copying. However, I still think that building the JIT files multiple times during a PGO build is wasting resources.

…8.NEewZC.rst

Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
@hroncok hroncok marked this pull request as ready for review November 26, 2025 11:12
@emmatyping
Copy link
Member

emmatyping commented Nov 26, 2025

My understanding of clean-retain-profile is that it is meant to remove files that depend on PYTHON_FOR_REGEN, since that will change between the PGO run and the final build. If that is correct, then I would say the stencils should be rm'd in make clean and make distclean, but should not change with make clean-retain-profile, since, as I understand it, the JIT stencils do not depend on the Python binary used other than platform information (which should not change across executables for the same host and build).

So I would suggest making a new target clean-jit-stencils which will be a dep of distclean and clean but not clean-retain-profile

@hroncok
Copy link
Contributor Author

hroncok commented Nov 26, 2025

However, when the stencils are removed in make clean, they are apparently also removed during the pgo task that calls it. I have not yet figured out why and where make clean is called.

@hroncok
Copy link
Contributor Author

hroncok commented Nov 26, 2025

Ah:

cpython/Makefile.pre.in

Lines 838 to 841 in bc9e63d

# Profile generation build must start from a clean tree.
profile-clean-stamp:
$(MAKE) clean
touch $@

So the problem with my approach is that by dropping in the prebuilt stencils before this runs, they are deleted here. That's probably only problematic for my use case :/

@hroncok hroncok marked this pull request as draft November 27, 2025 13:16
@hroncok
Copy link
Contributor Author

hroncok commented Nov 27, 2025

So, I modified the behavior to keep removing the stencils with make clean but not run make clean during the PTO build. I think this is cleaner.

@hroncok hroncok marked this pull request as ready for review November 27, 2025 14:04
Copy link
Member

@efimov-mikhail efimov-mikhail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
I can confirm that issue with double generation of JIT stencils for PGO build is fixed.
And Makefile.pre.in changes looks clean for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants