[Openmp-commits] [PATCH] D102600: [AMDGPU][Libomptarget] Rename & move g_executables to private

Jon Chesterfield via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon May 17 02:41:07 PDT 2021


JonChesterfield added a comment.

There's one massive object in rtl.cpp that holds a lot of global state. That object would look a lot simpler if it used a vector of struct instead of of multiple vectors, but ultimately there's just a lot of book keeping that currently seems to be necessary. Restricting all globals to a single instance gives us a credible chance of getting init/dtor/locking right.

For the state that can't be eliminated, it probably all needs to end up there. The runtime singleton changed above has been incrementally cut down to a single variable, `Environment env_;`, and static functions that can be renamed to free functions. I don't remember a reason for leaving env_ in place, likely I had to stop partway through deleting members and do something else.

My preference would be to move (& rename seems good) g_executables out of global scope and into the rtl.cpp object, and delete this runtime object entirely. What do you think?



================
Comment at: openmp/libomptarget/plugins/amdgpu/impl/rt.h:47
 public:
   static Runtime &getInstance() {
     static Runtime instance;
----------------
^ singleton


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102600



More information about the Openmp-commits mailing list