-
Notifications
You must be signed in to change notification settings - Fork 153
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]: Seg fault when passing data pointer to thrust::sort
#2606
Comments
When you pass an iterator range to a thrust call without an execution policy, it attempts to deduce the correct execution policy based on the type of the input iterator. In the first example:
This works because When a raw pointer is passed in, Thrust can't infer from the type which execution policy to use and defaults to host. So that's why you get a segfault. Personally, I always recommend being explicit and passing in an execution policy and not relying on the inferred dispatch to avoid surprises like this. |
Can this be turned into a compile-time error? |
That's aligned with my assumption as well but I'm not sure why it's working on some GPUs like V100 and A100 but not for RTX8000.
Makes sense. |
We could, but it would make passing any raw pointers into a thrust algorithm without an execution policy into a compile error which would likely break plenty of existing working code. |
As a library developer, hitting a segfault at run time is the 2nd worst kind of errors (the first is silent data corruption/incorrect result). I would much rather I hit this myself at compile time so that I can fix it all for my users. Just my 2c. |
Is this a duplicate?
Type of Bug
Runtime Error
Component
Thrust
Describe the bug
cuda-gdb log:
The code above will cause a segmentation fault when running on an RTX8000 (sm75), but the same issue doesn't occur on a V100.
How to Reproduce
https://godbolt.org/z/rxjYrWj1E
Uncovered this issue when working on NVIDIA/cuCollections#623 (comment)
cuco
usesrapids-cmake
to fetch a specific commit of CCCL: e21d607 but the error seems to be consistent with the trunk (see godbolt link)Expected behavior
The code should run without seg fault.
The text was updated successfully, but these errors were encountered: