This is an archive of the discontinued LLVM Phabricator instance.

[OMPT] Fix use of 'DEBUG_PREFIX' in the OMPT headers
ClosedPublic

Authored by jhuber6 on Jul 14 2023, 10:38 AM.

Details

Summary

This is the only place that defines this prefix in a header file and
was thus overriding and redefining other users of it. If we must use it
in a header file, at least repsect its old values.

Diff Detail

Event Timeline

jhuber6 created this revision.Jul 14 2023, 10:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2023, 10:38 AM
jhuber6 requested review of this revision.Jul 14 2023, 10:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2023, 10:38 AM

In addition to this, we also have definition of the macro in CMake files. I think we need to define them in a unified manner: either all in CMake file, or in header.

jhuber6 added a comment.EditedJul 14 2023, 10:44 AM

In addition to this, we also have definition of the macro in CMake files. I think we need to define them in a unified manner: either all in CMake file, or in header.

I've wanted to do a complete overhaul of libomptarget diagnostics for awhile now. This is just the fast way to get something nominally functional. In the future we probably want routines that map into the LLVM libraries for formatting and printing.

jhuber6 updated this revision to Diff 540495.Jul 14 2023, 10:48 AM

Fix the .cpp file as well

tianshilei1992 accepted this revision.Jul 14 2023, 1:37 PM

LG. Let's make things better in the followup patch.

This revision is now accepted and ready to land.Jul 14 2023, 1:37 PM
This revision was automatically updated to reflect the committed changes.

It seems like this patch introduced some new warnings:

In file included from /home/ac.shilei.tian/Documents/vscode/llvm-project/openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp:22:
/home/ac.shilei.tian/Documents/vscode/llvm-project/openmp/libomptarget/include/OmptCallback.h:87:9: warning: pragma pop_macro could not pop 'DEBUG_PREFIX', no matching push_macro [-Wignored-pragmas]
   87 | #pragma pop_macro("DEBUG_PREFIX")
      |         ^
1 warning generated.
[46/54] Building CXX object libomptarget/plugins-nextgen/amdgpu/CMakeFiles/omptarget.rtl.amdgpu.dir/src/rtl.cpp.o
In file included from /home/ac.shilei.tian/Documents/vscode/llvm-project/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp:26:
/home/ac.shilei.tian/Documents/vscode/llvm-project/openmp/libomptarget/include/OmptCallback.h:87:9: warning: pragma pop_macro could not pop 'DEBUG_PREFIX', no matching push_macro [-Wignored-pragmas]
   87 | #pragma pop_macro("DEBUG_PREFIX")
      |         ^
1 warning generated.

It seems like this patch introduced some new warnings:

In file included from /home/ac.shilei.tian/Documents/vscode/llvm-project/openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp:22:
/home/ac.shilei.tian/Documents/vscode/llvm-project/openmp/libomptarget/include/OmptCallback.h:87:9: warning: pragma pop_macro could not pop 'DEBUG_PREFIX', no matching push_macro [-Wignored-pragmas]
   87 | #pragma pop_macro("DEBUG_PREFIX")
      |         ^
1 warning generated.
[46/54] Building CXX object libomptarget/plugins-nextgen/amdgpu/CMakeFiles/omptarget.rtl.amdgpu.dir/src/rtl.cpp.o
In file included from /home/ac.shilei.tian/Documents/vscode/llvm-project/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp:26:
/home/ac.shilei.tian/Documents/vscode/llvm-project/openmp/libomptarget/include/OmptCallback.h:87:9: warning: pragma pop_macro could not pop 'DEBUG_PREFIX', no matching push_macro [-Wignored-pragmas]
   87 | #pragma pop_macro("DEBUG_PREFIX")
      |         ^
1 warning generated.

Duh, forgot there was a second header guard for OMPT_SUPPORT. Didn't get that locally since I guess it's on. Simply needs to be moved before the penultimate #endif.