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

[REVIEW] mdspan integration. #437

Merged
merged 15 commits into from
Feb 22, 2022
6 changes: 4 additions & 2 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ include(cmake/thirdparty/get_rmm.cmake)
include(cmake/thirdparty/get_cuco.cmake)
include(cmake/thirdparty/get_libcudacxx.cmake)
include(cmake/thirdparty/get_faiss.cmake)
include(cmake/thirdparty/get_mdspan.cmake)

if(BUILD_TESTS)
include(cmake/thirdparty/get_gtest.cmake)
Expand All @@ -137,7 +138,8 @@ target_link_libraries(raft INTERFACE
CUDA::cusparse
$<$<BOOL:${NVTX}>:CUDA::nvToolsExt>
rmm::rmm
cuco::cuco)
cuco::cuco
std::mdspan)

target_compile_definitions(raft INTERFACE $<$<BOOL:${NVTX}>:NVTX_ENABLED>)
target_compile_features(raft INTERFACE cxx_std_17 $<BUILD_INTERFACE:cuda_std_17>)
Expand Down Expand Up @@ -248,7 +250,7 @@ install(DIRECTORY include/raft/

# Temporary install of raft.hpp while the file is removed
install(FILES include/raft.hpp
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/raft)
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/raft)

##############################################################################
# - install export -----------------------------------------------------------
Expand Down
15 changes: 15 additions & 0 deletions cpp/cmake/thirdparty/get_mdspan.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
function(find_and_configure_mdspan VERSION)
rapids_cpm_find(
mdspan ${VERSION}
GLOBAL_TARGETS std::mdspan
BUILD_EXPORT_SET raft-exports
INSTALL_EXPORT_SET raft-exports
CPM_ARGS
GIT_REPOSITORY https://github.com/trivialfis/mdspan
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we need to think about how to handle this: trivialfis/mdspan@f18e694 and whether those changes are absolutely necessary based on kokkos/mdspan#109 (comment).

cc @teju85 @seunghwak @achirkin @jrhemstad and @brycelelbach for thoughts here. We're trying to avoid forcing 64-bit indexing when we know we can safely use 32-bit (or smaller).

Copy link
Member

@teju85 teju85 Jan 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for what Corey said.

There are now a few handful of important kernels in RAFT that are having register pressure. So, increased usage of registers can cause occupancy cliffs. Based on some crude numbers, perf loss due to this was somewhere around ~3-10%! Anything we can do to NOT affect register usage for these kernels will help. So, I'd certainly want the ability to be able to use 32b for indexing in such kernels, when possible.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might also want to consider whether the mdspan fork should be moved into an official rapidsai repository for the time being.

GIT_TAG 0193f075e977cc5f3c957425fd899e53d598f524
OPTIONS "MDSPAN_ENABLE_CUDA ON"
"MDSPAN_CXX_STANDARD ON"
)
endfunction()

find_and_configure_mdspan(0.2.0)
Loading