Fix sizes in OMPD support and add local ICVs functions.

This patch fixes some undesirable implementation details in OMPD support,
and adds local ICVs functions, e.g. per-thread, per-task, and per-parallel
region ICVs.

libgomp/ChangeLog

2022-06-17  Mohamed Atef  <mohamedatef1698@gmail.com>

	* ompd-helper.h (DEREFERENCE, ACCESS_VALUE): New macros.
	(gompd_get_proc_bind): Change the returned value from ompd_word_t
	to const char *.
	(gompd_get_max_task_priority): Fix format.
	(gompd_stringize_gompd_enabled): Removed.
	(gompd_get_gompd_enabled): New function prototype.
	* ompd-helper.c (gompd_get_affinity_format): Call CHECK_RET.
	Fix format in gompd_enabled GET_VALUE.
	(gompd_stringize_gompd_enabled): Removed.
	(gompd_get_nthread, gompd_get_thread_limit, gompd_get_run_sched,
	gompd_get_run_sched_chunk_size, gompd_get_default_device,
	gompd_get_dynamic, gompd_get_max_active_levels, gompd_get_proc_bind,
	gompd_is_final, gompd_is_implicit, gompd_get_team_size): New functions.
	(gompd_get_gompd_enabled): Change the returned value from
	ompd_word_t to const char *.
	* ompd-init.c (ompd_process_initialize): Use sizeof_short instead of
	sizeof_long_long in GET_VALUE argument.
	* ompd-support.h: Change type from __UINT64_TYPE__ to unsigned short.
	(GOMPD_FOREACH_ACCESS): Add entries for gomp_task kind
	and final_task and gomp_team nthreads.
	* ompd-support.c (gompd_get_offset, gompd_get_sizeof_member,
	gompd_get_size, OMPD_SECTION): Define.
	(gompd_access_gomp_thread_handle,
	gompd_sizeof_gomp_thread_handle): New variables.
	(gompd_state): Change type from __UNIT64_TYPE__ to
	unsigned short.
	(gompd_load): Remove gompd_init_access, gompd_init_sizeof_members,
	gompd_init_sizes, gompd_access_gomp_thread_handle,
	gompd_sizeof_gomp_thread_handle.
	* ompd-icv.c (ompd_get_icv_from_scope): Add thread_handle,
	task_handle and parallel_handle.  Fix format in ashandle definition.
	Call gompd_get_nthread, gompd_get_thread_limit, gomp_get_run_shed,
	gompd_get_run_sched_chunk_size, gompd_get_default_device,
	gompd_get_dynamic, gompd_get_max_active_levels, gompd_get_proc_bind,
	gompd_is_final, gompd_is_implicit,
	and gompd_get_team_size.
	(ompd_get_icv_string_from_scope): Fix format in ashandle definition.
	Add task_handle. Call gompd_get_gompd_enabled, and
	gompd_get_proc_bind.  Remove the call to
	gompd_stringize_gompd_enabled.
This commit is contained in:
Mohame Atef 2022-06-20 12:33:45 +02:00
parent 7d2bea0636
commit d098c1d7c0
6 changed files with 460 additions and 49 deletions

View File

@ -116,6 +116,7 @@ gompd_get_affinity_format (ompd_address_space_handle_t *ah, const char **string)
char *temp_str;
ompd_word_t addr;
ret = callbacks->alloc_memory (len + 1, (void **) &temp_str);
CHECK_RET (ret);
temp_str[len] = '\0';
ompd_address_t symbol_addr = {OMPD_SEGMENT_UNSPECIFIED, 0};
ret = callbacks->symbol_addr_lookup (ah->context, NULL,
@ -237,7 +238,7 @@ gompd_get_gompd_enabled (ompd_address_space_handle_t *ah, const char **string)
ompd_rc_t ret;
ompd_address_t symbol_addr = {OMPD_SEGMENT_UNSPECIFIED, 0};
GET_VALUE (ah->context, NULL, "gompd_enabled", temp, temp,
target_sizes.sizeof_int, 1, ret, symbol_addr);
target_sizes.sizeof_int, 1, ret, symbol_addr);
static const char *temp_string = "disabled";
if (temp == 1)
temp_string = "enabled";
@ -246,15 +247,363 @@ gompd_get_gompd_enabled (ompd_address_space_handle_t *ah, const char **string)
*string = temp_string;
return ret;
}
/* End of global ICVs functions. */
/* Get per thread ICVs. */
ompd_rc_t
gompd_stringize_gompd_enabled (ompd_address_space_handle_t *ah,
const char **string)
gompd_get_nthread (ompd_thread_handle_t *thread_handle,
ompd_word_t *nthreads_var)
{
return gompd_get_gompd_enabled (ah, string);
/* gomp_thread->task->gomp_task_icv.nthreads_var. */
if (thread_handle == NULL)
return ompd_rc_stale_handle;
if (nthreads_var == NULL)
return ompd_rc_bad_input;
CHECK (thread_handle->ah);
ompd_word_t res = 0;
ompd_address_t symbol_addr = thread_handle->th;
ompd_word_t temp_offset;
ompd_address_t temp_sym_addr;
ompd_addr_t temp_addr;
ompd_address_space_context_t *context = thread_handle->ah->context;
ompd_thread_context_t *t_context = thread_handle->thread_context;
ompd_rc_t ret;
/* gomp_thread->task. */
ACCESS_VALUE (context, t_context, "gompd_access_gomp_thread_task",
temp_offset, 1, ret, symbol_addr, temp_sym_addr, temp_addr);
/* gomp_thread->task->task_icv. */
ACCESS_VALUE (context, t_context, "gompd_access_gomp_task_icv", temp_offset,
1, ret, symbol_addr, temp_sym_addr, temp_addr);
/* gomp_thread->task->task_icv.nthreads_var. */
ACCESS_VALUE (context, t_context, "gompd_access_gomp_task_icv_nthreads_var",
temp_offset, 0, ret, symbol_addr, temp_sym_addr, temp_addr);
DEREFERENCE (context, t_context, symbol_addr, target_sizes.sizeof_long_long,
1, res, ret, 0);
*nthreads_var = res;
return ompd_rc_ok;
}
/* End of global ICVs functions. */
ompd_rc_t
gompd_get_default_device (ompd_thread_handle_t *thread_handle,
ompd_word_t *default_device_var)
{
/* gomp_thread->task->gomp_task_icv.default_device_var. */
if (thread_handle == NULL)
return ompd_rc_stale_handle;
if (default_device_var == NULL)
return ompd_rc_bad_input;
CHECK (thread_handle->ah);
ompd_word_t res = 0;
ompd_address_t symbol_addr = thread_handle->th;
ompd_word_t temp_offset;
ompd_address_t temp_sym_addr;
ompd_addr_t temp_addr;
ompd_address_space_context_t *context = thread_handle->ah->context;
ompd_thread_context_t *t_context = thread_handle->thread_context;
ompd_rc_t ret;
/* gomp_thread->task. */
ACCESS_VALUE (context, t_context, "gompd_access_gomp_thread_task",
temp_offset, 1, ret, symbol_addr, temp_sym_addr, temp_addr);
/* gomp_thread->task->task_icv. */
ACCESS_VALUE (context, t_context, "gompd_access_gomp_task_icv", temp_offset,
1, ret, symbol_addr, temp_sym_addr, temp_addr);
/* gomp_thread->task->task_icv.default_device_var. */
ACCESS_VALUE (context, t_context,
"gompd_access_gomp_task_icv_default_device_var", temp_offset, 0,
ret, symbol_addr, temp_sym_addr, temp_addr);
DEREFERENCE (context, t_context, symbol_addr, target_sizes.sizeof_int, 1,
res, ret, 0);
*default_device_var = res;
return ompd_rc_ok;
}
ompd_rc_t
gompd_get_dynamic (ompd_thread_handle_t *thread_handle, ompd_word_t *dyn_var)
{
/* gomp_thread->task->gomp_task_icv.dyn_var. */
if (thread_handle == NULL)
return ompd_rc_stale_handle;
if (dyn_var == NULL)
return ompd_rc_bad_input;
CHECK (thread_handle->ah);
ompd_word_t res = 0;
ompd_address_t symbol_addr = thread_handle->th;
ompd_word_t temp_offset;
ompd_address_t temp_sym_addr;
ompd_addr_t temp_addr;
ompd_address_space_context_t *context = thread_handle->ah->context;
ompd_thread_context_t *t_context = thread_handle->thread_context;
ompd_rc_t ret;
/* gomp_thread->task. */
ACCESS_VALUE (context, t_context, "gompd_access_gomp_thread_task",
temp_offset, 1, ret, symbol_addr, temp_sym_addr, temp_addr);
/* gomp_thread->task->task_icv. */
ACCESS_VALUE (context, t_context, "gompd_access_gomp_task_icv", temp_offset,
1, ret, symbol_addr, temp_sym_addr, temp_addr);
/* gomp_thread->task->task_icv.dyn_var. */
ACCESS_VALUE (context, t_context, "gompd_access_gomp_task_icv_dyn_var",
temp_offset, 0, ret, symbol_addr, temp_sym_addr, temp_addr);
DEREFERENCE (context, t_context, symbol_addr, target_sizes.sizeof_char, 1,
res, ret, 0);
*dyn_var = res;
return ompd_rc_ok;
}
/* End of per thread ICVs. */
/* Get per task ICVs. */
ompd_rc_t
gompd_get_thread_limit (ompd_task_handle_t *task_handle,
ompd_word_t *thread_limit_var)
{
/* gomp_task->gomp_task_icv.thread_limit_var. */
if (task_handle == NULL)
return ompd_rc_stale_handle;
if (thread_limit_var == NULL)
return ompd_rc_bad_input;
CHECK (task_handle->ah);
ompd_word_t res = 0;
ompd_address_t symbol_addr = task_handle->th;
ompd_word_t temp_offset;
ompd_address_t temp_sym_addr;
ompd_addr_t temp_addr;
ompd_address_space_context_t *context = task_handle->ah->context;
ompd_rc_t ret;
/* gomp_task->task_icv. */
ACCESS_VALUE (context, NULL, "gompd_access_gomp_task_icv", temp_offset,
1, ret, symbol_addr, temp_sym_addr, temp_addr);
/* gomp_task->task_icv.thread_limit_var. */
ACCESS_VALUE (context, NULL,
"gompd_access_gomp_task_icv_thread_limit_var", temp_offset, 0,
ret, symbol_addr, temp_sym_addr, temp_addr);
DEREFERENCE (context, NULL, symbol_addr, target_sizes.sizeof_int, 1,
res, ret, 0);
*thread_limit_var = res;
return ompd_rc_ok;
}
ompd_rc_t
gompd_get_run_sched_chunk_size (ompd_task_handle_t *task_handle,
ompd_word_t *run_sched_chunk_size)
{
/* gomp_task->gomp_task_icv.run_sched_chunk_size. */
if (task_handle == NULL)
return ompd_rc_stale_handle;
if (run_sched_chunk_size == NULL)
return ompd_rc_bad_input;
CHECK (task_handle->ah);
ompd_word_t res = 0;
ompd_address_t symbol_addr = task_handle->th;
ompd_word_t temp_offset;
ompd_address_t temp_sym_addr;
ompd_addr_t temp_addr;
ompd_address_space_context_t *context = task_handle->ah->context;
ompd_rc_t ret;
/* gomp_task->task_icv. */
ACCESS_VALUE (context, NULL, "gompd_access_gomp_task_icv", temp_offset,
1, ret, symbol_addr, temp_sym_addr, temp_addr);
/* gomp_task->task_icv.run_sched_chunk_size. */
ACCESS_VALUE (context, NULL,
"gompd_access_gomp_task_icv_run_sched_chunk_size", temp_offset,
0, ret, symbol_addr, temp_sym_addr, temp_addr);
DEREFERENCE (context, NULL, symbol_addr, target_sizes.sizeof_int, 1,
res, ret, 0);
*run_sched_chunk_size = res;
return ompd_rc_ok;
}
ompd_rc_t
gompd_get_run_sched (ompd_task_handle_t *task_handle,
ompd_word_t *run_sched_var)
{
/* gomp_task->gomp_task_icv.run_sched_var. */
if (task_handle == NULL)
return ompd_rc_stale_handle;
if (run_sched_var == NULL)
return ompd_rc_bad_input;
CHECK (task_handle->ah);
ompd_word_t res = 0;
ompd_address_t symbol_addr = task_handle->th;
ompd_word_t temp_offset;
ompd_address_t temp_sym_addr;
ompd_addr_t temp_addr;
ompd_address_space_context_t *context = task_handle->ah->context;
ompd_rc_t ret;
/* gomp_task->task_icv. */
ACCESS_VALUE (context, NULL, "gompd_access_gomp_task_icv", temp_offset,
1, ret, symbol_addr, temp_sym_addr, temp_addr);
/* gomp_task->task_icv.run_sched_var. */
ACCESS_VALUE (context, NULL, "gompd_access_gomp_task_icv_run_sched_var",
temp_offset, 0, ret, symbol_addr, temp_sym_addr, temp_addr);
DEREFERENCE (context, NULL, symbol_addr, target_sizes.sizeof_int, 1,
res, ret, 0);
*run_sched_var = res;
return ompd_rc_ok;
}
ompd_rc_t
gompd_get_max_active_levels (ompd_task_handle_t *task_handle,
ompd_word_t *max_active_levels_var)
{
/* gomp_task->gomp_task_icv.max_active_levels_var. */
if (task_handle == NULL)
return ompd_rc_stale_handle;
if (max_active_levels_var == NULL)
return ompd_rc_bad_input;
CHECK (task_handle->ah);
ompd_word_t res = 0;
ompd_address_t symbol_addr = task_handle->th;
ompd_word_t temp_offset;
ompd_address_t temp_sym_addr;
ompd_addr_t temp_addr;
ompd_address_space_context_t *context = task_handle->ah->context;
ompd_rc_t ret;
/* gomp_task->task_icv. */
ACCESS_VALUE (context, NULL, "gompd_access_gomp_task_icv", temp_offset,
1, ret, symbol_addr, temp_sym_addr, temp_addr);
/* gomp_task->task_icv.run_sched_var. */
ACCESS_VALUE (context, NULL,
"gompd_access_gomp_task_icv_max_active_levels_var", temp_offset,
0, ret, symbol_addr, temp_sym_addr, temp_addr);
DEREFERENCE (context, NULL, symbol_addr, target_sizes.sizeof_char, 1,
res, ret, 0);
*max_active_levels_var = res;
return ompd_rc_ok;
}
ompd_rc_t
gompd_get_proc_bind (ompd_task_handle_t *task_handle, const char **bind_var)
{
/* gomp_task->gomp_task_icv.bind_var. */
if (task_handle == NULL)
return ompd_rc_stale_handle;
if (bind_var == NULL)
return ompd_rc_bad_input;
CHECK (task_handle->ah);
ompd_word_t res = 0;
ompd_address_t symbol_addr = task_handle->th;
ompd_word_t temp_offset;
ompd_address_t temp_sym_addr;
ompd_addr_t temp_addr;
ompd_address_space_context_t *context = task_handle->ah->context;
ompd_rc_t ret;
/* gomp_task->task_icv. */
ACCESS_VALUE (context, NULL, "gompd_access_gomp_task_icv", temp_offset,
1, ret, symbol_addr, temp_sym_addr, temp_addr);
/* gomp_task->task_icv.bind_var. */
ACCESS_VALUE (context, NULL, "gompd_access_gomp_task_icv_bind_var",
temp_offset, 0, ret, symbol_addr, temp_sym_addr, temp_addr);
DEREFERENCE (context, NULL, symbol_addr, target_sizes.sizeof_char, 1,
res, ret, 0);
static const char *temp_string = "undefined";
if (res == 0)
temp_string = "FALSE";
else if (res == 1)
temp_string = "TRUE";
else if (res == 2)
temp_string = "PRIMARY";
else if (res == 3)
temp_string = "CLOSE";
else if (res == 4)
temp_string = "SPREAD";
else
return ompd_rc_error;
*bind_var = temp_string;
return ompd_rc_ok;
}
ompd_rc_t
gompd_is_final (ompd_task_handle_t *task_handle, ompd_word_t *final_task)
{
/* gomp_task->final_task. */
if (task_handle == NULL)
return ompd_rc_stale_handle;
if (final_task == NULL)
return ompd_rc_bad_input;
CHECK (task_handle->ah);
ompd_word_t res = 0;
ompd_address_t symbol_addr = task_handle->th;
ompd_word_t temp_offset;
ompd_address_t temp_sym_addr;
ompd_addr_t temp_addr;
ompd_address_space_context_t *context = task_handle->ah->context;
ompd_rc_t ret;
/* gomp_task->final_task. */
ACCESS_VALUE (context, NULL, "gompd_access_gomp_task_final_task", temp_offset,
1, ret, symbol_addr, temp_sym_addr, temp_addr);
DEREFERENCE (context, NULL, symbol_addr, target_sizes.sizeof_char, 1,
res, ret, 0);
*final_task = res;
return ompd_rc_ok;
}
ompd_rc_t
gompd_is_implicit (ompd_task_handle_t *task_handle, ompd_word_t *task_kind)
{
/* gomp_task->kind. */
if (task_handle == NULL)
return ompd_rc_stale_handle;
if (task_kind == NULL)
return ompd_rc_bad_input;
CHECK (task_handle->ah);
ompd_word_t res = -1;
ompd_address_t symbol_addr = task_handle->th;
ompd_word_t temp_offset;
ompd_address_t temp_sym_addr;
ompd_addr_t temp_addr;
ompd_address_space_context_t *context = task_handle->ah->context;
ompd_rc_t ret;
/* gomp_task->kind. */
ACCESS_VALUE (context, NULL, "gompd_access_gomp_task_kind", temp_offset, 1,
ret, symbol_addr, temp_sym_addr, temp_addr);
DEREFERENCE (context, NULL, symbol_addr, target_sizes.sizeof_int, 1, res,
ret, 0);
/* if task is implicit, then res = 0. */
res = res ? -1: 0;
*task_kind = res;
return ompd_rc_ok;
}
/* End of task ICVs. */
/* Get per parallel handle ICVs. */
ompd_rc_t
gompd_get_team_size (ompd_parallel_handle_t *parallel_handle,
ompd_word_t *nthreads)
{
/* gomp_team->nthreads. */
if (parallel_handle == NULL)
return ompd_rc_stale_handle;
if (nthreads == NULL)
return ompd_rc_bad_input;
CHECK (parallel_handle->ah);
ompd_word_t res = -1;
ompd_address_t symbol_addr = parallel_handle->th;
ompd_word_t temp_offset;
ompd_address_t temp_sym_addr;
ompd_addr_t temp_addr;
ompd_address_space_context_t *context = parallel_handle->ah->context;
ompd_rc_t ret;
/* gomp_team->nthreads. */
ACCESS_VALUE (context, NULL, "gompd_access_gomp_team_nthreads", temp_offset,
1, ret, symbol_addr, temp_sym_addr, temp_addr);
DEREFERENCE (context, NULL, symbol_addr, target_sizes.sizeof_int, 1,
res, ret, 0);
*nthreads = res;
return ompd_rc_ok;
}
/* End of parallel handle ICVs. */
ompd_rc_t
gompd_get_sizes (ompd_address_space_context_t *context)

View File

@ -90,6 +90,29 @@ typedef struct _ompd_task_handle
CHECK_RET (ret); \
} while (0)
#define DEREFERENCE(context, thread_context, symbol_addr, size, count,\
buff, ret, is_ptr) \
do {\
ret = callbacks->read_memory (context, thread_context, &symbol_addr, \
size, &buff); \
CHECK_RET (ret); \
ret = callbacks->device_to_host (context, &buff, size, count, &buff); \
CHECK_RET (ret); \
if (is_ptr) \
symbol_addr.address = buff; \
} while (0);
#define ACCESS_VALUE(context, thread_context, name, temp_offset, \
access_pointer, ret, symbol_addr, temp_sym_addr, temp_addr) \
do { \
GET_VALUE (context, thread_context, name, temp_offset, temp_offset, \
target_sizes.sizeof_short, 1, ret, temp_sym_addr); \
symbol_addr.address += temp_offset; \
for (int i = 0; i < access_pointer; i++) \
DEREFERENCE (context, thread_context, symbol_addr, \
target_sizes.sizeof_pointer, 1, temp_addr, ret, 1); \
} while (0);
#define CHECK(ah) \
do { \
if (ah == NULL || ah->context == NULL) \
@ -158,7 +181,7 @@ ompd_rc_t gompd_get_run_sched_chunk_size (ompd_task_handle_t *, ompd_word_t *);
ompd_rc_t gompd_get_default_device (ompd_thread_handle_t *, ompd_word_t *);
ompd_rc_t gompd_get_dynamic (ompd_thread_handle_t *, ompd_word_t *);
ompd_rc_t gompd_get_max_active_levels (ompd_task_handle_t *, ompd_word_t *);
ompd_rc_t gompd_get_proc_bind (ompd_task_handle_t *, ompd_word_t *);
ompd_rc_t gompd_get_proc_bind (ompd_task_handle_t *, const char **);
ompd_rc_t gompd_is_final (ompd_task_handle_t *, ompd_word_t *);
ompd_rc_t gompd_is_implicit (ompd_task_handle_t *, ompd_word_t *);
ompd_rc_t gompd_get_team_size (ompd_parallel_handle_t *, ompd_word_t *);
@ -166,7 +189,7 @@ ompd_rc_t gompd_get_team_size (ompd_parallel_handle_t *, ompd_word_t *);
/* Get Global ICVs. */
ompd_rc_t gompd_get_cancellation (ompd_address_space_handle_t *, ompd_word_t *);
ompd_rc_t gompd_get_max_task_priority (ompd_address_space_handle_t *,
ompd_word_t *);
ompd_word_t *);
ompd_rc_t gompd_get_stacksize (ompd_address_space_handle_t *, ompd_word_t *);
ompd_rc_t gompd_get_debug (ompd_address_space_handle_t *, ompd_word_t *);
ompd_rc_t gompd_get_display_affinity (ompd_address_space_handle_t *,
@ -186,8 +209,8 @@ ompd_rc_t gompd_get_throttled_spin_count (ompd_address_space_handle_t *,
ompd_word_t *);
ompd_rc_t gompd_get_managed_threads (ompd_address_space_handle_t *,
ompd_word_t *);
ompd_rc_t gompd_stringize_gompd_enabled (ompd_address_space_handle_t *,
const char **);
ompd_rc_t gompd_get_gompd_enabled (ompd_address_space_handle_t *,
const char **);
/*End of Global ICVs. */

View File

@ -97,7 +97,13 @@ ompd_get_icv_from_scope (void *handle, ompd_scope_t scope, ompd_icv_id_t icv_id,
}
/* No offloading support for now. */
ompd_address_space_handle_t *ashandle
= (ompd_address_space_handle_t *)handle;
= (ompd_address_space_handle_t *) handle;
ompd_thread_handle_t *thread_handle
= (ompd_thread_handle_t *) handle;
ompd_task_handle_t *task_handle
= (ompd_task_handle_t *) handle;
ompd_parallel_handle_t *parallel_handle
= (ompd_parallel_handle_t *) handle;
if (device == OMPD_DEVICE_KIND_HOST)
{
switch (icv_id)
@ -130,6 +136,26 @@ ompd_get_icv_from_scope (void *handle, ompd_scope_t scope, ompd_icv_id_t icv_id,
return gompd_get_throttled_spin_count (ashandle, icv_value);
case gompd_icv_managed_threads_var:
return gompd_get_managed_threads (ashandle, icv_value);
case gompd_icv_nthreads_var:
return gompd_get_nthread (thread_handle, icv_value);
case gompd_icv_default_device_var:
return gompd_get_default_device (thread_handle, icv_value);
case gompd_icv_dyn_var:
return gompd_get_dynamic (thread_handle, icv_value);
case gompd_icv_thread_limit_var:
return gompd_get_thread_limit (task_handle, icv_value);
case gompd_icv_run_sched_chunk_size:
return gompd_get_run_sched_chunk_size (task_handle, icv_value);
case gompd_icv_run_sched_var:
return gompd_get_run_sched (task_handle, icv_value);
case gompd_icv_max_active_levels_var:
return gompd_get_max_active_levels (task_handle, icv_value);
case gompd_icv_final_task_var:
return gompd_is_final (task_handle, icv_value);
case gompd_icv_implicit_task_var:
return gompd_is_implicit (task_handle, icv_value);
case gompd_icv_team_size_var:
return gompd_get_team_size (parallel_handle, icv_value);
default:
return ompd_rc_unsupported;
}
@ -167,7 +193,9 @@ ompd_get_icv_string_from_scope (void *handle, ompd_scope_t scope,
}
/* No offloading support for now. */
ompd_address_space_handle_t *ashandle
= (ompd_address_space_handle_t *)handle;
= (ompd_address_space_handle_t *) handle;
ompd_task_handle_t *task_handle
= (ompd_task_handle_t *) handle;
if (device == OMPD_DEVICE_KIND_HOST)
{
switch (icv_id)
@ -175,7 +203,9 @@ ompd_get_icv_string_from_scope (void *handle, ompd_scope_t scope,
case gompd_icv_affinity_format_var:
return gompd_get_affinity_format (ashandle, icv_value);
case gompd_icv_ompd_state:
return gompd_stringize_gompd_enabled (ashandle, icv_value);
return gompd_get_gompd_enabled (ashandle, icv_value);
case gompd_icv_bind_var:
return gompd_get_proc_bind (task_handle, icv_value);
default:
return ompd_rc_unsupported;
}

View File

@ -89,7 +89,7 @@ ompd_process_initialize (ompd_address_space_context_t *context,
/* Naive way to read from memory. */
ompd_address_t symbol_addr = {OMPD_SEGMENT_UNSPECIFIED, 0};
GET_VALUE (context, NULL, "gompd_state", gompd_state, gompd_state,
target_sizes.sizeof_long_long, 1, ret, symbol_addr);
target_sizes.sizeof_short, 1, ret, symbol_addr);
ret = callbacks->alloc_memory (sizeof (ompd_address_space_handle_t),
(void **) (handle));

View File

@ -20,48 +20,47 @@
#include "ompd-support.h"
#define gompd_declare_access(t, m) __UINT64_TYPE__ gompd_access_##t##_##m;
GOMPD_FOREACH_ACCESS (gompd_declare_access)
#undef gompd_declare_access
#ifdef __ELF__
#define OMPD_SECTION __attribute__ ((section ("OMPD")))
#else
#define OMPD_SECTION
#endif
#define gompd_declare_sizeof_members(t, m) \
__UINT64_TYPE__ gompd_sizeof_##t##_##m;
GOMPD_FOREACH_ACCESS (gompd_declare_sizeof_members)
#undef gompd_declare_sizeof_members
#ifndef GOMP_NEEDS_THREAD_HANDLE
const unsigned short gompd_access_gomp_thread_handle
__attribute__ ((used)) OMPD_SECTION = 0;
const unsigned short gompd_sizeof_gomp_thread_handle
__attribute__ ((used)) OMPD_SECTION = 0;
#endif
#define gompd_declare_sizes(t) __UINT64_TYPE__ gompd_sizeof_##t;
GOMPD_SIZES (gompd_declare_sizes)
#undef gompd_declare_sizes
/* Get offset of the member m in struct t. */
#define gompd_get_offset(t, m) \
const unsigned short gompd_access_##t##_##m __attribute__ ((used)) \
OMPD_SECTION \
= (unsigned short) offsetof (struct t, m);
GOMPD_FOREACH_ACCESS (gompd_get_offset)
#undef gompd_get_offset
/* Get size of member m in struct t. */
#define gompd_get_sizeof_member(t, m) \
const unsigned short gompd_sizeof_##t##_##m __attribute__ ((used)) \
OMPD_SECTION \
= sizeof (((struct t *) NULL)->m);
GOMPD_FOREACH_ACCESS (gompd_get_sizeof_member)
#undef gompd_get_sizeof_member
/* Get size of struct t. */
#define gompd_get_size(t) \
const unsigned short gompd_sizeof_##t##_ __attribute__ ((used)) \
OMPD_SECTION \
= sizeof (struct t);
GOMPD_SIZES (gompd_get_size)
#undef gompd_get_size
const char **ompd_dll_locations = NULL;
__UINT64_TYPE__ gompd_state;
unsigned short gompd_state;
void
gompd_load (void)
{
/* Get the offset of the struct members. */
#define gompd_init_access(t, m) \
gompd_access_##t##_##m = (__UINT64_TYPE__) & (((struct t *) NULL)->m);
GOMPD_FOREACH_ACCESS (gompd_init_access);
#undef gompd_init_access
/* Get sizeof members. */
#define gompd_init_sizeof_members(t, m) \
gompd_sizeof_##t##_##m = sizeof (((struct t *) NULL)->m);
GOMPD_FOREACH_ACCESS (gompd_init_sizeof_members);
#undef gompd_declare_sizeof_members
#define gompd_init_sizes(t) gompd_sizeof_##t = sizeof (struct t);
GOMPD_SIZES (gompd_init_sizes)
#undef gompd_init_sizes
#ifdef GOMP_NEEDS_THREAD_HANDLE
__UINT64_TYPE__ gompd_access_gomp_thread_handle
= (__UINT64_TYPE__) & (((struct gomp_thread *) NULL)->handle);
__UINT64_TYPE__ gompd_sizeof_gomp_thread_handle
= sizeof (((struct gomp_thread *) NULL)->handle);
#endif
gomp_debug (2, "OMP OMPD active\n");
static const char *ompd_dll_locations_array[2]
= {"libgompd" SONAME_SUFFIX (1) , NULL};

View File

@ -67,10 +67,16 @@
#endif
void gompd_load (void);
extern __UINT64_TYPE__ gompd_state;
extern unsigned short gompd_state;
#define OMPD_ENABLED 0x1
#ifdef GOMP_NEEDS_THREAD_HANDLE
#define gompd_thread_handle_access gompd_access (gomp_thread, handle)
#else
#define gompd_thread_handle_access
#endif
#define GOMPD_FOREACH_ACCESS(gompd_access) \
gompd_access (gomp_task_icv, nthreads_var) \
gompd_access (gomp_task_icv, run_sched_var) \
@ -83,7 +89,11 @@ extern __UINT64_TYPE__ gompd_state;
gompd_access (gomp_thread_pool, threads) \
gompd_access (gomp_thread, ts) \
gompd_access (gomp_team_state, team_id) \
gompd_access (gomp_task, icv)
gompd_access (gomp_task, icv) \
gompd_access (gomp_task, kind) \
gompd_access (gomp_task, final_task) \
gompd_access (gomp_team, nthreads) \
gompd_thread_handle_access
#define GOMPD_SIZES(gompd_size) \
gompd_size (gomp_thread) \