This is an archive of the discontinued LLVM Phabricator instance.

[CUDA] Define __CUDACC_DEBUG__ when compiling device code in debug mode
AbandonedPublic

Authored by tambre on Apr 23 2020, 9:24 AM.

Details

Reviewers
tra
Summary

NVCC defines CUDACC_DEBUG when compiling device code in debug mode.
Let's do the same to help with compatibility between the two and possibly enable users to select debug-friendly code.

Implements PR45596.

Diff Detail

Event Timeline

tambre created this revision.Apr 23 2020, 9:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 23 2020, 9:24 AM
tra added inline comments.Apr 23 2020, 10:00 AM
clang/lib/Driver/ToolChains/Cuda.cpp
632

Built-in preprocessor macros are defined in clang/lib/Frontend/InitPreprocessor.cpp, so the change should ideally go there.

Also, it's not clear what exactly does the macro mean. I am not convinced that clang must set this macro. Clang is not 1:1 compatible with NVCC anyways, and I'd rather not add quirks unless they are absolutely necessary. In this case, it can be easily added by the user.

tambre abandoned this revision.Apr 23 2020, 10:52 AM
tambre marked an inline comment as done.

Abandoning as there are good reasons to not add this.

clang/lib/Driver/ToolChains/Cuda.cpp
632

Agreed.