-
Notifications
You must be signed in to change notification settings - Fork 428
[CUB] Fix DeviceAdjacentDifference for cuda::device_buffer iterators #9861
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
1b058db
facc0d5
7aed3a4
8c1fa4f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,6 +5,7 @@ | |||||||||||||||
|
|
||||||||||||||||
| #include <cub/device/device_adjacent_difference.cuh> | ||||||||||||||||
|
|
||||||||||||||||
| #include <cuda/buffer> | ||||||||||||||||
| #include <cuda/devices> | ||||||||||||||||
| #include <cuda/iterator> | ||||||||||||||||
| #include <cuda/std/execution> | ||||||||||||||||
|
|
@@ -258,6 +259,35 @@ C2H_TEST("DeviceAdjacentDifference::SubtractLeftCopy works with user provided me | |||||||||||||||
| test_subtract_left_copy(policy); | ||||||||||||||||
| } | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| C2H_TEST("DeviceAdjacentDifference::SubtractLeftCopy accepts cuda::device_buffer input", | ||||||||||||||||
| "[adjacent_difference][device]") | ||||||||||||||||
| { | ||||||||||||||||
| using type = std::int32_t; | ||||||||||||||||
|
|
||||||||||||||||
| cuda::stream stream{cuda::devices[0]}; | ||||||||||||||||
| auto input = cuda::make_device_buffer<type>(stream, cuda::devices[0], {2, 5, 9, 14, 20}); | ||||||||||||||||
| c2h::device_vector<type> output(input.size(), thrust::no_init); | ||||||||||||||||
| auto output_it = thrust::raw_pointer_cast(output.data()); | ||||||||||||||||
|
|
||||||||||||||||
| void* temporary_storage = nullptr; | ||||||||||||||||
| std::size_t temporary_bytes = 0; | ||||||||||||||||
| REQUIRE( | ||||||||||||||||
| cudaSuccess | ||||||||||||||||
| == cub::DeviceAdjacentDifference::SubtractLeftCopy( | ||||||||||||||||
| temporary_storage, temporary_bytes, input.begin(), output_it, input.size(), cuda::std::minus<>{}, stream.get())); | ||||||||||||||||
|
|
||||||||||||||||
| c2h::device_vector<std::uint8_t> temporary_buffer(temporary_bytes, thrust::no_init); | ||||||||||||||||
| temporary_storage = thrust::raw_pointer_cast(temporary_buffer.data()); | ||||||||||||||||
| REQUIRE( | ||||||||||||||||
| cudaSuccess | ||||||||||||||||
| == cub::DeviceAdjacentDifference::SubtractLeftCopy( | ||||||||||||||||
| temporary_storage, temporary_bytes, input.begin(), output_it, input.size(), cuda::std::minus<>{}, stream.get())); | ||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Important: Just use the launch wrapper
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated the regression test to use The focused target build, regression test, and targeted pre-commit checks pass locally. |
||||||||||||||||
| stream.sync(); | ||||||||||||||||
|
|
||||||||||||||||
| const c2h::host_vector<type> expected{2, 3, 4, 5, 6}; | ||||||||||||||||
| REQUIRE(output == expected); | ||||||||||||||||
|
Comment on lines
+274
to
+276
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Important: I think we do not to sync when we use a custom stream:
Suggested change
|
||||||||||||||||
| } | ||||||||||||||||
| #endif // TEST_LAUNCH == 0 | ||||||||||||||||
|
|
||||||||||||||||
| C2H_TEST("DeviceAdjacentDifference::SubtractLeftCopy works with iterators", "[device][adjacent_difference]", types) | ||||||||||||||||
|
|
||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.