[Openmp-commits] [openmp] [OpenMP][OMPT] Add ompt_set_frame_enter support to libomptarget (PR #201127)

Jan André Reuter via Openmp-commits openmp-commits at lists.llvm.org
Fri Aug 7 06:05:28 PDT 2026


================
@@ -481,6 +481,21 @@ int __ompt_get_task_memory_internal(void **addr, size_t *size, int blocknum) {
   return 0;
 }
 
+//----------------------------------------------------------
+// target region support
+//----------------------------------------------------------
+
+int __ompt_set_frame_enter_internal(void *addr, int flags, int state) {
+  int gtid = __kmp_entry_gtid();
+  kmp_info_t *thr = __kmp_threads[gtid];
+
+  ompt_frame_t *ompt_frame = &OMPT_CUR_TASK_INFO(thr)->frame;
+  OMPT_FRAME_SET(ompt_frame, enter, addr, flags);
+  int old_state = thr->th.ompt_thread_info.state;
+  thr->th.ompt_thread_info.state = ompt_state_work_parallel;
----------------
Thyre wrote:

Completely agreed. I was more confused by setting the state to `work_parallel` when we're entering a target region.
But I guess `ompt_state_wait_target` doesn't apply until the kernel has been dispatched.
I don't think there's a flag to really indicate the runtime entering a target region. A sampling tool would probably see something like `work_serial`/ `work_parallel`, depending on the outer context.

https://github.com/llvm/llvm-project/pull/201127


More information about the Openmp-commits mailing list