Skip to content
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

Feat 568 triple chevron #592

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open

Conversation

ZelboK
Copy link
Contributor

@ZelboK ZelboK commented Oct 21, 2023

This ports triple_chevron_launch from thrust to CUB. As things stand it makes more sense to decouple the two. However, this PR does not touch the thrust repo. I can do that in this PR or in a follow up PR if it is desired. I thought it would be better to keep the PR smaller.

Currently all tests pass on my 3080 sm86 except for one, test_allocator.cu for util_allocator.cuh. However it is important to note that this happens on main as well, so it is likely irrelevant to my changes. If it matters, only line 130 of test_allocator.cu assertion fails. If that one is commented out, all tests pass.

Please pay attention to the differences in macros in triple_chevron_launch.cuh - I tried to follow what seemed to be idiomatic for CUB.

@ZelboK ZelboK requested review from a team as code owners October 21, 2023 21:32
@ZelboK ZelboK requested review from jarmak-nv, ericniebler and gevtushenko and removed request for a team October 21, 2023 21:32
@copy-pr-bot
Copy link

copy-pr-bot bot commented Oct 21, 2023

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@gevtushenko gevtushenko linked an issue Oct 23, 2023 that may be closed by this pull request
Copy link
Collaborator

@gevtushenko gevtushenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! There are a few minor comments below. Apart from that, not all of the #568 requests are addressed. First of all, Thrust implementation is still present (instead of relying on alias). Secondly, there's no test of triple chevron.

cub/cub/detail/triple_chevron_launch.cuh Outdated Show resolved Hide resolved
cub/cub/detail/triple_chevron_launch.cuh Outdated Show resolved Hide resolved
cub/cub/detail/triple_chevron_launch.cuh Outdated Show resolved Hide resolved
cub/cub/detail/triple_chevron_launch.cuh Outdated Show resolved Hide resolved
cub/cub/detail/triple_chevron_launch.cuh Outdated Show resolved Hide resolved
cub/cub/detail/triple_chevron_launch.cuh Outdated Show resolved Hide resolved
cub/cub/detail/triple_chevron_launch.cuh Outdated Show resolved Hide resolved
cub/cub/device/dispatch/dispatch_batch_memcpy.cuh Outdated Show resolved Hide resolved
cub/cub/detail/triple_chevron_launch.cuh Show resolved Hide resolved
@@ -42,8 +42,7 @@ _CCCL_IMPLICIT_SYSTEM_HEADER

#include <cub/device/dispatch/dispatch_batch_memcpy.cuh>

#include <thrust/system/cuda/detail/core/triple_chevron_launch.h>

#include <cub/detail/triple_chevron_launch.cuh>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: I don't think this include is needed by this header. Please, remove it.

ZelboK and others added 2 commits October 23, 2023 21:36
Co-authored-by: Georgy Evtushenko <evtushenko.georgy@gmail.com>
Co-authored-by: Georgy Evtushenko <evtushenko.georgy@gmail.com>
ZelboK and others added 15 commits October 23, 2023 21:36
Co-authored-by: Georgy Evtushenko <evtushenko.georgy@gmail.com>
Co-authored-by: Georgy Evtushenko <evtushenko.georgy@gmail.com>
Co-authored-by: Georgy Evtushenko <evtushenko.georgy@gmail.com>
Co-authored-by: Georgy Evtushenko <evtushenko.georgy@gmail.com>
Co-authored-by: Georgy Evtushenko <evtushenko.georgy@gmail.com>
Co-authored-by: Georgy Evtushenko <evtushenko.georgy@gmail.com>
@ZelboK ZelboK requested a review from a team as a code owner October 30, 2023 21:03
cub/test/catch2_test_triple_chevron.cu Outdated Show resolved Hide resolved
cudaMemcpy(&result, d_result, sizeof(double), cudaMemcpyDeviceToHost);

REQUIRE(result == 8.5f);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: please, add a new line at the end of the file

*out = a + b;
}

CUB_TEST("CDP wrapper works with custom invocables and cdp_launch, on both host and device", "[test][utils]")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: I don't think this test is related to testing utilities. I'd write something along the following lines:

Suggested change
CUB_TEST("CDP wrapper works with custom invocables and cdp_launch, on both host and device", "[test][utils]")
CUB_TEST("CDP wrapper works with custom invocables and cdp_launch, on both host and device", "[device][triple_chevron]")

cub/test/catch2_test_triple_chevron.cu Outdated Show resolved Hide resolved
}


struct cdp_chevron_invoker {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: I don't think this struct is required. You should be able to put everything from the invoke function inside the cdp_invocable::operator().

cub/test/catch2_test_triple_chevron.cu Outdated Show resolved Hide resolved
cub/test/catch2_test_triple_chevron.cu Outdated Show resolved Hide resolved
cub/test/catch2_test_triple_chevron.cu Outdated Show resolved Hide resolved
cub/test/catch2_test_triple_chevron.cu Outdated Show resolved Hide resolved

cudaMalloc(&d_result, sizeof(double));
auto chev = cub::detail::triple_chevron(1, 1);
chev.doit(add_kernel, 5, 3.5f, d_result);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: we have different logic for hots and device launch. I'd suggest using cdp helper here as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Port triple_chevron
3 participants