Presently, there a number of global variables in libomptarget (devices, RTLs, tables, mutexes, etc.), that are not placed within a struct. This patch places them into a struct `PluginManager`. All of the functions that act on this data remain free. This may/will be succeeded by more patches that encapsulate the global libomptarget state.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I believe this patch is the first one of a series to refactor the libomptarget. I suggest to add your plan into the description. Otherwise, I didn't see any "encapsulation" from this patch. All members in the new class can still be accessed casually.
Thought I'd commented on this but can't see it. I like the change - one global instance holding all the state is much better than scattering the variables around.
It lends itself to a later change supporting N independent copies of the library, e.g. to facilitate testing.
openmp/libomptarget/src/rtl.cpp | ||
---|---|---|
34 | I might have g |
openmp/libomptarget/src/rtl.cpp | ||
---|---|---|
34 |
*one with a global instance by value, instead of heap allocation, but this is better if we can later drop the singleton. |
openmp/libomptarget/src/device.h | ||
---|---|---|
237 | Documentation for the struct and all its member please, doxygen style. |
- Updated title, revision summary, and commit message
- Added documentation for struct and members
@JonChesterfield, we'll address supporting multiple independent copies for testing next :)
openmp/libomptarget/src/rtl.cpp | ||
---|---|---|
34 | Lack of documentation for PM. Is it a singleton? Should be mentioned. |
Documentation for the struct and all its member please, doxygen style.