Go to the source code of this file.
|
| static int | load_hsa_sym (void) |
| |
| static int | unload_hsa_sym (void) |
| |
| static int | init_device_table (void) |
| |
| static void | init_thread_id_fn (void) |
| |
| int | rocc_init (void) |
| |
| int | rocc_shutdown (void) |
| |
| int | rocc_err_get_last (const char **err_string) |
| |
| int | rocc_dev_get_map (rocc_dev_get_map_cb query_dev_id, uint64_t *events_id, int num_events, rocc_bitmap_t *bitmap) |
| |
| int | rocc_dev_acquire (rocc_bitmap_t bitmap) |
| |
| int | rocc_dev_release (rocc_bitmap_t bitmap) |
| |
| static int | dev_get_count (rocc_bitmap_t bitmap, int *num_devices) |
| |
| int | rocc_dev_get_count (rocc_bitmap_t bitmap, int *num_devices) |
| |
| int | rocc_dev_get_id (rocc_bitmap_t bitmap, int dev_count, int *device_id) |
| |
| int | rocc_dev_get_agent_id (hsa_agent_t agent, int *dev_id) |
| |
| int | rocc_dev_set (rocc_bitmap_t *bitmap, int i) |
| |
| int | rocc_dev_check (rocc_bitmap_t bitmap, int i) |
| |
| int | rocc_thread_get_id (unsigned long *tid) |
| |
| static hsa_status_t | get_agent_handle_cb (hsa_agent_t, void *) |
| |
◆ dev_get_count()
Definition at line 127 of file roc_common.c.
128{
129 *num_devices = 0;
130
131 while (bitmap) {
132 bitmap -= bitmap & (~bitmap + 1);
133 ++(*num_devices);
134 }
135
137}
◆ get_agent_handle_cb()
| hsa_status_t get_agent_handle_cb |
( |
hsa_agent_t |
agent, |
|
|
void * |
device_table |
|
) |
| |
|
static |
Definition at line 291 of file roc_common.c.
292{
293 hsa_device_type_t
type;
295
297 if (hsa_errno != HSA_STATUS_SUCCESS) {
298 return hsa_errno;
299 }
300
301 if (
type == HSA_DEVICE_TYPE_GPU) {
304 ++device_table_->
count;
305 }
306
307 return HSA_STATUS_SUCCESS;
308}
static device_table_t device_table
hsa_status_t(* hsa_agent_get_info_p)(hsa_agent_t, hsa_agent_info_t, void *)
#define PAPI_ROCM_MAX_DEV_COUNT
hsa_agent_t devices[PAPI_ROCM_MAX_DEV_COUNT]
◆ init_device_table()
| int init_device_table |
( |
void |
| ) |
|
|
static |
Definition at line 270 of file roc_common.c.
271{
273
275 if (hsa_errno != HSA_STATUS_SUCCESS) {
276 const char *error_string_p;
279 goto fn_fail;
280 }
281
282 fn_exit:
283 return papi_errno;
284 fn_fail:
287 goto fn_exit;
288}
hsa_status_t(* hsa_status_string_p)(hsa_status_t, const char **)
char error_string[PAPI_MAX_STR_LEN]
hsa_status_t(* hsa_iterate_agents_p)(hsa_status_t(*)(hsa_agent_t, void *), void *)
static hsa_status_t get_agent_handle_cb(hsa_agent_t, void *)
◆ init_thread_id_fn()
| void init_thread_id_fn |
( |
void |
| ) |
|
|
static |
Definition at line 311 of file roc_common.c.
312{
314 return;
315 }
316
319}
unsigned long int(* _papi_hwi_thread_id_fn)(void)
static unsigned long(* thread_id_fn)(void)
unsigned long _papi_getpid(void)
◆ load_hsa_sym()
| int load_hsa_sym |
( |
void |
| ) |
|
|
static |
Definition at line 200 of file roc_common.c.
201{
203
204 char pathname[PATH_MAX] = { 0 };
205 char *rocm_root = getenv("PAPI_ROCM_ROOT");
206 if (rocm_root == NULL) {
208 goto fn_fail;
209 }
210
211 sprintf(pathname, "%s/lib/libhsa-runtime64.so", rocm_root);
212
213 hsa_dlp = dlopen(pathname, RTLD_NOW | RTLD_GLOBAL);
216 goto fn_fail;
217 }
218
226
234
238 }
239
240 fn_exit:
241 return papi_errno;
242 fn_fail:
244 goto fn_exit;
245}
hsa_status_t(* hsa_queue_destroy_p)(hsa_queue_t *)
hsa_status_t(* hsa_init_p)(void)
hsa_status_t(* hsa_system_get_info_p)(hsa_system_info_t, void *)
hsa_status_t(* hsa_shut_down_p)(void)
◆ rocc_dev_acquire()
Definition at line 93 of file roc_common.c.
94{
96
99 }
101
103}
static rocc_bitmap_t global_device_map
◆ rocc_dev_check()
Definition at line 187 of file roc_common.c.
188{
189 return (bitmap & (1ULL <<
i));
190}
◆ rocc_dev_get_agent_id()
| int rocc_dev_get_agent_id |
( |
hsa_agent_t |
agent, |
|
|
int * |
dev_id |
|
) |
| |
Definition at line 169 of file roc_common.c.
170{
173 break;
174 }
175 }
177}
device_table_t * device_table_p
◆ rocc_dev_get_count()
Definition at line 121 of file roc_common.c.
122{
124}
static int dev_get_count(rocc_bitmap_t bitmap, int *num_devices)
◆ rocc_dev_get_id()
Definition at line 140 of file roc_common.c.
141{
143
145 if (dev_count >=
count) {
147 }
148
151 while (bitmap) {
152 lsb = bitmap & (~bitmap + 1);
153 bitmap -= lsb;
154 if (
count++ == dev_count) {
155 break;
156 }
157 }
158
159 *device_id = 0;
160 while (!(lsb & 0x1)) {
161 ++(*device_id);
162 lsb >>= 1;
163 }
164
166}
◆ rocc_dev_get_map()
Definition at line 74 of file roc_common.c.
75{
78
80 int dev_id;
83 }
84
85 device_map_acq |= (1 << dev_id);
86 }
87
88 *bitmap = device_map_acq;
90}
◆ rocc_dev_release()
◆ rocc_dev_set()
Definition at line 180 of file roc_common.c.
181{
182 *bitmap |= (1ULL <<
i);
184}
◆ rocc_err_get_last()
| int rocc_err_get_last |
( |
const char ** |
err_string | ) |
|
◆ rocc_init()
Definition at line 29 of file roc_common.c.
30{
33 goto fn_fail;
34 }
35
37 if (status != HSA_STATUS_SUCCESS) {
39 goto fn_fail;
40 }
41
44 (*hsa_shut_down_p)();
45 goto fn_fail;
46 }
47
50
51 fn_exit:
52 return papi_errno;
53 fn_fail:
55 goto fn_exit;
56}
static int unload_hsa_sym(void)
static int load_hsa_sym(void)
static void init_thread_id_fn(void)
static int init_device_table(void)
◆ rocc_shutdown()
| int rocc_shutdown |
( |
void |
| ) |
|
◆ rocc_thread_get_id()
| int rocc_thread_get_id |
( |
unsigned long * |
tid | ) |
|
◆ unload_hsa_sym()
| int unload_hsa_sym |
( |
void |
| ) |
|
|
static |
◆ device_table
◆ device_table_p
◆ error_string
◆ global_device_map
◆ hsa_agent_get_info_p
| hsa_status_t(* hsa_agent_get_info_p) (hsa_agent_t, hsa_agent_info_t, void *) |
( |
hsa_agent_t |
, |
|
|
hsa_agent_info_t |
, |
|
|
void * |
|
|
) |
| |
◆ hsa_dlp
◆ hsa_init_p
| hsa_status_t(* hsa_init_p) (void) |
( |
void |
| ) |
|
◆ hsa_iterate_agents_p
| hsa_status_t(* hsa_iterate_agents_p) (hsa_status_t(*)(hsa_agent_t, void *), void *) |
( |
hsa_status_t(*)(hsa_agent_t, void *) |
, |
|
|
void * |
|
|
) |
| |
◆ hsa_queue_destroy_p
| hsa_status_t(* hsa_queue_destroy_p) (hsa_queue_t *) |
( |
hsa_queue_t * |
| ) |
|
◆ hsa_shut_down_p
| hsa_status_t(* hsa_shut_down_p) (void) |
( |
void |
| ) |
|
◆ hsa_status_string_p
| hsa_status_t(* hsa_status_string_p) (hsa_status_t, const char **) |
( |
hsa_status_t |
, |
|
|
const char ** |
|
|
) |
| |
◆ hsa_system_get_info_p
| hsa_status_t(* hsa_system_get_info_p) (hsa_system_info_t, void *) |
( |
hsa_system_info_t |
, |
|
|
void * |
|
|
) |
| |
◆ thread_id_fn
| unsigned long(* thread_id_fn) (void) |
( |
void |
| ) |
|
|
static |