[Openmp-commits] [PATCH] D100774: [OpenMP] Add function for setting LIBOMPTARGET_INFO at runtime

Joseph Huber via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Apr 22 11:18:31 PDT 2021


jhuber6 added a comment.

In D100774#2709580 <https://reviews.llvm.org/D100774#2709580>, @JonChesterfield wrote:

> Surprising amount of code here, probably because it changes from one function to some code * number plugins.
>
> Was the idea to allow directly writing to `static uint32_t InfoLevel = 0;`, which is inconvenient when it's a static function? If so, that is still achievable in header only fashion without adding global variables to program scope, e.g. by returning a reference from getInfoLevel and adding a setter function, or going with a detail function that is called by the getter and setter.

The problem I had was that in `libomptarget` there wasn't a single instance of `#include "Debug.h"`. This meant that there were about three different versions of `InfoLevel`. This meant if the variable was static it wouldn't set everyone's version of `InfoLevel` when called from the function. It might've been a better solution to just require that `Debug.h` is included only once per library, then use a method like you described. It would certainly be nicer to not require setting the extern variables for each plugin, which is what I originally removed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100774/new/

https://reviews.llvm.org/D100774



More information about the Openmp-commits mailing list