@@ -117,20 +117,17 @@ static int mca_accelerator_rocm_check_addr (const void *addr, int *dev_id, uint6
117
117
#else
118
118
if (hipMemoryTypeDevice == srcAttr .memoryType ) {
119
119
#endif
120
- //We might want to set additional flags in a later iteration.
121
- //*flags |= MCA_ACCELERATOR_FLAGS_HOST_LDSTR;
122
- //*flags |= MCA_ACCELERATOR_FLAGS_HOST_ATOMICS;
123
- /* First access on a device pointer triggers ROCM support lazy initialization. */
124
120
opal_accelerator_rocm_lazy_init ();
121
+ * dev_id = srcAttr .device ;
125
122
ret = 1 ;
126
123
#if HIP_VERSION >= 50731921
127
124
} else if (hipMemoryTypeUnified == srcAttr .type ) {
128
125
#else
129
126
} else if (hipMemoryTypeUnified == srcAttr .memoryType ) {
130
127
#endif
131
128
* flags |= MCA_ACCELERATOR_FLAGS_UNIFIED_MEMORY ;
132
- //*flags |= MCA_ACCELERATOR_FLAGS_HOST_LDSTR ;
133
- //*flags |= MCA_ACCELERATOR_FLAGS_HOST_ATOMICS ;
129
+ opal_accelerator_rocm_lazy_init () ;
130
+ * dev_id = srcAttr . device ;
134
131
ret = 1 ;
135
132
}
136
133
}
@@ -527,6 +524,7 @@ static int mca_accelerator_rocm_get_ipc_handle(int dev_id, void *dev_ptr,
527
524
OBJ_CONSTRUCT (rocm_handle , opal_accelerator_rocm_ipc_handle_t );
528
525
rocm_handle -> base .dev_ptr = NULL ;
529
526
527
+ memset (rocm_ipc_handle .reserved , 0 , HIP_IPC_HANDLE_SIZE );
530
528
hipError_t err = hipIpcGetMemHandle (& rocm_ipc_handle ,
531
529
(hipDeviceptr_t )dev_ptr );
532
530
if (hipSuccess != err ) {
@@ -596,6 +594,7 @@ static int mca_accelerator_rocm_get_ipc_event_handle(opal_accelerator_event_t *e
596
594
opal_accelerator_rocm_ipc_event_handle_t * rocm_handle = (opal_accelerator_rocm_ipc_event_handle_t * ) handle ;
597
595
OBJ_CONSTRUCT (rocm_handle , opal_accelerator_rocm_ipc_event_handle_t );
598
596
597
+ memset (rocm_ipc_handle .reserved , 0 , HIP_IPC_HANDLE_SIZE );
599
598
hipError_t err = hipIpcGetEventHandle (& rocm_ipc_handle ,
600
599
* ((hipEvent_t * )event -> event ));
601
600
if (hipSuccess != err ) {
@@ -738,6 +737,11 @@ static int mca_accelerator_rocm_device_can_access_peer(int *access, int dev1, in
738
737
return OPAL_ERR_BAD_PARAM ;
739
738
}
740
739
740
+ if (dev1 == dev2 ) {
741
+ * access = 1 ;
742
+ return OPAL_SUCCESS ;
743
+ }
744
+
741
745
hipError_t err = hipDeviceCanAccessPeer (access , dev1 , dev2 );
742
746
if (hipSuccess != err ) {
743
747
opal_output_verbose (10 , opal_accelerator_base_framework .framework_output ,
@@ -753,7 +757,7 @@ static int mca_accelerator_rocm_get_buffer_id(int dev_id, const void *addr, opal
753
757
* buf_id = 0 ;
754
758
755
759
#if HIP_VERSION >= 50120531
756
- hipError_t result = hipPointerGetAttribute ((unsigned long long * )& buf_id , HIP_POINTER_ATTRIBUTE_BUFFER_ID ,
760
+ hipError_t result = hipPointerGetAttribute ((unsigned long long * )buf_id , HIP_POINTER_ATTRIBUTE_BUFFER_ID ,
757
761
(hipDeviceptr_t )addr );
758
762
if (hipSuccess != result ) {
759
763
opal_output_verbose (10 , opal_accelerator_base_framework .framework_output ,
0 commit comments