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

Restrict the use of [[no_unique_address]] to CXX 20 only. #764

Merged
merged 1 commit into from
Jul 28, 2022

Conversation

trivialfis
Copy link
Member

@trivialfis trivialfis commented Jul 28, 2022

Close #740 .

Found by @achirkin , the size of mapping is non-deterministic. This is caused by the macro definition around whether no_unique_address is supported with nvcc. This PR uses the standard cpp version to define the macro regardless of the compiler being used.

(!defined(__NVCC__) || ((__CUDACC_VER_MAJOR__ > 11) && (__CUDACC_VER_MINOR__ > 5)))
# if (__has_cpp_attribute(no_unique_address) >= 201803L) && !defined(_MDSPAN_COMPILER_MSVC)
#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
# if MDSPAN_HAS_CXX_20 && (__has_cpp_attribute(no_unique_address) >= 201803L)
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the proposed fix! This looks reasonable. Users can always turn off the feature if their compiler doesn't support it. Are you able to test with MDSPAN_HAS_CXX_20?

Copy link

Choose a reason for hiding this comment

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

doesn't that mean you always turn it off for NVCC since nvcc does not support C++20?

@cjnolet
Copy link
Member

cjnolet commented Jul 28, 2022

I think we should merge this, but I want to make sure if we have to merge in updates from Kokkos in the future then this won't be reverted if they haven't made the same updates by then. Can we do a quick update of our fork of Kokkos/mdspan and apply this change there too?

@cjnolet
Copy link
Member

cjnolet commented Jul 28, 2022

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 2325d2b into rapidsai:branch-22.08 Jul 28, 2022
@trivialfis trivialfis deleted the bug-no-unique-addr branch July 28, 2022 16:15
@trivialfis
Copy link
Member Author

I will open a PR upstream tomorrow.

@cjnolet
Copy link
Member

cjnolet commented Jul 28, 2022

Thankis again for the fix @trivialfis (and @achirkin)!

@mhoemmen
Copy link
Contributor

Thanks @trivialfis !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Ready for Review bug Something isn't working non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Memory leak when mdarray is used in a file that is used by cython/python interface
4 participants