-
Notifications
You must be signed in to change notification settings - Fork 124
[EXP][CUDA] Enable Large cluster sizes and fix cluster dimensions being set for dimensions less than 3 #1765
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
Closed
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8f7f066
set attribute allowing cluster size greater than 8
AD2605 9369144
set property cudaFuncAttributeNonPortableClusterSizeAllowed only if c…
AD2605 a8c442d
set has_property_cluster_launch only if cluster property is used
AD2605 b91c582
fix cluster dimensions being set in accordance to grid dimensions
AD2605 3f2ed1c
fix ordering of cluster dims for workDim 2
AD2605 be8af68
fix compilation errors
AD2605 5d38fe1
review comments 1
AD2605 7c1c64e
review comments 1
AD2605 bf73617
Merge branch 'main' into atharva/allow_max_cluster_size
AD2605 4a23bb9
increase cluster size upon launch to check CU_FUNC_ATTRIBUTE_NON_PORT…
AD2605 7088393
Merge remote-tracking branch 'oneapi-ur/main' into atharva/allow_max_…
AD2605 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -530,6 +530,21 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunchCustomExp( | |
| } | ||
|
|
||
| std::vector<CUlaunchAttribute> launch_attribute(numPropsInLaunchPropList); | ||
|
|
||
| // Early exit for zero size kernel | ||
| if (*pGlobalWorkSize == 0) { | ||
| return urEnqueueEventsWaitWithBarrier(hQueue, numEventsInWaitList, | ||
| phEventWaitList, phEvent); | ||
| } | ||
|
|
||
| // Set the number of threads per block to the number of threads per warp | ||
| // by default unless user has provided a better number | ||
| size_t ThreadsPerBlock[3] = {32u, 1u, 1u}; | ||
| size_t BlocksPerGrid[3] = {1u, 1u, 1u}; | ||
|
|
||
| uint32_t LocalSize = hKernel->getLocalSize(); | ||
| CUfunction CuFunc = hKernel->get(); | ||
|
|
||
| for (uint32_t i = 0; i < numPropsInLaunchPropList; i++) { | ||
| switch (launchPropList[i].id) { | ||
| case UR_EXP_LAUNCH_PROPERTY_ID_IGNORE: { | ||
|
|
@@ -540,12 +555,32 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunchCustomExp( | |
|
|
||
| launch_attribute[i].id = CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION; | ||
| // Note that cuda orders from right to left wrt SYCL dimensional order. | ||
| launch_attribute[i].value.clusterDim.x = | ||
| launchPropList[i].value.clusterDim[2]; | ||
| launch_attribute[i].value.clusterDim.y = | ||
| launchPropList[i].value.clusterDim[1]; | ||
| launch_attribute[i].value.clusterDim.z = | ||
| launchPropList[i].value.clusterDim[0]; | ||
| if (workDim == 3) { | ||
| launch_attribute[i].value.clusterDim.x = | ||
|
Comment on lines
+558
to
+559
Contributor
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. Could use some help Here - I was not able to figure out where this flipping of order happens, |
||
| launchPropList[i].value.clusterDim[2]; | ||
| launch_attribute[i].value.clusterDim.y = | ||
| launchPropList[i].value.clusterDim[1]; | ||
| launch_attribute[i].value.clusterDim.z = | ||
| launchPropList[i].value.clusterDim[0]; | ||
| } else if (workDim == 2) { | ||
| launch_attribute[i].value.clusterDim.x = | ||
| launchPropList[i].value.clusterDim[1]; | ||
| launch_attribute[i].value.clusterDim.y = | ||
| launchPropList[i].value.clusterDim[0]; | ||
| launch_attribute[i].value.clusterDim.z = | ||
| launchPropList[i].value.clusterDim[2]; | ||
| } else { | ||
| launch_attribute[i].value.clusterDim.x = | ||
| launchPropList[i].value.clusterDim[0]; | ||
| launch_attribute[i].value.clusterDim.y = | ||
| launchPropList[i].value.clusterDim[1]; | ||
| launch_attribute[i].value.clusterDim.z = | ||
| launchPropList[i].value.clusterDim[2]; | ||
| } | ||
|
|
||
| UR_CHECK_ERROR(cuFuncSetAttribute( | ||
| CuFunc, CU_FUNC_ATTRIBUTE_NON_PORTABLE_CLUSTER_SIZE_ALLOWED, 1)); | ||
|
|
||
| break; | ||
| } | ||
| case UR_EXP_LAUNCH_PROPERTY_ID_COOPERATIVE: { | ||
|
|
@@ -560,20 +595,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunchCustomExp( | |
| } | ||
| } | ||
|
|
||
| // Early exit for zero size kernel | ||
| if (*pGlobalWorkSize == 0) { | ||
| return urEnqueueEventsWaitWithBarrier(hQueue, numEventsInWaitList, | ||
| phEventWaitList, phEvent); | ||
| } | ||
|
|
||
| // Set the number of threads per block to the number of threads per warp | ||
| // by default unless user has provided a better number | ||
| size_t ThreadsPerBlock[3] = {32u, 1u, 1u}; | ||
| size_t BlocksPerGrid[3] = {1u, 1u, 1u}; | ||
|
|
||
| uint32_t LocalSize = hKernel->getLocalSize(); | ||
| CUfunction CuFunc = hKernel->get(); | ||
|
|
||
| // This might return UR_RESULT_ERROR_ADAPTER_SPECIFIC, which cannot be handled | ||
| // using the standard UR_CHECK_ERROR | ||
| if (ur_result_t Ret = | ||
|
|
||
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
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.
Uh oh!
There was an error while loading. Please reload this page.