37 if (status != HSA_STATUS_SUCCESS) {
85 device_map_acq |= (1 << dev_id);
88 *bitmap = device_map_acq;
132 bitmap -= bitmap & (~bitmap + 1);
145 if (dev_count >=
count) {
152 lsb = bitmap & (~bitmap + 1);
154 if (
count++ == dev_count) {
160 while (!(lsb & 0x1)) {
182 *bitmap |= (1ULL <<
i);
189 return (bitmap & (1ULL <<
i));
204 char pathname[PATH_MAX] = { 0 };
205 char *rocm_root = getenv(
"PAPI_ROCM_ROOT");
206 if (rocm_root == NULL) {
211 sprintf(pathname,
"%s/lib/libhsa-runtime64.so", rocm_root);
213 hsa_dlp = dlopen(pathname, RTLD_NOW | RTLD_GLOBAL);
275 if (hsa_errno != HSA_STATUS_SUCCESS) {
276 const char *error_string_p;
293 hsa_device_type_t
type;
297 if (hsa_errno != HSA_STATUS_SUCCESS) {
301 if (
type == HSA_DEVICE_TYPE_GPU) {
304 ++device_table_->
count;
307 return HSA_STATUS_SUCCESS;
Return codes and api definitions.
unsigned long int(* _papi_hwi_thread_id_fn)(void)
static int unload_hsa_sym(void)
static rocc_bitmap_t global_device_map
int rocc_dev_check(rocc_bitmap_t bitmap, int i)
int rocc_dev_get_map(rocc_dev_get_map_cb query_dev_id, uint64_t *events_id, int num_events, rocc_bitmap_t *bitmap)
static int load_hsa_sym(void)
hsa_status_t(* hsa_status_string_p)(hsa_status_t, const char **)
hsa_status_t(* hsa_queue_destroy_p)(hsa_queue_t *)
char error_string[PAPI_MAX_STR_LEN]
int rocc_dev_acquire(rocc_bitmap_t bitmap)
int rocc_dev_get_count(rocc_bitmap_t bitmap, int *num_devices)
device_table_t * device_table_p
static unsigned long(* thread_id_fn)(void)
static int dev_get_count(rocc_bitmap_t bitmap, int *num_devices)
hsa_status_t(* hsa_init_p)(void)
static device_table_t device_table
hsa_status_t(* hsa_agent_get_info_p)(hsa_agent_t, hsa_agent_info_t, void *)
int rocc_err_get_last(const char **err_string)
int rocc_dev_get_agent_id(hsa_agent_t agent, int *dev_id)
int rocc_dev_get_id(rocc_bitmap_t bitmap, int dev_count, int *device_id)
static void init_thread_id_fn(void)
hsa_status_t(* hsa_system_get_info_p)(hsa_system_info_t, void *)
static int init_device_table(void)
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 *)
hsa_status_t(* hsa_shut_down_p)(void)
int rocc_dev_set(rocc_bitmap_t *bitmap, int i)
int rocc_thread_get_id(unsigned long *tid)
int rocc_dev_release(rocc_bitmap_t bitmap)
int(* rocc_dev_get_map_cb)(uint64_t event_id, int *dev_id)
#define PAPI_ROCM_MAX_DEV_COUNT
hsa_agent_t devices[PAPI_ROCM_MAX_DEV_COUNT]
unsigned long _papi_getpid(void)