This is an archive of the discontinued LLVM Phabricator instance.

[libomptarget][amdgpu] Refactor debug printing
ClosedPublic

Authored by JonChesterfield on Aug 23 2021, 8:55 AM.

Details

Summary

Move most debug printing in rtl.cpp behind DP() macro
Adjust the print output for gpu arch mismatch when the architectures match
Convert an assert into graceful failure

Diff Detail

Event Timeline

JonChesterfield requested review of this revision.Aug 23 2021, 8:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 23 2021, 8:55 AM

Converted fprintf and printf to DP. Left one fprintf in place because it chooses at runtime whether to write to stdout or stderr and this change was mostly interested in dropping the error messages of the format:

Possible gpu arch mismatch: device: gfx906, image:gfx906 please check compiler flag: -march=<gpu>

openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
1498

Primary change is here. This is a relatively common error message and it looks bad when the two strings it claims are likely to be different are identical.

This revision is now accepted and ready to land.Aug 23 2021, 8:59 AM
openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
290

Changed a couple of integer prints to the string format in passing

ronlieb added inline comments.Aug 23 2021, 10:02 AM
openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
1500

could we retain fprintf for the if part if this code, it is helpful to users when they miscompile one arch and run on another.

1900–1908

could we keep all the fprintf's under runtime control of STARTUP_DEBUG ,its helpful to turn this on separately then all the DP traces,

openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
1900–1908

I can make my peace with that as it's still behind an environment variable. Will wait to see if anyone else comments.

If I understand correctly this is no problem for aomp as the DP-wrapped prints can be enabled by default, therefore landing as is. Probably more iteration needed on these print messages and those elsewhere in the library.

This revision was landed with ongoing or failed builds.Aug 25 2021, 6:58 AM
This revision was automatically updated to reflect the committed changes.