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

Cherry-pick: Optimize block_reduce_warp_reduce when block size is the same as warp size #599

Conversation

stanleytsang-amd
Copy link
Collaborator

For a block reduce that utilizes warp reductions for the first stage, generally a final reduction is required across all warps to get the final reduction result for the entire block. In the corner case where there is only one warp per block however, that final reduction isn't required as all threads have the final result already from the warp reduction (the final operation of the warp reduction is each lane in the warp reads the result from the last lane of the logical warp, which has the reduction result.)

A customer benchmark has revealed that not doing the final reduction for this very specific case can increase kernel performance by up to 15-30%.

One could argue that the user should just call warp_reduce instead when block size == warp size. However there may be limitations which prevent that from happening.

@stanleytsang-amd stanleytsang-amd changed the title Cherry-pick: Optimize block_reduce_warp_reduce when block size is the same warp size Cherry-pick: Optimize block_reduce_warp_reduce when block size is the same as warp size Aug 22, 2024
@stanleytsang-amd stanleytsang-amd merged commit 93501cf into ROCm:release/rocm-rel-6.2 Aug 27, 2024
22 checks passed
stanleytsang-amd added a commit that referenced this pull request Sep 17, 2024
* Update dependency names for static builds (#557)

This also removes the line setting `BUILD_SHARED_LIBS` to `ON`, which was previously required to get the correctly named packages when not specifically compiling for a static build. Updates to the ROCmCMakeBuildTools (rocm-cmake) should mean this is no longer necessary.

* Fix BUILD_SHARED_LIBS for packaging (#558)

* Fix the dependencies of the static packages (#563)

* cmake: don't set CMAKE_C_COMPILER, as rocPRIM is a CXX project (#567)

* add developer guidelines (#555) (#574)

Co-authored-by: Nol Moonen <nol@streamhpc.com>

* Update Read the Docs config to Python 3.10 and latest rocm-docs-core (#564) (#579)

* Cherry-pick: Optimize block_reduce_warp_reduce when block size is the same as warp size (#599)

* Optimize block_reduce_warp_reduce when block size == warp size

* Make conditional constexpr

* Fix conflict in concepts.rst

---------

Co-authored-by: Lauren Wrubleski <Lauren.Wrubleski@amd.com>
Co-authored-by: Steve Leung <Steve.Leung@amd.com>
Co-authored-by: randyh62 <42045079+randyh62@users.noreply.github.com>
Co-authored-by: Nol Moonen <nol@streamhpc.com>
Co-authored-by: Sam Wu <22262939+samjwu@users.noreply.github.com>
stanleytsang-amd added a commit to stanleytsang-amd/rocPRIM that referenced this pull request Oct 10, 2024
* Update dependency names for static builds (ROCm#557)

This also removes the line setting `BUILD_SHARED_LIBS` to `ON`, which was previously required to get the correctly named packages when not specifically compiling for a static build. Updates to the ROCmCMakeBuildTools (rocm-cmake) should mean this is no longer necessary.

* Fix BUILD_SHARED_LIBS for packaging (ROCm#558)

* Fix the dependencies of the static packages (ROCm#563)

* cmake: don't set CMAKE_C_COMPILER, as rocPRIM is a CXX project (ROCm#567)

* add developer guidelines (ROCm#555) (ROCm#574)

Co-authored-by: Nol Moonen <nol@streamhpc.com>

* Update Read the Docs config to Python 3.10 and latest rocm-docs-core (ROCm#564) (ROCm#579)

* Cherry-pick: Optimize block_reduce_warp_reduce when block size is the same as warp size (ROCm#599)

* Optimize block_reduce_warp_reduce when block size == warp size

* Make conditional constexpr

* Fix conflict in concepts.rst

---------

Co-authored-by: Lauren Wrubleski <Lauren.Wrubleski@amd.com>
Co-authored-by: Steve Leung <Steve.Leung@amd.com>
Co-authored-by: randyh62 <42045079+randyh62@users.noreply.github.com>
Co-authored-by: Nol Moonen <nol@streamhpc.com>
Co-authored-by: Sam Wu <22262939+samjwu@users.noreply.github.com>
stanleytsang-amd added a commit that referenced this pull request Oct 11, 2024
* Update dependency names for static builds (#557)

This also removes the line setting `BUILD_SHARED_LIBS` to `ON`, which was previously required to get the correctly named packages when not specifically compiling for a static build. Updates to the ROCmCMakeBuildTools (rocm-cmake) should mean this is no longer necessary.

* Fix BUILD_SHARED_LIBS for packaging (#558)

* Fix the dependencies of the static packages (#563)

* cmake: don't set CMAKE_C_COMPILER, as rocPRIM is a CXX project (#567)

* add developer guidelines (#555) (#574)



* Update Read the Docs config to Python 3.10 and latest rocm-docs-core (#564) (#579)

* Cherry-pick: Optimize block_reduce_warp_reduce when block size is the same as warp size (#599)

* Optimize block_reduce_warp_reduce when block size == warp size

* Make conditional constexpr

* Fix conflict in concepts.rst

---------

Co-authored-by: Lauren Wrubleski <Lauren.Wrubleski@amd.com>
Co-authored-by: Steve Leung <Steve.Leung@amd.com>
Co-authored-by: randyh62 <42045079+randyh62@users.noreply.github.com>
Co-authored-by: Nol Moonen <nol@streamhpc.com>
Co-authored-by: Sam Wu <22262939+samjwu@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants