Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Sanitize use of external macros #476

Merged
merged 3 commits into from
Jun 1, 2023
Merged

Conversation

miscco
Copy link
Collaborator

@miscco miscco commented May 31, 2023

Currently we define certain external macros that are used in product code.

However, this might clash with external definitions and create include order issues.

To alleviate this, define internal _LIBCUDACXX_MEOW macros that cannot clash with the outside world.

We also defined either __float16 or _Float16 despite them not being used internally at all. We should not do this and this has lead to compile issues on at least GCC. So drop those definitions.

Addresses nvbug4139266 and nvbug4123393
Fixes #460

// Just so we can migrate to the new macros gradually.

#ifdef __cuda_std__
# define _LIBCUDACXX_EXECUTION_SPACE_SPECIFIER __host__ __device__
# define _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_EXECUTION_SPACE_SPECIFIER
# define _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_HOST_DEVICE
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should figure out what we're going to do with _LIBUCDACXX_INLINE_VISIBILITY/_LIBCUDACXX_HIDE_FROM_ABI/_LIBCUDACXX_HOST_DEVICE and decide what we are going to use where and when.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The precedent from upstream is to only ever use _LIBCUDACXX_HIDE_FROM_ABI so I think that should be the route to go

@miscco miscco force-pushed the sanitize_macros branch from e8754d0 to f6d07dd Compare May 31, 2023 13:52
miscco added 3 commits June 1, 2023 08:43
Neither `__fp16` and `_Float16` are used internally but may potentially clash with outside definitions.

Do not define what we do not use
@miscco miscco force-pushed the sanitize_macros branch from f6d07dd to b76325f Compare June 1, 2023 06:44
@miscco miscco merged commit e760728 into NVIDIA:main Jun 1, 2023
@miscco miscco deleted the sanitize_macros branch June 1, 2023 06:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

libcu++ should not define __host__/__device__/__forceinline__ (or any other runtime macros)
3 participants