When loading libomptarget, the init function in libomptarget/src/rtl.cpp
will search for the libomptarget_start_tool function using libdl.
libomptarget_start_tool will pass those OMPT callbacks related to target
constructs to libomptarget
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
openmp/libomptarget/src/ompt-target.h | ||
---|---|---|
13 | ompt_internal.h resides under runtime/src/, not libomptarget/src/. | |
openmp/libomptarget/src/rtl.cpp | ||
71 | If the call to start_tool failed, is it correct to claim that ompt is initialized? On the other hand, maybe it's enough that you've set ompt_target_enabled to 0. |
openmp/libomptarget/src/rtl.cpp | ||
---|---|---|
60 | Below in line 103, __kmpc_get_target_offload is called directly without dlsym. Is that the preferred way to call into libomp? | |
71 | The OMPT initialization mechanism should happen once during the execution of an application. I just realized, that we will need to check what libomp is doing after forking a process, but that's a separate issue. | |
openmp/runtime/src/ompt-general.cpp | ||
134 | This function is called by libomptarget and should not be weak. | |
138–140 | This will call __kmp_middle_initialize whenever libomptarget gets initialized. Is this ok? |
Update ompt initialization in libomptarget: 1. Change the initialization function name to "libomp_start_tool" 2. Libomptarget uses weak symbol rather than libdl to retrieve libomp_start_tool 3. Libomp_start_tool only sets the bitmap, since libomptarget will delegate the callback invocation to libomp. Libomptarget no longer needs the addresses of OMPT callbacks and entry points
openmp/libomptarget/src/interface.cpp | ||
---|---|---|
312–314 ↗ | (On Diff #338233) | Remove |
openmp/libomptarget/src/interface.cpp | ||
---|---|---|
312–314 ↗ | (On Diff #338233) | I have removed it in the new diff |
openmp/libomptarget/src/ompt-target.h | ||
13 | This file no longer needs "ompt-internal.h" in the updated diff. For omp-tools.h, I have added LIBOMP_INCLUDE_DIR into LIBOMPTARGET_LLVM_INCLUDE_DIRS (at openmp/libomptarget/src/CMakeLists.txt:25). |
reverse ping.
Can we move this along? Are there blockers? If we need discussion let's do it next Wednesday.
openmp/libomptarget/src/rtl.cpp | ||
---|---|---|
199 | Can we also turn if off when !libomp_start_tool? |
openmp/libomptarget/src/rtl.cpp | ||
---|---|---|
199 | Do you mean the ompt_initialized variable? I think, we just can remove this variable. LoadRTLs should only be called once during the execution. All other code just looks at ompt_target_enabled, which is 0 if !libomp_start_tool. |
openmp/libomptarget/src/rtl.cpp | ||
---|---|---|
199 | Looks OK for now. |
The fixed version LGTM
openmp/libomptarget/src/rtl.cpp | ||
---|---|---|
199 | The ompt_initialized variable is gone now. |
ompt_internal.h resides under runtime/src/, not libomptarget/src/.