-
Notifications
You must be signed in to change notification settings - Fork 447
Support future value for initial value for device scan #305
Conversation
I think this idea is very useful, and could actually be more general than just
@jrhemstad @brycelelbach @griwes @dkolsen-pgi @dumerrill @canonizer -- Any thoughts on this? Alternative names, possible issues, etc? There's some more context in #294. |
I think it can be even more general than just "a future on stream order wrapping a device pointer". We can make it a lazy value, something like: InitialValue *ptr = ....;
cub::LazyValue<InitialValue>([=]() __device__ { return *ptr; }); or even int *semaphore = ...;
InitialValue *ptr = ....;
cub::LazyValue<InitialValue>(
[=]() __device__ {
while (*semaphore < 1) __nanosleep(8);
return *ptr;
}
); |
Would it make sense to just take a single-item input iterator type? I would consider that the most flexible: it would allow you to also wrap it in a As for the changes, one could do something like this:
Now, (2) could wrap the |
@elstehle Is there a reliable way to test if an object is an iterator? Your suggestion sounds like a good design, but it might be tricky to implement. Also, I don't have a strong preference on how the method should be called, and how it should behave. The design suggestion from @allisonvacanti and @elstehle both look good to me. I am OK with whichever decision we made. But I do hope we don't spend too much time making decisions so that I can start using this feature early. |
Unfortunately my time is very limited right now, so it may be a little while before I can spend too many cycles on this. The good news is that I'm getting some more help working on CUB, so I should have more time for this sort of stuff in the near future. I'll keep this on my radar, but feel free to remind me if we don't address it in the next couple of weeks. I do see this as an important usecase, but I want to make sure we get it right. |
I was thinking about this some more over the weekend. I think we can get this into 1.14 -- here's what I'd like to see:
The wrapper in the last point could be as simple as:
This would be passed from the I think this would address my concerns about this feature. We can start with reduce or scan to work out any issues before porting the other algorithms in case there are surprises. Does this sound reasonable? |
Just realized I'd neglected @elstehle suggestion for a more general iterator in the above. That complicates the implementation, but should be doable.
We would incur extra instantiation penalties for I'm leaning toward using the |
Hi @allisonvacanti, sorry for the late reply. This design looks good to me, I will ask if I have further questions. What is the timeline for 1.14 and 1.15? I am recently busy and I will schedule myself to try to catch the deadline of accepting PRs of 1.14 or 1.15 for this. |
@zasdfgbnm The milestones are tracked here: https://github.com/NVIDIA/cub/milestones. Currently 1.14 features need to be merged by 8/18, and 1.15 should be complete by 10/18. Are you planning to handle the implementation for this? |
@allisonvacanti Yes, I will. But I am not sure if it will be 1.14 or 1.15. |
Sounds good, I'll leave the milestone blank for now. Thanks! |
Please see NVIDIA/thrust#1519 for thrust change. |
@allisonvacanti This should be ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! I pointed out some minor issues in comments, but I'm very happy with how this is turning out :)
@jrhemstad @elstehle @senior-zero What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@allisonvacanti I have resolved all your review comments.
DVS CL: 30512893 |
0265794
to
5f61556
Compare
DVS CL: 30535270 |
Update for `cub::FutureValue` PR (NVIDIA/cub#305)
…66711) Summary: NVIDIA/cub#305 has landed to cub 1.15. This is ready to review and land. This PR contains #66219, please land that PR first before review. Pull Request resolved: #66711 Reviewed By: soulitzer Differential Revision: D32698306 Pulled By: ngimel fbshipit-source-id: 4cc6b9b24cefd8932f4d421c6d64ea20ea911f52
Prototyping the support of device pointer for cub device scan.
Example Usage:
Tests pass for this PR, but there is no documentation yet. I will add doc if @allisonvacanti thinks this is a good idea.
Please review NVIDIA/thrust#1519 for thrust change.