Visitar URL original
configure.ac: define a path for profile data by Mingli-Yu · Pull Request #21408 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20260222004216/https://github.com/python/cpython/pull/21408
Skip to content
/ cpython Public

Comments

configure.ac: define a path for profile data#21408

Closed
Mingli-Yu wants to merge 1 commit intopython:masterfrom
Mingli-Yu:master
Closed

configure.ac: define a path for profile data#21408
Mingli-Yu wants to merge 1 commit intopython:masterfrom
Mingli-Yu:master

Conversation

@Mingli-Yu
Copy link

@Mingli-Yu Mingli-Yu commented Jul 9, 2020 •

There comes below error when use ccache 3.7.10 to compile python3
and check [1] for more details.
| Python-3.8.3/Modules/_contextvarsmodule.c:43:1: error: source locations for function 'PyInit__contextvars' have changed, the profile data may be out of date [-Werror=coverage-mismatch]

That's because the logic for profile directory changes a little in
[2] after ccache upgrades to 3.7.10 and it errors out if no profile
data found per [2] and [3].

So define a profile directory path accordingly to fix the above error.

[1] ccache/ccache#615
[2] ccache/ccache@c9fdcef
[3] ccache/ccache@91a2954

Signed-off-by: Mingli Yu mingli.yu@windriver.com

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

Recognized GitHub username

We couldn't find a bugs.python.org (b.p.o) account corresponding to the following GitHub usernames:

@Mingli-Yu

This might be simply due to a missing "GitHub Name" entry in one's b.p.o account settings. This is necessary for legal reasons before we can look at this contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@jrosdahl
Copy link
Contributor

jrosdahl commented Jul 14, 2020 •

(ccache maintainer here.)

That's because the logic for profile directory changes a little in
[2] after ccache upgrades to 3.7.10.

The [2] reference is misleading since ccache/ccache@91a2954 was first included in ccache 3.2 some six years ago, not in 3.7.10. Also, the problem you see is not due to a deliberate logic change but a bug.

So define a profile directory path accordingly to fix the above error.

I guess that it wouldn't hurt to set an explicit profile directory path, but regardless of whether this is done the ccache bug should be fixed.

@Mingli-Yu: As you might have seen in ccache/ccache#615 I have not been able to reproduce the problem so I can't really debug or fix it. But since you can reproduce it perhaps you could help out by describing in ccache/ccache#615 how to do it? That would be much appreciated.

@Mingli-Yu
Copy link
Author

Mingli-Yu commented Jul 15, 2020 •

(ccache maintainer here.)

That's because the logic for profile directory changes a little in
[2] after ccache upgrades to 3.7.10.

The [2] reference is misleading since ccache/ccache@91a2954 was first included in ccache 3.2 some six years ago, not in 3.7.10. Also, the problem you see is not due to a deliberate logic change but a bug.

Actually, ccache/ccache@91a2954 altogether with ccache/ccache@c9fdcef makes the error out if no profiling data file found.

So define a profile directory path accordingly to fix the above error.

I guess that it wouldn't hurt to set an explicit profile directory path, but regardless of whether this is done the ccache bug should be fixed.

@Mingli-Yu: As you might have seen in ccache/ccache#615 I have not been able to reproduce the problem so I can't really debug or fix it. But since you can reproduce it perhaps you could help out by describing in ccache/ccache#615 how to do it? That would be much appreciated.

As my understanding, ccache/ccache#615 can be closed now as we need to do the fix for python3(this Pull request is just the fix we need for python3) after ccache upgrade to 3.7.10.

There comes below error when use ccache 3.7.10 to compile python3
and check [1] for more details.
 | Python-3.8.3/Modules/_contextvarsmodule.c:43:1: error: source locations for function 'PyInit__contextvars' have changed, the profile data may be out of date [-Werror=coverage-mismatch]

That's because the logic for profile directory changes a little in
[2] after ccache upgrades to 3.7.10 and it errors out if no profile
data found per [2] and [3].

So define a profile directory path accordingly to fix the above error.

[1] ccache/ccache#615
[2] ccache/ccache@c9fdcef
[3] ccache/ccache@91a2954

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
@jrosdahl
Copy link
Contributor

jrosdahl commented Jul 15, 2020 •

Actually, ccache/ccache@91a2954 altogether with ccache/ccache@c9fdcef makes the error out if no profiling data file found.

I still think that it's misleading. The bug was introduced in ccache 3.7.10 so I don't see why ccache/ccache@91a2954 would be relevant.

As my understanding, ccache/ccache#615 can be closed now as we need to do the fix for python3(this Pull request is just the fix we need for python3) after ccache upgrade to 3.7.10.

Option 1: Fix thousands of projects (there can of course be other projects than Python that are affected as well) and branches to work around a bug in ccache. Option 2: Help the ccache maintainer to reproduce the bug so that it can be fixed. Then a new ccache version can be released as soon as possible and ccache 3.7.10 can be forgotten about. I vote for option 2. 🙂 Please help me reproduce the problem instead of working on an unnecessary workaround in Python.

@Mingli-Yu
Copy link
Author

Mingli-Yu commented Jul 16, 2020 •

Actually, ccache/ccache@91a2954 altogether with ccache/ccache@c9fdcef makes the error out if no profiling data file found.

I still think that it's misleading. The bug was introduced in ccache 3.7.10 so I don't see why ccache/ccache@91a2954 would be relevant.

As my understanding, ccache/ccache#615 can be closed now as we need to do the fix for python3(this Pull request is just the fix we need for python3) after ccache upgrade to 3.7.10.

Option 1: Fix thousands of projects (it's of course not only Python that is affected) and branches to work around a bug in ccache. Option 2: Help the ccache maintainer to reproduce the bug so that it can be fixed. Then a new ccache version can be released as soon as possible and ccache 3.7.10 can be forgotten about. I vote for option 2. slightly_smiling_face Please help me reproduce the problem instead of working on an unnecessary workaround in Python.

The reason why I think we should fix python3 is because currently python3 uses below logic during build.
-fprofile-generate
-fprofile-use -fprofile-correction

With this pull request, we just pass a path to the fprofile-generate and fprofile-use as below.
-fprofile-generate=$(pwd)
-fprofile-use=$(pwd) -fprofile-correction

Do you think we can still not pass the path to fprofile-generate and fprofile-use?

BTW, please follow my steps to reproduce the issue:
1, mkdir -p /build/yocto/build
2, cd /build/yocto
3, git clone git://git.yoctoproject.org/poky
4, cd poky
5, git revert 9e856a0a1a76bc4ba5fa050be038dd702cc58185
Note: the step 5 used to remove my fix
6, sed -i 's:INHERIT += "reproducible_build":#INHERIT += "reproducible_build":' ./meta-poky/conf/distro/poky.conf
Note: the step 6 just used to enable profile guided optimizations (PGO) for python3
7, . oe-init-build-env ../build/poky-build
8, echo "INHERIT += "ccache"" >> conf/local.conf
echo "CCACHE_DIR = "${TMPDIR}/ccache/${MULTIMACH_TARGET_SYS}/${PN}"" >> conf/local.conf
Note: the step 8 is used to enable ccache
9, bitbake python3
After the step 9 finish, check the compile log tmp/work/core2-64-poky-linux/python3/3.8.3-r0/temp/log.do_compile for details.

@jrosdahl
Copy link
Contributor

Do you think we can still not pass the path to fprofile-generate and fprofile-use?

Sure, that can be done. But since -fprofile-{generate,use} and -fprofile-{generate,use}=$(pwd) have identical semantics and mean the same thing to the compiler, it just seems a bit strange to me to add such a workaround when the actual bug is elsewhere.

BTW, please follow my steps to reproduce the issue:

Thanks! I'll follow up in ccache/ccache#615.

@Mingli-Yu
Copy link
Author

The issue already has been fixed by ccache as ccache/ccache@58895dc, so no need to define a path for profile data for python3 any more.

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.

4 participants