summaryrefslogtreecommitdiff
path: root/openmp/runtime/src/ompt-general.cpp
AgeCommit message (Collapse)Author
2025-02-27[OpenMP][OMPT][OMPD] Fix frame flags for OpenMP tool APIs (#114118)Joachim
In several cases the flags entries in ompt_frame_t are not initialized. According to @jdelsign the address provided as reenter and exit address is the canonical frame address (cfa) rather than a "framepointer". This patch makes sure that the flags entry is always initialized and changes the value from ompt_frame_framepointer to ompt_frame_cfa. The assertion in the tests makes sure that the flags are always set, when a tool (callback.h in this case) looks at the value. Fixes #89058
2024-11-04[OpenMP] Using `SimpleVLA` to handle vla usage in ompt-general.cpp. (#114583)Daniel Chen
The `openmp` runtime failed to build on LoP with LLVM18 on LoP due to the addition of `-Wvla-cxx-extension` as ``` llvm-project/openmp/runtime/src/ompt-general.cpp:711:15: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension] 711 | int tmp_ids[ids_size]; | ^~~~~~~~ llvm-project/openmp/runtime/src/ompt-general.cpp:711:15: note: function parameter 'ids_size' with unknown value cannot be used in a constant expression llvm-project/openmp/runtime/src/ompt-general.cpp:704:65: note: declared here 704 | OMPT_API_ROUTINE int ompt_get_place_proc_ids(int place_num, int ids_size, | ^ 1 error generated. ``` This patch is to ignore the checking against this usage.
2024-08-15[OpenMP] Miscellaneous small code improvements (#95603)Hansang Bae
Removes a few uninitialized variables, possible resource leaks, and redundant code.
2024-07-01[OpenMP] [OMPT] Callback registration should not depend on the device init ↵dhruvachak
callback. (#96371) Even if the device init callback is not registered, a tool should be allowed to register other callbacks.
2023-07-21[OpenMP] [OMPT] [6/8] Added callback support for target data operations, ↵Michael Halkenhaeuser
target submit, and target regions. This patch adds support for invoking target callbacks but does not yet invoke them. A new structure OmptInterface has been added that tracks thread local states including correlation ids. This structure defines methods that will be called from the device independent target library with information related to a target entry point for which a callback is invoked. These methods in turn use the callback functions maintained by OmptDeviceCallbacksTy to invoke the tool supplied callbacks. Depends on D124652 Patch from John Mellor-Crummey <johnmc@rice.edu> With contributions from: Dhruva Chakrabarti <Dhruva.Chakrabarti@amd.com> Differential Revision: https://reviews.llvm.org/D127365
2023-07-11[OpenMP] [OMPT] [amdgpu] [5/8] Implemented device init/fini/load callbacksMichael Halkenhaeuser
Added support in the generic plugin to invoke registered callbacks. Depends on D124070 Patch from John Mellor-Crummey <johnmc@rice.edu> (With contributions from Dhruva Chakrabarti <Dhruva.Chakrabarti@amd.com>) Differential Revision: https://reviews.llvm.org/D124652
2022-11-15[OpenMP] [OMPT] [2/8] Implemented a connector for communication of OMPT ↵Dhruva Chakrabarti
callbacks between libraries. This is part of a set of patches implementing OMPT target callback support and has been split out of the originally submitted https://reviews.llvm.org/D113728. The overall design can be found in https://rice.app.box.com/s/pf3gix2hs4d4o1aatwir1set05xmjljc The purpose of this patch is to provide a way to register tool-provided callbacks into libomp when libomptarget is loaded. Introduced a cmake variable LIBOMPTARGET_OMPT_SUPPORT that can be used to control OMPT target support. It follows host OMPT support, controlled by LIBOMP_HAVE_OMPT_SUPPORT. Added a connector that can be used to communicate between OMPT implementations in libomp and libomptarget or libomptarget and a plugin. Added a global constructor in libomptarget that uses the connector to force registration of tool-provided callbacks in libomp. A pair of init and fini functions are provided to libomp as part of the connect process which will be used to register the tool-provided callbacks in libomptarget. Patch from John Mellor-Crummey <johnmc@rice.edu> (With contributions from Dhruva Chakrabarti <Dhruva.Chakrabarti@amd.com>) Reviewed By: dreachem, jhuber6 Differential Revision: https://reviews.llvm.org/D123572
2022-11-01Revert "[OpenMP] [OMPT] [2/8] Implemented a connector for communication of ↵Dhruva Chakrabarti
OMPT callbacks between libraries." This reverts commit f94c2679cb1db92ce4103487bf0247eca6e4d722.
2022-10-31[OpenMP] [OMPT] [2/8] Implemented a connector for communication of OMPT ↵Dhruva Chakrabarti
callbacks between libraries. This is part of a set of patches implementing OMPT target callback support and has been split out of the originally submitted https://reviews.llvm.org/D113728. The overall design can be found in https://rice.app.box.com/s/pf3gix2hs4d4o1aatwir1set05xmjljc The purpose of this patch is to provide a way to register tool-provided callbacks into libomp when libomptarget is loaded. Introduced a cmake variable LIBOMPTARGET_OMPT_SUPPORT that can be used to control OMPT target support. It follows host OMPT support, controlled by LIBOMP_HAVE_OMPT_SUPPORT. Added a connector that can be used to communicate between OMPT implementations in libomp and libomptarget or libomptarget and a plugin. Added a global constructor in libomptarget that uses the connector to force registration of tool-provided callbacks in libomp. A pair of init and fini functions are provided to libomp as part of the connect process which will be used to register the tool-provided callbacks in libomptarget. Depends on D123429 Patch from John Mellor-Crummey <johnmc@rice.edu> (With contributions from Dhruva Chakrabarti <Dhruva.Chakrabarti@amd.com>) Reviewed By: dreachem Differential Revision: https://reviews.llvm.org/D123572
2022-10-28[OpenMP][libomp] Parameterize affinity functionsJonathan Peyton
This patch parameterizes the affinity initialization code to allow multiple affinity settings. Almost all global affinity settings are consolidated and put into a structure kmp_affinity_t. This is in anticipation of the addition of hidden helper affinity which will have the same syntax and semantics as KMP_AFFINITY only for the hidden helper team. Differential Revision: https://reviews.llvm.org/D135109
2022-06-02[OpenMP] omp_get_proc_id uses sched_getcpu fallback on FreeBSD 13.1 and above.David CARLIER
Reviewers: jlpeyton, jdoerfert Reviewed-By: jlpeyton Differential-Revision: https://reviews.llvm.org/D126408
2022-02-14[OpenMP][libomp] Introduce oneAPI compiler supportJonathan Peyton
Introduce KMP_COMPILER_ICX macro to represent compilation with oneAPI compiler. Fixup flag detection and compiler ID detection in CMake. Older CMake's detect IntelLLVM as Clang. Fix compiler warnings. Fixup many of the tests to have non-empty parallel regions as they are elided by oneAPI compiler.
2021-11-10Revert "[openmp] Add OMPT initialization in libomptarget"Joachim Protze
Reverting initial OMPT for target implementation in favor of a different implementation. This reverts commit 3bc8ce5dd718beef0031bf4b070ac4026e6910d7.
2021-10-27[OpenMP] libomp: Fix possible NULL dereference.AndreyChurbanov
According to dlsym description, the value of symbol could be NULL, and there is no error in this case. Thus dlerror will also return NULL in this case. We need to check the value returned by dlerror before printing it. Differential Revision: https://reviews.llvm.org/D112174
2021-08-04[openmp] Add OMPT initialization in libomptargetLechen Yu
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 Differential Revision: https://reviews.llvm.org/D99803
2021-06-08[OpenMP][OMPD] Implementation of OMPD debugging library - libompd.Vignesh Balasubramanian
This is the first of seven patches that implements OMPD, a debugging interface to support debugging of OpenMP programs. It contains support code required in "openmp/runtime" for OMPD implementation. Reviewed By: @hbae Differential Revision: https://reviews.llvm.org/D100181
2021-06-02[OpenMP] Fix improper printf format specifierPeyton, Jonathan L
2021-04-14[OpenMP] Fix printing routine for OMP_TOOL_VERBOSE_INITHansang Bae
Also fixed typo in the verbose message. Differential Revision: https://reviews.llvm.org/D100414
2021-03-23[OpenMP] Misc. changes that add or remove pointer/bound checksHansang Bae
-- Added or moved checks to appropriate places. -- Removed ineffective null check where the pointer is already being dereferenced around the code. -- Initialized variables that can be used without definitions. -- Added call to dlclose/FreeLibrary in OMPT tool activation. -- Added a new build compiler definition. Differential Revision: https://reviews.llvm.org/D98584
2021-02-20[OpenMP][NFC] clang-format the whole openmp projectShilei Tian
Same script as D95318. Test files are excluded. Reviewed By: AndreyChurbanov Differential Revision: https://reviews.llvm.org/D97088
2021-01-22[OpenMP] Remove unnecessary pointer checks in a few locationsHansang Bae
Also, return NULL from unsuccessful OMPT function lookup. Differential Revision: https://reviews.llvm.org/D95277
2020-11-25[OpenMP][OMPT] Implement verbose tool loadingIsabel Thärigen
OpenMP 5.1 introduces the new env variable OMP_TOOL_VERBOSE_INIT=(disabled|stdout|stderr|<filename>) to enable verbose loading and initialization of OMPT tools. This env variable helps to understand the cause when loading of a tool fails (e.g., undefined symbols or dependency not in LD_LIBRARY_PATH) Output of OMP_TOOL_VERBOSE_INIT is added for OMP_DISPLAY_ENV Tests for this patch are integrated into the different existing tool loading tests, making these tests more verbose. An Archer specific verbose test is integrated into an existing Archer test. Patch prepared by: Isabel Thärigen Differential Revision: https://reviews.llvm.org/D91464
2019-11-18[OpenMP] Add implementation and tests of Archer toolprotze@itc.rwth-aachen.de
The tool provides TSAN annotations for OpenMP synchronization. The tool is activated if no other OMPT tool is loaded. The tool detects whether the application was built with TSan and rejects activation according to the OMPT protocol if there is no TSan-rt. Differential Revision: https://reviews.llvm.org/D45890
2019-08-15[OMPT] Resolve warnings because of ints in if conditionsJonas Hahnfeld
The implementation status can only be one of ompt_event_UNIMPLEMENTED = ompt_set_never = 1 ompt_event_MAY_ALWAYS = ompt_set_always = 5 In both cases, the condition was already true, so just remove the check. Differential Revision: https://reviews.llvm.org/D65869 llvm-svn: 369001
2019-05-21[OpenMP] Add implementation to two OMPT API routinesJonathan Peyton
This change adds implementation to ompt_finalize_tool() and ompt_get_task_memory(). Patch by Hansang Bae Differential Revision: https://reviews.llvm.org/D61657 llvm-svn: 361309
2019-05-20[OMPT] Handling of the events of initial-task-begin and initial-task-endJoachim Protze
OpenMP 5.0 says that the callback for the events initial-task-begin and initial-task-end has to be ompt_callback_implicit_task. Patch by Tim Cramer Differential Revision: https://reviews.llvm.org/D58776 llvm-svn: 361157
2019-01-30[OMPT] Make sure that OMPT is enabled when accessing internals of the runtimeJoachim Protze
Redo after revert by hans. The wrong include in one test is fixed. Make sure that OMPT is enabled in runtime entry points that access internals of the runtime. Else, return an appropiate value indicating an error or that the data is not available. Patch provided by @sconvent Reviewers: jlpeyton, omalyshe, hbae, Hahnfeld, joachim.protze Reviewed By: joachim.protze Tags: #openmp, #ompt Differential Revision: https://reviews.llvm.org/D47717 llvm-svn: 352611
2019-01-19Update more file headers across all of the LLVM projects in the monorepoChandler Carruth
to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
2019-01-17Revert r351311 "[OMPT] Make sure that OMPT is enabled when accessing ↵Hans Wennborg
internals of the runtime" and also the follow-up r351315. The new test is failing on the buildbots. > Make sure that OMPT is enabled in runtime entry points that access internals > of the runtime. Else, return an appropiate value indicating an error or that > the data is not available. > > Patch provided by @sconvent > > Reviewers: jlpeyton, omalyshe, hbae, Hahnfeld, joachim.protze > > Reviewed By: joachim.protze > > Tags: #openmp, #ompt > > Differential Revision: https://reviews.llvm.org/D47717 llvm-svn: 351431
2019-01-16Fix compiler error in r351311Joachim Protze
llvm-svn: 351315
2019-01-16[OMPT] Make sure that OMPT is enabled when accessing internals of the runtimeJoachim Protze
Make sure that OMPT is enabled in runtime entry points that access internals of the runtime. Else, return an appropiate value indicating an error or that the data is not available. Patch provided by @sconvent Reviewers: jlpeyton, omalyshe, hbae, Hahnfeld, joachim.protze Reviewed By: joachim.protze Tags: #openmp, #ompt Differential Revision: https://reviews.llvm.org/D47717 llvm-svn: 351311
2019-01-15[OMPT] Second chunk of final OMPT 5.0 interface updatesJoachim Protze
The omp-tools.h file is generated from the OpenMP spec to ensure that the interface is implemented as specified. The other changes are necessary to update the interface implementation to the final version as published in 5.0. The omp-tools.h header was previously called ompt.h, currently a copy under this name is installed for legacy tools. Patch partially perpared by @sconvent Reviewers: AndreyChurbanov, hbae, Hahnfeld Reviewed By: hbae Tags: #openmp, #ompt Differential Revision: https://reviews.llvm.org/D55579 llvm-svn: 351197
2018-12-18[OMPT] First chunk of final OMPT 5.0 interface updatesJoachim Protze
This patch updates the implementation of the ompt_frame_t, ompt_wait_id_t and ompt_state_t. The final version of the OpenMP 5.0 spec added the "t" for these types. Furthermore the structure for ompt_frame_t changed and allows to specify that the reenter frame belongs to the runtime. Patch partially prepared by Simon Convent Reviewers: hbae llvm-svn: 349458
2018-09-26[OpenMP][OMPT] A few improvementsJonathan Peyton
This change includes miscellaneous improvements as follows: 1) Added ompt_get_proc_id() implementation for Windows 2) Added parser and print tool for omp-tool-var, just in case it needs to be printed (OMP_DISPLAY_ENV) 3) omp_control_tool is exported on Windows Patch by Hansang Bae Differential Revision: https://reviews.llvm.org/D50538 llvm-svn: 343137
2018-09-10[OMPT] Update types according to TR7Joachim Protze
Some types and callback signatures have changed from TR6 to TR7. Major changes (only adding signatures and stubs): (-remove idle callback) done by D48362 -add reduction and dispatch callback -add get_task_memory and finalize_tool runtime entry points -ompt_invoker_t becomes ompt_parallel_flag_t -more types of sync_regions Patch provided by Simon Convent Reviewers: hbae, protze.joachim Differential Revision: https://reviews.llvm.org/D50774 llvm-svn: 341834
2018-08-09[OpenMP] Cleanup codeJonathan Peyton
This patch cleans up unused functions, variables, sign compare issues, and addresses some -Warning flags which are now enabled including -Wcast-qual. Not all the warning flags in LibompHandleFlags.cmake are enabled, but some are with this patch. Some __kmp_gtid_from_* macros in kmp.h are switched to static inline functions which allows us to remove the awkward definition of KMP_DEBUG_ASSERT() and KMP_ASSERT() macros which used the comma operator. This had to be done for the innumerable -Wunused-value warnings related to KMP_DEBUG_ASSERT() Differential Revision: https://reviews.llvm.org/D49105 llvm-svn: 339393
2018-05-28[OMPT] Rename ompt_wait_id to omp_wait_idJoachim Protze
Rename ompt_wait_id to omp_wait_id, as defined in the spec. Differential Revision: https://reviews.llvm.org/D46530 llvm-svn: 333368
2018-05-28[OMPT] Rename ompt_frame_t to omp_frame_tJoachim Protze
Rename ompt_frame_t to omp_frame_t, as defined in the spec. Differential Revision: https://reviews.llvm.org/D43568 llvm-svn: 333367
2018-04-12Set the license header for all OMPT filesJoachim Protze
llvm-svn: 329928
2018-02-17[OMPT] Omissionin in OMPT FormattingJoachim Protze
Applying clang-format to the /runtime/src/ folder Differential Revision: https://reviews.llvm.org/D42169 llvm-svn: 325424
2018-02-17[OMPT] Update api_calls testcaseJoachim Protze
Only use ompt_ functions when testing OMPT in api_calls testcase. Add size parameter to print_list. Fix small bug in implementation of ompt_get_partition_place_nums(): return correct length. Differential Revision: https://reviews.llvm.org/D42162 llvm-svn: 325422
2018-02-06[OMPT] Fix tool initialization returning 0Joachim Protze
If tool initialization returns 0, OMPT should not be active. The current implementation provided some callback invocations in this case. Differential Revision: https://reviews.llvm.org/D42709 llvm-svn: 324320
2018-01-17[OMPT] Rename ompt_mutex_impl_t to kmp_mutex_implJoachim Protze
The defintion is not part of the spec and thus should not have the prefix "ompt_" but rather a prefix that indicates that this is implementation specific. Differential Revision: https://reviews.llvm.org/D41166 llvm-svn: 322621
2018-01-17[OMPT] Return appropiate values for ompt runtime entry points for non-OpenMP ↵Joachim Protze
threads When the current thread is not an (initialized) OpenMP thread, the runtime entry points return values that correspond to "not available" or similar Differential Revision: https://reviews.llvm.org/D41167 llvm-svn: 322620
2017-12-21[OMPT] Add missing ompt_get_num_procs functionJoachim Protze
This function is defined in OpenMP-TR6 section 4.1.5.1.6 The functions was not implemented yet. Since ompt-functions can only be called after the runtime was initialized and has loaded a tool, it can assume the runtime to be initialized. In contrast to omp_get_num_procs which needs to check whether the runtime is initialized. Differential Revision: https://reviews.llvm.org/D40949 llvm-svn: 321269
2017-12-21[OMPT] Handle null pointer in set_callback to improve performanceJoachim Protze
We use the bitmap ompt_enabled thoughout the runtime, to avoid loading the vector of callback functions when testing if specific code should be executed. Before invoking an event callback function, the pointer is tested for NULL. This revision resets the corresponding bit in ompt_enabled to 0 if NULL is passed in set_callback. Differential Revision: https://reviews.llvm.org/D41171 llvm-svn: 321264
2017-11-11[OMPT] Provide initialization for Mac OS XJonas Hahnfeld
Traditionally, the library had a weak symbol for ompt_start_tool() that served as fallback and disabled OMPT if called. Tools could provide their own version and replace the default implementation to register callbacks and lookup functions. This mechanism has worked reasonably well on Linux systems where this interface was initially developed. On Darwin / Mac OS X the situation is a bit more complicated and the weak symbol doesn't work out-of-the-box. In my tests, the library with the tool needed to link against the OpenMP runtime to make the process work. This would effectively mean that a tool needed to choose a runtime library whereas one design goal of the interface was to allow tools that are agnostic of the runtime. The solution is to use dlsym() with the argument RTLD_DEFAULT so that static implementations of ompt_start_tool() are found in the main executable. This works because the linker on Mac OS X includes all symbols of an executable in the global symbol table by default. To use the same code path on Linux, the application would need to be built with -Wl,--export-dynamic. To avoid this restriction, we continue to use weak symbols on Linux systems as before. Finally this patch extends the existing test to cover all possible ways of initializing the tool as described by the standard. It also fixes ompt_finalize() to not call omp_get_thread_num() when the library is shut down which resulted in hangs on Darwin. The changes have been tested on Linux to make sure that it passes the current tests as well as the newly extended one. Differential Revision: https://reviews.llvm.org/D39801 llvm-svn: 317980
2017-11-09Remove const from variables with dynamic memoryJonas Hahnfeld
Allocated memory is typically not 'const' if it needs to be freed. This patch removes around 50 wrong const attributes, modifies the corresponding functions and finally gets rid of some const_casts. These have especially been strange for __kmp_str_fname_free() that added a 'const' to call __kmp_str_free() which removed it again. Two minor cleanups that I performed in this process: * __kmp_tool_libraries now lives in kmp_settings.cpp as it is used nowhere else. * __kmp_msg_empty was removed as it was never used and Clang now complained that it was assigned a string literal that is 'const char *'. Differential Revision: https://reviews.llvm.org/D39755 llvm-svn: 317797
2017-11-07Cleanup version symbol macros and attributes/declspecsJonathan Peyton
1) Get rid of xaliasify, xexpand and xversionify for KMP_EXPAND_NAME and KMP_VERSION_SYMBOL. KMP_VERSION_SYMBOL is a combination of xaliasify and xversionify. 2) Put all attribute and __declspec definitions in kmp_os.h Differential Revision: https://reviews.llvm.org/D39516 llvm-svn: 317636
2017-11-06[OMPT] Improve cast that was lost on commit, NFC.Jonas Hahnfeld
llvm-svn: 317480