Open ahendriksen opened 1 year ago
What if we were to make the use of header-only SPDLOG optiona (and maybe keep it on default)? While I was investigating the compile times on RAFT, I happened to notice that the only different on the CMAKE side to enable this should be changing the spdlog target that rmm links against.
PR welcome.
@ahendriksen is this still worth pursuing, or were the changes in #1241 sufficient that we don't need to worry about this anymore? If we do still want this, do we need to reopen #1232?
I would say: let's keep it in the back of mind, but the urgency for removing spdlog is gone.
For RAFT, the compile time issues have been mostly resolved by #1241. RAFT works around the inclusion of spdlog in pool_memory_resource.hpp (overview).
For projects starting out with RMM, the out-of-the-box compile time should be greatly improved.
Summary:
Describe the bug
Including the
spdlog
headers is quite expensive. Just adding#include <spdlog/spdlog.h>
to an empty file adds 2.8 seconds to the compilation time. For the pairwise distance kernels in the RAFT library, removing thespdlog
include can reduce compile times by 50%.Steps/Code to reproduce bug
Expected behavior A smaller increase in compile time. For context, including
<string>
adds on the order of 100ms to the compilation time:Additional context
RAFT RAFT also uses
spdlog
. An issue has been opened there as well.Reason The reason that compilation takes much longer is that
spdlog
instantiates a bunch of templates in every translation unit when used as a header only library. This happens in pattern_formatter::handleflag, which is instantiated here. Just adding back thespdlog
header doubles the compile times ofcicc
(device side) and alsogcc
on the host side.Precompiled-library Another option is to not use
spdlog
as a header only library. The effect can be simulated by defining SPDLOG_COMPILED_LIB. When this is defined,spdlog
adds only 0.5 seconds: