-
Notifications
You must be signed in to change notification settings - Fork 175
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
iterator_category_to_system
returns host_system_tag
for input_device_iterator_tag
instead of device_system_tag
#705
Comments
Uh... this seems like it might be bad. |
Got a local repro. Is this a regression? |
iterator_category_to_system
returns host_system_tag
for input_device_iterator_tag
instead of device_system_tag
Yah, this is not good, at all. I'm not sure the impact but this could potentially be causing parts of Thrust to dispatch to host execution instead of device execution. |
@jaredhoberock, any thoughts? |
Minimal test case below. @dawagnbr, thanks for the bug report - in the future please follow https://github.com/brycelelbach/cpp_bug_reporting_guidelines , it makes life a little easier for me.
|
Tracked internally by NVBug 2062266. |
Just ran across this issue while reviewing NVIDIA/thrust#1619. Put together another repro -- this affects all device iterators, not just input. Repro
Root CauseLooking into this, it's a bad specialization. Thrust's system-aware categories are implemented by inheriting
However, this specialization is never picked up, since
Using
the check for convertibility passes ( Possible solutionsIt may be as simple as changing the iterator categories to alias:
This would make the specializations on Alternatively, we could use SFINAE or some such to fix the Not sure which is better, we should explore this some more. |
Digging in some more, since I was curious how this manages to work for the common case of Both of these end up defining their
This ends up directly defining the iterator category to |
Hello,
I was trying to design my own iterators to make them compatible with thrust. I stumbled across some problems and dug inside the code. Ultimately, it seems that the following statement fails to compile:
static_assert(std::is_same<thrust::detail::iterator_category_to_systemthrust::input_device_iterator_tag::type, thrust::device_system_tag>::value, "test");
While the following passes:
static_assert(std::is_same<thrust::detail::iterator_category_to_systemthrust::input_device_iterator_tag::type, thrust::host_system_tag>::value, "test");
That is not really surprising given the code of iterator_category_to_system and the fact that input_device_iterator_tag actually inherits from std::input_iterator_tag, which is just another name for input_host_iterator_tag (see iterator_categories.h).
Am I missing something or there is a bug there?
Note that all classes inheriting from thrust::iterator_adapter seem to be fine. Still trying to figure out why.
The text was updated successfully, but these errors were encountered: