-
Notifications
You must be signed in to change notification settings - Fork 135
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
[BUG]: Latest CCCL breaks CuPy #2109
Comments
To unblock myself I've force-pushed back to the snapshot from yesterday, but starting from this commit cupy/cupy@08e6a3c it should be reproducible. By tracing the code change following the compiler error, I believe the culprit is #1872, in particular #1872 (review) (cc: @bernhardmgruber for vis). |
@leofang thank you for reporting this and I am sorry for the breakage! The specializations of Thrust's API that cupy performs looks quite extraordinary to me (I actually had to educate myself on the syntax) and I would like to suggest a better way. In your current implementation, you specialize a member of bool thrust::less<float>::operator() (
const float& lhs, const float& rhs) const {
return _real_less<float>(lhs, rhs);
} which relies on template <>
struct thrust::less<float> {
bool operator() (float lhs, float rhs) const {
return _real_less<float>(lhs, rhs);
}
}; This is arguably safer and will also be forward compatible when we eventually alias As a general remark: I think redefining the meaning of |
Hi Bernhard, thanks for your reply.
To me this change of behavior requires a deprecation cycle, though I do have a hard time to see where compile-time warnings can be injected for this particular case.
Is this expectation documented anywhere? Would it be a concern if the comparator fulfills this "less than" property? To give some context, CuPy had to define a custom comparator in order to follow NumPy behavior, where NaNs are sorted to the end of an array (see code comments here). An extra note: we cannot keep breaking critical users like CuPy just casually (#1494). I've been following @jrhemstad's advertisement and encouraging the CuPy team to stay at CCCL head, but my push would be questionable if they keep hitting maintenance issues. |
It does not. The CuPy code is incorrect in how it provides a custom comparison operator. The proper way to provide a custom comparison operator is to pass one as an argument, not reach into internal bits of the library and modify them at will. This is covered under our compatibility guidelines: https://github.com/NVIDIA/cccl?tab=readme-ov-file#compatibility-guidelines
I'll grant that this could be improved to say "Do not add any declarations or template specializations...", but the point remains the same. All that said, we don't like breaking people (even when it wasn't our fault), so we will be helping to contribute a fix to CuPy. I look forward to when you have the time to help us set up #1494! |
PR for CuPi: cupy/cupy#8446 |
I had a somewhat lengthy discussion with Jake offline. Below is a summary of what I asked regarding specializing At one point we were even encouraged to specialize a CUB internal template (in the context of 64-bit support), so you must forgive CuPy developers to have the impression that everything template is customizable at will. Perhaps let me ask this way: Why is specializing |
The standard practice in C++ is that you should not specialize a template that does not belong to you unless you've been explicitly granted permission to do so. Everyone is at a different place with their experience and expertise in C++, so it's not unreasonable that someone may not be familiar with this yet. Being given permission to specialize one template in one library does not grant permission to specialize another template in a different library 😅 .
I explained in cupy/cupy#8446 (comment) that I don't think either specialization is correct. I think @bernhardmgruber was trying to be courteous and do the minimal possible set of changes to unblock cupy, but ultimately, the specialization is still ill-formed. The good news is that it's very easy to fix by just using a custom comparator type instead of using |
Is this a duplicate?
Type of Bug
Compile-time Error
Component
Thrust
Describe the bug
CCCL diff (between yesterday and today): cupy/cccl@2246a87...d4f928e
Yesterday it built fine. Today we see this (from https://ci.preferred.jp/cupy.linux.cuda-build/166014/):
How to Reproduce
Build cupy/cupy#8412 from source
Expected behavior
No compile-time errors.
Reproduction link
No response
Operating System
No response
nvidia-smi output
No response
NVCC version
No response
The text was updated successfully, but these errors were encountered: