-
-
Notifications
You must be signed in to change notification settings - Fork 25.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GCC 14: Remove inline
for rdist_csr
and rdist
#28541
Conversation
This is related with cython/cython#2747 This problem was mentioned in a bug open to keep track of the effort to remove all compilation warnings scikit-learn#24875 (search "Incompatible pointers types casts") With gcc < 14 the code compiles with incompatible-pointer warning. But with gcc 14 that warning is an error. Fedora bug: https://bugzilla.redhat.com/show_bug.cgi?id=2261602 A posible workaround is to remove the inline in the definition of the rdist_csr and rdistmembers. With that change, cython generates correct code (I don't know why). But removing the inline can impact the performance. Fixes scikit-learn#28530 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
Testing with podman + Fedora Rawhide:
|
git clean -xdf git submodule sync git submodule update --init tar zcvf ../python-scikit-learn_1.3.2.orig.tar.gz --exclude=.git . debuild -uc -us cp python-scikit-learn.spec ../python-scikit-learn_1.3.2-1.spec cp ../python*-scikit-learn*1.3.2*.{gz,xz,spec,dsc} /osc/home\:alvistack/scikit-learn-scikit-learn-1.3.2/ rm -rf ../python*-scikit-learn*1.3.2*.* ../python*-sklearn*1.3.2*.* See scikit-learn#28541 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync git submodule update --init tar zcvf ../python-scikit-learn_1.3.2.orig.tar.gz --exclude=.git . debuild -uc -us cp python-scikit-learn.spec ../python-scikit-learn_1.3.2-1.spec cp ../python*-scikit-learn*1.3.2*.{gz,xz,spec,dsc} /osc/home\:alvistack/scikit-learn-scikit-learn-1.3.2/ rm -rf ../python*-scikit-learn*1.3.2*.* ../python*-sklearn*1.3.2*.* See scikit-learn#28541 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync git submodule update --init tar zcvf ../python-scikit-learn_1.4.0.orig.tar.gz --exclude=.git . debuild -uc -us cp python-scikit-learn.spec ../python-scikit-learn_1.4.0-1.spec cp ../python*-scikit-learn*1.4.0*.{gz,xz,spec,dsc} /osc/home\:alvistack/scikit-learn-scikit-learn-1.4.0/ rm -rf ../python*-scikit-learn*1.4.0*.* ../python*-sklearn*1.4.0*.* See scikit-learn#28541 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync git submodule update --init tar zcvf ../python-scikit-learn_1.4.1.post1.orig.tar.gz --exclude=.git . debuild -uc -us cp python-scikit-learn.spec ../python-scikit-learn_1.4.1.post1-1.spec cp ../python*-scikit-learn*1.4.1.post1*.{gz,xz,spec,dsc} /osc/home\:alvistack/scikit-learn-scikit-learn-1.4.1.post1/ rm -rf ../python*-scikit-learn*1.4.1.post1*.* ../python*-sklearn*1.4.1.post1*.* See scikit-learn#28541 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
I would run benchmarks from I do not have time to have a look at that for now. :/ |
Indeed, we should pay some additional overhead. Since this is impacting the |
Another solution would be to have the presence of I think we should only consider this second solution if the present one causes regressions. |
I'm not sure about all compilers (and all versions of them) but some compilers will consider any function, with or without So I think it is possible that we find that removing the |
If cython/cython#6039 is merged and a new version of Cython released, then we may skip this PR. |
From a quick look at the PR and the discussion that lead to it: it seems like this just suppresses the warning? Is that right? I tried to find out more about the warning and why gcc warns you about this. But didn't find out much :( My question is: is this warning a false positive for scikit-learn's code or is it a true positive? If the latter, shouldn't we fix the source of the warning instead of turning off the warning? The "fix instead of suppress" attitude comes from the fact that usually gcc has a good reason to warn about something, even if it is annoying ;) |
We can fix the problem in scikit-learn with this PR, but to me the issue is Cython's. I do not know sufficiently about Cython to be able to tell if the original problem is addressable or not to properly choose a solution. What do you think? |
I cannot run the tests suite because Cython fails to compile scikit-learn for other reasons. Here are the changes which I think need to be made to diff --git i/asv.conf.json w/asv.conf.json
index e647afb..1469459 100644
--- i/asv.conf.json
+++ w/asv.conf.json
@@ -11,7 +11,7 @@
// The URL or local path of the source code repository for the
// project being benchmarked
- "repo": "https://github.com/scikit-learn/scikit-learn.git",
+ "repo": "https://github.com/alvistack/scikit-learn-scikit-learn.git",
// The Python project's subdirectory in your repo. If missing or
// the empty string, the project is assumed to be located at the root
diff --git i/benchmarks/pairwise_distances_reductions.py w/benchmarks/pairwise_distances_reductions.py
index 62b952c..7b63433 100644
--- i/benchmarks/pairwise_distances_reductions.py
+++ w/benchmarks/pairwise_distances_reductions.py
@@ -23,12 +23,12 @@ class PairwiseDistancesReductionsBenchmark(Benchmark):
"X_test",
]
params = [
- [1000, 10_000, int(1e7)],
- [1000, 10_000, 100_000],
- [100],
- ["euclidean", "manhattan"],
- ["auto", "parallel_on_X", "parallel_on_Y"],
- [np.float32, np.float64],
+ [1000, 10_000],
+ [10_000, 100_000],
+ [10],
+ ["manhattan"],
+ ["auto"],
+ [np.float32],
["dense", "csr"],
["dense", "csr"],
] and then one can run: asv continuous main main-gcc14 |
@da-woods Could you help out here? (In the past you did quite many times!) |
The warning's a "false" positive (i.e. it isn't hiding any real bugs in this case, but the C compiler is right to warn). So I wouldn't be worried about just suppressing it.
Yes - this is right. I think the plan is to get the warning at least suppressed in the next Cython release (which I think will probably be today or tomorrow). If I were you I'd just wait for that unless you're in a huge rush. It is something that Cython should follow up and fix properly in the future though. |
@da-woods Thank you so much. |
I believe we don't need this PR anymore with Cython 3.0.9 as said here: So let me close. We can reopen if I am wrong. |
Reference Issues/PRs
Fixes #28530
Relates to cython/cython#2747
Fedora bug: https://bugzilla.redhat.com/show_bug.cgi?id=2261602
What does this implement/fix? Explain your changes.
This problem was mentioned in a bug open to keep track of the effort to remove all compilation warnings #24875 (search "Incompatible pointers types casts")
With gcc < 14 the code compiles with incompatible-pointer warning. But with gcc 14 that warning is an error.
A possible workaround is to remove the inline in the definition of the
rdist_csr
andrdist
members.With that change, cython generates correct code (I don't know why). But removing the inline can impact the performance.
Any other comments?