Skip to content

Commit

Permalink
[libomptarget][nfc] Hoist hsa_init into rtl.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
JonChesterfield committed Sep 9, 2021
1 parent b1fb3d7 commit d642156
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
7 changes: 1 addition & 6 deletions openmp/libomptarget/plugins/amdgpu/impl/system.cpp
Expand Up @@ -177,12 +177,7 @@ hsa_status_t callbackEvent(const hsa_amd_event_t *event, void *data) {
}

hsa_status_t atl_init_gpu_context() {
hsa_status_t err;
err = hsa_init();
if (err != HSA_STATUS_SUCCESS)
return HSA_STATUS_ERROR;

err = hsa_amd_register_system_event_handler(callbackEvent, NULL);
hsa_status_t err = hsa_amd_register_system_event_handler(callbackEvent, NULL);
if (err != HSA_STATUS_SUCCESS) {
printf("[%s:%d] %s failed: %s\n", __FILE__, __LINE__,
"Registering the system for memory faults", get_error_string(err));
Expand Down
5 changes: 4 additions & 1 deletion openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
Expand Up @@ -691,7 +691,10 @@ class RTLDeviceInfoTy {
print_kernel_trace = 0;

DP("Start initializing " GETNAME(TARGET_NAME) "\n");
hsa_status_t err = core::atl_init_gpu_context();
hsa_status_t err = hsa_init();
if (err == HSA_STATUS_SUCCESS) {
err = core::atl_init_gpu_context();
}
if (err == HSA_STATUS_SUCCESS) {
HSAInitializeSucceeded = true;
} else {
Expand Down

0 comments on commit d642156

Please sign in to comment.