-
Notifications
You must be signed in to change notification settings - Fork 99
DPC++ CMake configuration #972
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
Conversation
cmake/build_helpers.cmake
Outdated
| function(insertionSortRecursive sort_list) | ||
| # Get list length | ||
| list(LENGTH sort_list len) | ||
|
|
||
| # Base case, return. | ||
| if(${len} LESS_EQUAL 1) | ||
| return() | ||
| endif() | ||
|
|
||
| math(EXPR len_minus_one "${len} - 1") | ||
| # Recursively sort the sublist of size (len - 1). | ||
| insertionSortRecursive("${sort_list}" ${len_minus_one}) | ||
| set(_sort_list ${sort_list}) | ||
|
|
||
| # Get the last element in the sublist. | ||
| list(GET _sort_list ${len_minus_one} last_element) | ||
| # Define a counter for the sublist we will operate on. | ||
| math(EXPR sublist_counter "${len} - 2") | ||
| # Get the element at the counter index. | ||
| list(GET _sort_list ${sublist_counter} counter_element) | ||
|
|
||
| # Loop to move those elements greater than last_element up one position. | ||
| while((${sublist_counter} GREATER_EQUAL 0) AND (${counter_element} GREATER ${last_element})) | ||
| # Move elem at counter index up one position in list. | ||
| math(EXPR counter_plus_one "${sublist_counter} + 1") | ||
| list(REMOVE_AT _sort_list ${counter_plus_one}) | ||
| list(INSERT _sort_list ${counter_plus_one} ${counter_element}) | ||
| # Decrement the sublist counter. | ||
| math(EXPR sublist_counter "${sublist_counter} - 1") | ||
| # Get the element at the new counter value. | ||
| list(GET _sort_list ${sublist_counter} counter_element) | ||
| endwhile() | ||
|
|
||
| # Place the last element at the correct position. | ||
| math(EXPR counter_plus_one "${sublist_counter} + 1") | ||
| list(REMOVE_AT _sort_list ${counter_plus_one}) | ||
| list(INSERT _sort_list ${counter_plus_one} ${last_element}) | ||
| # Send the modified list back up to parent scope. | ||
| set(sort_list ${_sort_list} PARENT_SCOPE) | ||
| endfunction() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to do that at compile-time in C++, CMake is not really a language for complex algorithms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well in CMake 3.18 this whole thing disappears as there is native support for this. But I understand your point.
f6b3fc7 to
a89907d
Compare
+ Now the DPC++ configuration of workgroups/subgroups is generated from CMake using a `config.hpp.in` file. + AOT support is added thanks to a new `GINKGO_DPCPP_AOT_TARGETS` variable
ab8d26f to
01f10b0
Compare
+ Sorting, with/without keeping duplicates, in ascending or descending order + Accessing functionality + min, max, median + Converting to a plain value
+ Also add a syn::merge function which allows merging lists thanks to an ::encode() function.
|
format! |
Co-authored-by: Terry Cojean <tcojean@users.noreply.github.com>
dpcpp seems to be unhappy with atomic on UninitializedArray
|
Note: This PR changes the Ginkgo ABI: For details check the full ABI diff under Artifacts here |
|
Error: The following files need to be formatted: You can find a formatting patch under Artifacts here or run |
| target_compile_options(ginkgo_dpcpp PUBLIC -fsycl-targets=${GINKGO_DPCPP_AOT_TARGETS_FORMATTED}) | ||
| target_link_options(ginkgo_dpcpp PUBLIC -fsycl-targets=${GINKGO_DPCPP_AOT_TARGETS_FORMATTED}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch on adding link_options. But does this need to be public? This would probably fail if some program links against Ginkgo but uses a non DPC++ compiler which does not have the option (like gcc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's mainly from cpu side of https://www.intel.com/content/www/us/en/develop/documentation/oneapi-dpcpp-cpp-compiler-dev-guide-and-reference/top/compilation/ahead-of-time-compilation.html. If do not add it with the final execution, it can only use host queue (no subgroup or others support).
I am not pretty sure the compile or linking
|
We need to reevaluate this approach to fix #919. I will close this PR for now. |
Gives the ability to select DPC++ hardware parameters from CMake.
This is old code and needs to be retested.
per_sourceon CPU through generic file splitting.Fixes #919