-
Notifications
You must be signed in to change notification settings - Fork 167
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
Explicitly specify used NVTX3 C++ wrapper version #1688
Conversation
@bernhardmgruber how does this change interact with user code relying on nvtx API? |
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 rushed approving the PR. Answering my own question, the change doesn't play well with user code:
#include <cub/device/device_reduce.cuh>
#include <nvtx3/nvtx3.hpp>
struct my_domain{ static constexpr char const* name{"my domain"}; };
int main() {
nvtx3::scoped_range_in<my_domain> domain; // fails to compile
}
Where would the |
After looking through
Therefore, when we define Bottom line: this PR breaks user-side use of NVTX3 if they happen to use the non-explicit API (which is the default) and use the same major and minor API version (also the default because only API 1.0 exists). |
After playing with this for a while and supplying |
a4b30cb
to
caf3944
Compare
This is suggested in the corresponding documentation: https://github.com/NVIDIA/NVTX/blob/09e0d23a61ae86cc381eef85d012afc3a2e6eeea/c/include/nvtx3/nvtx3.hpp#L21-L39
caf3944
to
2c9e51d
Compare
As expected, with the test from #1690, this PR now fails with:
We thus cannot use the explicitly versioned API from the NVTX3 C++ wrapper. |
@bernhardmgruber I believe this was closed prematurely. We discussed that we don't need #define NVTX3_CPP_REQUIRE_EXPLICIT_VERSION
#include <nvtx3/nvtx3.hpp>
#include <cub/device/device_reduce.cuh>
int main() {} |
This code does indeed break. However, CUB internally does this: # if __has_include(<nvtx3/nvtx3.hpp>)
# include <nvtx3/nvtx3.hpp>
# else // __has_include(<nvtx3/nvtx3.hpp>)
# include "nvtx3.hpp"
# endif // __has_include(<nvtx3/nvtx3.hpp>) to choose whether to pick the vendored ::nvtx3::v1::scoped_range_in<...> and the file |
As discussed above, we can also not ship our own I see no way how to create a situation where neither CUB nor the user can be broken in some way when various or equal, explicit or implicit nvtx3 versions are in the game, without modifiying The root culprit is simply that whatever API version CUB uses, the user cannot have the same API version with the opposite explicitness. |
@gevtushenko I created an issue that covers the failing program you listed above: #1750 |
This is suggested in the corresponding documentation: https://github.com/NVIDIA/NVTX/blob/09e0d23a61ae86cc381eef85d012afc3a2e6eeea/c/include/nvtx3/nvtx3.hpp#L21-L39