Skip to content

[SYCL][XPTI] Enable code location info when NDEBUG is not defined #5023

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

Merged
merged 7 commits into from
Nov 29, 2021
Merged

[SYCL][XPTI] Enable code location info when NDEBUG is not defined #5023

merged 7 commits into from
Nov 29, 2021

Conversation

HabKaffee
Copy link
Contributor

Allow users to opt-out of extended debugging information by specifying NDEBUG macro.

Alexander Batashev and others added 2 commits November 23, 2021 11:43
@HabKaffee HabKaffee requested a review from a team as a code owner November 24, 2021 11:48
@@ -24,30 +24,46 @@
__SYCL_INLINE_NAMESPACE(cl) {
namespace sycl {
namespace detail {

#if !defined(NDEBUG) && (_MSC_VER > 1929 || __has_builtin(__builtin_FILE))
#define __XPTI_FILE_NAME __builtin_FILE()
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure about the name of the macros because code_location can be used by different components.
Can we have __CLOC or __CODELOC prefix instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we can. I will change it to __CODELOC.

@romanovvlad
Copy link
Contributor

Allow users to opt-out of extended debugging information by specifying NDEBUG macro.

As far as I can see, this patch does opposite - allows users to opt-IN of extended debugging information(filenames) by NOT specifying NDEBUG macro, is that correct?

@alexbatashev
Copy link
Contributor

Allow users to opt-out of extended debugging information by specifying NDEBUG macro.

As far as I can see, this patch does opposite - allows users to opt-IN of extended debugging information(filenames) by NOT specifying NDEBUG macro, is that correct?

To be more specific, this patch aligns with C and C++ standards: if user defines NDEBUG, debugging facilities are disabled. You can grep CFE for NDEBUG, it is not set by the compiler, rather by your build system, like CMake. This aligns with how assert() works, for example: if you do not specify -DNDEBUG, full paths to your file will be embedded to the binary.

@romanovvlad
Copy link
Contributor

Allow users to opt-out of extended debugging information by specifying NDEBUG macro.

As far as I can see, this patch does opposite - allows users to opt-IN of extended debugging information(filenames) by NOT specifying NDEBUG macro, is that correct?

To be more specific, this patch aligns with C and C++ standards: if user defines NDEBUG, debugging facilities are disabled. You can grep CFE for NDEBUG, it is not set by the compiler, rather by your build system, like CMake. This aligns with how assert() works, for example: if you do not specify -DNDEBUG, full paths to your file will be embedded to the binary.

Agree with that, my point was that without that patch filenames are not included with and without -NDEBUG.

@HabKaffee HabKaffee changed the title [SYCL][XPTI] Disable code location when NDEBUG is present [SYCL][XPTI] Enable code location info when NDEBUG is not defined Nov 29, 2021
@romanovvlad romanovvlad merged commit e9f2d64 into intel:sycl Nov 29, 2021
bader pushed a commit that referenced this pull request Dec 2, 2021
This was introduced in #5023, and broke the build with recent gcc
(11.1), as gcc doesn't implement `__builtin_COLUMN` (according to
LanguageExtensions.rst).

The `ifdef` was simply checking for the wrong one, the build works fine
with this patch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants