Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cec855a

Browse files
committed
[OpenMP][OMPT] Fix ompt_get_task_memory implementation
Since td_allow_completion_event is a member of the taskdata struct, not all firstprivate/shared variables are stored at the end of the task memory allocation. Simply report the whole allocation instead. Furthermore, the function should always return 0 since in no case there is another block to report. Differential Review: https://reviews.llvm.org/D158080
1 parent 183f49c commit cec855a

1 file changed

Lines changed: 4 additions & 17 deletions

File tree

openmp/runtime/src/ompt-specific.cpp

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ int __ompt_get_task_info_internal(int ancestor_level, int *type,
463463
}
464464

465465
int __ompt_get_task_memory_internal(void **addr, size_t *size, int blocknum) {
466+
*size = 0;
466467
if (blocknum != 0)
467468
return 0; // support only a single block
468469

@@ -471,27 +472,13 @@ int __ompt_get_task_memory_internal(void **addr, size_t *size, int blocknum) {
471472
return 0;
472473

473474
kmp_taskdata_t *taskdata = thr->th.th_current_task;
474-
kmp_task_t *task = KMP_TASKDATA_TO_TASK(taskdata);
475475

476476
if (taskdata->td_flags.tasktype != TASK_EXPLICIT)
477477
return 0; // support only explicit task
478478

479-
void *ret_addr;
480-
int64_t ret_size = taskdata->td_size_alloc - sizeof(kmp_taskdata_t);
481-
482-
// kmp_task_t->data1 is an optional member
483-
if (taskdata->td_flags.destructors_thunk)
484-
ret_addr = &task->data1 + 1;
485-
else
486-
ret_addr = &task->part_id + 1;
487-
488-
ret_size -= (char *)(ret_addr) - (char *)(task);
489-
if (ret_size < 0)
490-
return 0;
491-
492-
*addr = ret_addr;
493-
*size = (size_t)ret_size;
494-
return 1;
479+
*addr = taskdata;
480+
*size = taskdata->td_size_alloc;
481+
return 0;
495482
}
496483

497484
//----------------------------------------------------------

0 commit comments

Comments
 (0)