[UR][HIP] Implement urKernelSuggestMaxCooperativeGroupCount#22667
Open
zjin-lcf wants to merge 1 commit into
Open
[UR][HIP] Implement urKernelSuggestMaxCooperativeGroupCount#22667zjin-lcf wants to merge 1 commit into
zjin-lcf wants to merge 1 commit into
Conversation
Implement the cooperative-group-count occupancy query for the HIP (AMD) adapter, which previously returned UR_RESULT_ERROR_UNSUPPORTED_FEATURE and forced the SYCL runtime onto a coarse 0/1 host-side fallback for kernel::ext_oneapi_get_info<max_num_work_groups>. As noted in intel#21803, a direct port of the CUDA implementation does not work: hipOccupancyMaxActiveBlocksPerMultiprocessor expects a host function pointer, whereas our kernel handle (hKernel->get()) is a module-loaded hipFunction_t. Use the module-occupancy entry point hipModuleOccupancyMaxActiveBlocksPerMultiprocessor instead, mirroring the existing hipModuleOccupancyMaxPotentialBlockSize usage in the adapter. The total suggested group count is the per-CU occupancy multiplied by the device multiprocessor (compute-unit) count. When the per-CU occupancy is 0, fall back to reporting 1 group if the requested work-group size, dynamic local memory, and per-block register usage all fit within device limits, matching the CUDA adapter's semantics. Closes: intel#21803 Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement the cooperative-group-count occupancy query for the HIP (AMD) adapter, which previously returned UR_RESULT_ERROR_UNSUPPORTED_FEATURE and forced the SYCL runtime onto a coarse 0/1 host-side fallback for kernel::ext_oneapi_get_info<max_num_work_groups>.
As noted in #21803, a direct port of the CUDA implementation does not work: hipOccupancyMaxActiveBlocksPerMultiprocessor expects a host function pointer, whereas our kernel handle (hKernel->get()) is a module-loaded hipFunction_t. Use the module-occupancy entry point hipModuleOccupancyMaxActiveBlocksPerMultiprocessor instead, mirroring the existing hipModuleOccupancyMaxPotentialBlockSize usage in the adapter.
The total suggested group count is the per-CU occupancy multiplied by the device multiprocessor (compute-unit) count. When the per-CU occupancy is 0, fall back to reporting 1 group if the requested work-group size, dynamic local memory, and per-block register usage all fit within device limits, matching the CUDA adapter's semantics.
Closes: #21803