-
-
Notifications
You must be signed in to change notification settings - Fork 19.6k
Fix cuda_archs_loose_intersection when handling sm_*a #20207
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -265,8 +265,8 @@ macro(set_gencode_flags_for_srcs) | |
| endmacro() | ||
|
|
||
| # | ||
| # For the given `SRC_CUDA_ARCHS` list of gencode versions in the form | ||
| # `<major>.<minor>[letter]` compute the "loose intersection" with the | ||
| # For the given `SRC_CUDA_ARCHS` list of gencode versions in the form | ||
| # `<major>.<minor>[letter]` compute the "loose intersection" with the | ||
| # `TGT_CUDA_ARCHS` list of gencodes. We also support the `+PTX` suffix in | ||
| # `SRC_CUDA_ARCHS` which indicates that the PTX code should be built when there | ||
| # is a CUDA_ARCH in `TGT_CUDA_ARCHS` that is equal to or larger than the | ||
|
|
@@ -278,7 +278,7 @@ endmacro() | |
| # in `SRC_CUDA_ARCHS` that is less or equal to the version in `TGT_CUDA_ARCHS`. | ||
| # We have special handling for x.0a, if x.0a is in `SRC_CUDA_ARCHS` and x.0 is | ||
| # in `TGT_CUDA_ARCHS` then we should remove x.0a from `SRC_CUDA_ARCHS` and add | ||
| # x.0a to the result (and remove x.0 from TGT_CUDA_ARCHS). | ||
| # x.0a to the result (and remove x.0 from TGT_CUDA_ARCHS). | ||
| # The result is stored in `OUT_CUDA_ARCHS`. | ||
| # | ||
| # Example: | ||
|
|
@@ -313,21 +313,16 @@ function(cuda_archs_loose_intersection OUT_CUDA_ARCHS SRC_CUDA_ARCHS TGT_CUDA_AR | |
| # if x.0a is in SRC_CUDA_ARCHS and x.0 is in CUDA_ARCHS then we should | ||
| # remove x.0a from SRC_CUDA_ARCHS and add x.0a to _CUDA_ARCHS | ||
| set(_CUDA_ARCHS) | ||
| if ("9.0a" IN_LIST _SRC_CUDA_ARCHS) | ||
| list(REMOVE_ITEM _SRC_CUDA_ARCHS "9.0a") | ||
| if ("9.0" IN_LIST TGT_CUDA_ARCHS) | ||
| list(REMOVE_ITEM _TGT_CUDA_ARCHS "9.0") | ||
| set(_CUDA_ARCHS "9.0a") | ||
| endif() | ||
| endif() | ||
|
|
||
| if ("10.0a" IN_LIST _SRC_CUDA_ARCHS) | ||
| list(REMOVE_ITEM _SRC_CUDA_ARCHS "10.0a") | ||
| if ("10.0" IN_LIST TGT_CUDA_ARCHS) | ||
| list(REMOVE_ITEM _TGT_CUDA_ARCHS "10.0") | ||
| set(_CUDA_ARCHS "10.0a") | ||
| foreach(_arch ${_SRC_CUDA_ARCHS}) | ||
| if(_arch MATCHES "\\a$") | ||
|
Collaborator
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. shall we explicitly handle 9.0a or 10.0a? If we have something new like 11.0a, do we expect to have this logic to handle them here?
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. The cmake output looks correct when I throw in
Collaborator
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. I think the loop is the right solution 👍 this function was originally written when the only "a" variant was |
||
| list(REMOVE_ITEM _SRC_CUDA_ARCHS "${_arch}") | ||
| string(REPLACE "a" "" _base "${_arch}") | ||
| if ("${_base}" IN_LIST TGT_CUDA_ARCHS) | ||
| list(REMOVE_ITEM _TGT_CUDA_ARCHS "${_base}") | ||
| list(APPEND _CUDA_ARCHS "${_arch}") | ||
| endif() | ||
| endif() | ||
| endif() | ||
| endforeach() | ||
|
|
||
| list(SORT _SRC_CUDA_ARCHS COMPARE NATURAL ORDER ASCENDING) | ||
|
|
||
|
|
@@ -359,7 +354,7 @@ function(cuda_archs_loose_intersection OUT_CUDA_ARCHS SRC_CUDA_ARCHS TGT_CUDA_AR | |
| endforeach() | ||
|
|
||
| list(REMOVE_DUPLICATES _CUDA_ARCHS) | ||
|
|
||
| # reapply +PTX suffix to architectures that requested PTX | ||
| set(_FINAL_ARCHS) | ||
| foreach(_arch ${_CUDA_ARCHS}) | ||
|
|
@@ -370,7 +365,7 @@ function(cuda_archs_loose_intersection OUT_CUDA_ARCHS SRC_CUDA_ARCHS TGT_CUDA_AR | |
| endif() | ||
| endforeach() | ||
| set(_CUDA_ARCHS ${_FINAL_ARCHS}) | ||
|
|
||
| set(${OUT_CUDA_ARCHS} ${_CUDA_ARCHS} PARENT_SCOPE) | ||
| endfunction() | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.