ROCm / ROCR-Runtime

ROCm Platform Runtime: ROCr a HPC market enhanced HSA based runtime
https://rocm.docs.amd.com/projects/ROCR-Runtime/en/latest/
Other
205 stars 97 forks source link

ROCr prints to stderr during successful execution which then fails llvm lit testing #170

Open JonChesterfield opened 8 months ago

JonChesterfield commented 8 months ago

ROCr uses a debug_print() macro to say useful things during execution. There's also a debug_warning which is similar.

#ifdef NDEBUG
#define debug_print(fmt, ...)                                                         
  do {                                                                         
  } while (false)
#else
#define debug_print(fmt, ...)                                                         
  do {                                                                                             
    fprintf(stderr, fmt, ##__VA_ARGS__);                                      
  } while (false)
#endif

This interacts badly with LLVM using lit style tests which look at printed output to determine pass/fail. The net effect is a ROCr which was built with asserts on will fail a lot of tests with messages like KFD does not support xnack mode query.

Please either change the default to silent, such that some macro other than NDEBUG needs to be set to build a chatty version of the library, or provide an environment variable that one can use to disable the printing on a debug build of ROCr.

Thanks!

dayatsin-amd commented 8 months ago

Tracked internally with ticket: SWDEV-430447

JonChesterfield commented 8 months ago

Thanks! Environment variable to disable the output would work with llvm (slight hassle as lit is reluctant to forward environment variables, but could be done). Environment variable to enable the output would be preferred here.

It might be worth noting that redirecting from stderr to stdout wouldn't solve the problem with integrating with testing infra which reads the output streams since tests set up in that fashion are very likely to read both of them.