[all-commits] [llvm/llvm-project] ea174c: [Libomptarget] Remove global ctor and use referenc...
Joseph Huber via All-commits
all-commits at lists.llvm.org
Thu Feb 22 10:02:05 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: ea174c09342275d6c6fec48fb846eaf28fae5b51
https://github.com/llvm/llvm-project/commit/ea174c09342275d6c6fec48fb846eaf28fae5b51
Author: Joseph Huber <huberjn at outlook.com>
Date: 2024-02-22 (Thu, 22 Feb 2024)
Changed paths:
M openmp/libomptarget/include/PluginManager.h
M openmp/libomptarget/include/omptarget.h
M openmp/libomptarget/src/OffloadRTL.cpp
M openmp/libomptarget/src/PluginManager.cpp
M openmp/libomptarget/src/exports
M openmp/libomptarget/src/interface.cpp
A openmp/libomptarget/test/offloading/runtime_init.c
Log Message:
-----------
[Libomptarget] Remove global ctor and use reference counting (#80499)
Summary:
Currently we rely on global constructors to initialize and shut down the
OpenMP runtime library and plugin manager. This causes some issues
because we do not have a defined lifetime that we can rely on to release
and allocate resources. This patch instead adds some simple reference
counted initialization and deinitialization function.
A future patch will use the `deinit` interface to more intelligently
handle plugin deinitilization. Right now we do nothing and rely on
`atexit` inside of the plugins to tear them down. This isn't great
because it limits our ability to control these things.
Note that I made the `__tgt_register_lib` functions do the
initialization instead of adding calls to the new runtime functions in
the linker wrapper. The reason for this is because in the past it's been
easier to not introduce a new function call, since sometimes the user's
compiler will link against an older `libomptarget`. Maybe if we change
the name with offloading in the future we can simplify this.
Depends on https://github.com/llvm/llvm-project/pull/80460
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list