Skip to content

[hipCUB][Code Coverage] Increase Code Coverage for hipCUB#172

Closed
NguyenNhuDi wants to merge 5 commits into
ROCm:release-staging/rocm-rel-7.0from
NguyenNhuDi:zenguyen-hipcub/increase-code-coverage-rs-7.0
Closed

[hipCUB][Code Coverage] Increase Code Coverage for hipCUB#172
NguyenNhuDi wants to merge 5 commits into
ROCm:release-staging/rocm-rel-7.0from
NguyenNhuDi:zenguyen-hipcub/increase-code-coverage-rs-7.0

Conversation

@NguyenNhuDi
Copy link
Copy Markdown
Contributor

This PR is opened for the purpose of merging into the release staging branch.
This PR should not be merged until PR #171 is merged. This is because the additional unit tests found that a function in hipCUB was making a wrong backend call and this will cause the unit tests to fail during compilation.

Copy link
Copy Markdown
Contributor

@umfranzw umfranzw left a comment

Choose a reason for hiding this comment

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

Nice work - it's great to have more test coverage. I just have a few questions and comments on a few things.

{
const size_t offset = bi * items_per_block;
const size_t i0 = offset + ti * items_per_thread + ii;
const size_t i1 = offset + host_ranks[i0] % block_size * items_per_thread
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I have a feeling I'm not understanding this correctly, but I just wanted to double-check. On line 907, host_ranks[i0] will be -1 in some cases (set by the loop on line 893). I believe that in this case we don't want to set host_expected (since it was already set to 0 in the loop above) - is that right?. If so, don't we need to check (on line 909) if host_ranks[i0] is -1, and if so, avoid setting host_expected?

0,
0,
device_input);
HIP_CHECK(hipPeekAtLastError());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just a note that as of HIP 7.0, the error returned by this function might not be from the kernel launch above - it could be from any HIP API call executed before this (eg. a kernel launch in a previous test). If you need to be certain that the error is from the kernel call above, you can add a call to hipGetLastError() before the call to hipLaunchKernelGGL. This will clear the internally recorded HIP error. It might also be good to use hipGetLastError on line 1155 (in place of hipPeekAtLastError), so that (because it clears the internally recorded error) any error that occurs won't affect following tests.

There are a number of other hipPeekAtLastError calls in tests in this PR that might also benefit from this kind of change.

Comment thread projects/hipcub/test/hipcub/test_hipcub_block_merge_sort.cpp
Comment thread projects/hipcub/test/hipcub/test_hipcub_block_radix_rank.cpp Outdated
Comment thread projects/hipcub/test/hipcub/test_hipcub_block_radix_rank.cpp Outdated
Comment thread projects/hipcub/test/hipcub/test_hipcub_block_radix_rank.cpp Outdated
HIP_CHECK(
hipMemcpy(device_input, input.data(), input.size() * sizeof(type), hipMemcpyHostToDevice));

HIP_CHECK(hipPeekAtLastError());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we change lines 170 and 182 from hipPeekAtLastError to hipGetLastError? That way the internally recorded error will be cleared before and after the kernel call.

@NguyenNhuDi
Copy link
Copy Markdown
Contributor Author

Clsoing this PR to make a new one to rebase to develop. New PR here: #411

NguyenNhuDi added a commit that referenced this pull request Jul 16, 2025
Re making PR #172 to merge to develop instead of release-staging
NguyenNhuDi added a commit to NguyenNhuDi/rocm-libraries that referenced this pull request Jul 18, 2025
Re making PR ROCm#172 to merge to develop instead of release-staging
shahamed pushed a commit that referenced this pull request Jul 19, 2025
Re making PR #172 to merge to develop instead of release-staging
NguyenNhuDi added a commit that referenced this pull request Aug 1, 2025
Re making PR #172 to merge to develop instead of release-staging
ammallya pushed a commit that referenced this pull request Sep 24, 2025
Co-authored-by: BrianHarrisonAMD <169072757+BrianHarrisonAMD@users.noreply.github.com>
ammallya pushed a commit that referenced this pull request Sep 24, 2025
Co-authored-by: BrianHarrisonAMD <169072757+BrianHarrisonAMD@users.noreply.github.com>

[ROCm/hipDNN commit: 5c67ec1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants