@@ -120,20 +120,17 @@ static int mca_accelerator_rocm_check_addr (const void *addr, int *dev_id, uint6
120
120
#else
121
121
if (hipMemoryTypeDevice == srcAttr .memoryType ) {
122
122
#endif
123
- //We might want to set additional flags in a later iteration.
124
- //*flags |= MCA_ACCELERATOR_FLAGS_HOST_LDSTR;
125
- //*flags |= MCA_ACCELERATOR_FLAGS_HOST_ATOMICS;
126
- /* First access on a device pointer triggers ROCM support lazy initialization. */
127
123
opal_accelerator_rocm_lazy_init ();
124
+ * dev_id = srcAttr .device ;
128
125
ret = 1 ;
129
126
#if HIP_VERSION >= 50731921
130
127
} else if (hipMemoryTypeUnified == srcAttr .type ) {
131
128
#else
132
129
} else if (hipMemoryTypeUnified == srcAttr .memoryType ) {
133
130
#endif
134
131
* flags |= MCA_ACCELERATOR_FLAGS_UNIFIED_MEMORY ;
135
- //*flags |= MCA_ACCELERATOR_FLAGS_HOST_LDSTR ;
136
- //*flags |= MCA_ACCELERATOR_FLAGS_HOST_ATOMICS ;
132
+ opal_accelerator_rocm_lazy_init () ;
133
+ * dev_id = srcAttr . device ;
137
134
ret = 1 ;
138
135
}
139
136
}
@@ -530,6 +527,7 @@ static int mca_accelerator_rocm_get_ipc_handle(int dev_id, void *dev_ptr,
530
527
OBJ_CONSTRUCT (rocm_handle , opal_accelerator_rocm_ipc_handle_t );
531
528
rocm_handle -> base .dev_ptr = NULL ;
532
529
530
+ memset (rocm_ipc_handle .reserved , 0 , HIP_IPC_HANDLE_SIZE );
533
531
hipError_t err = hipIpcGetMemHandle (& rocm_ipc_handle ,
534
532
(hipDeviceptr_t )dev_ptr );
535
533
if (hipSuccess != err ) {
@@ -620,6 +618,7 @@ static int mca_accelerator_rocm_get_ipc_event_handle(opal_accelerator_event_t *e
620
618
opal_accelerator_rocm_ipc_event_handle_t * rocm_handle = (opal_accelerator_rocm_ipc_event_handle_t * ) handle ;
621
619
OBJ_CONSTRUCT (rocm_handle , opal_accelerator_rocm_ipc_event_handle_t );
622
620
621
+ memset (rocm_ipc_handle .reserved , 0 , HIP_IPC_HANDLE_SIZE );
623
622
hipError_t err = hipIpcGetEventHandle (& rocm_ipc_handle ,
624
623
* ((hipEvent_t * )event -> event ));
625
624
if (hipSuccess != err ) {
@@ -762,6 +761,11 @@ static int mca_accelerator_rocm_device_can_access_peer(int *access, int dev1, in
762
761
return OPAL_ERR_BAD_PARAM ;
763
762
}
764
763
764
+ if (dev1 == dev2 ) {
765
+ * access = 1 ;
766
+ return OPAL_SUCCESS ;
767
+ }
768
+
765
769
hipError_t err = hipDeviceCanAccessPeer (access , dev1 , dev2 );
766
770
if (hipSuccess != err ) {
767
771
opal_output_verbose (10 , opal_accelerator_base_framework .framework_output ,
@@ -777,7 +781,7 @@ static int mca_accelerator_rocm_get_buffer_id(int dev_id, const void *addr, opal
777
781
* buf_id = 0 ;
778
782
779
783
#if HIP_VERSION >= 50120531
780
- hipError_t result = hipPointerGetAttribute ((unsigned long long * )& buf_id , HIP_POINTER_ATTRIBUTE_BUFFER_ID ,
784
+ hipError_t result = hipPointerGetAttribute ((unsigned long long * )buf_id , HIP_POINTER_ATTRIBUTE_BUFFER_ID ,
781
785
(hipDeviceptr_t )addr );
782
786
if (hipSuccess != result ) {
783
787
opal_output_verbose (10 , opal_accelerator_base_framework .framework_output ,
0 commit comments