diff --git a/opal/mca/accelerator/accelerator.h b/opal/mca/accelerator/accelerator.h index e283ef25808..2e7d7ecf6d7 100644 --- a/opal/mca/accelerator/accelerator.h +++ b/opal/mca/accelerator/accelerator.h @@ -309,6 +309,71 @@ typedef int (*opal_accelerator_base_module_mem_release_fn_t)( typedef int (*opal_accelerator_base_module_get_address_range_fn_t)( int dev_id, const void *ptr, void **base, size_t *size); +/** + * Queries whether the device supports Inter Process Communication + * or not. If true, the functions: + * + * opal_accelerator_base_module_get_ipc_handle_size_fn_t() + * opal_accelerator_base_module_get_ipc_handle_fn_t() + * opal_accelerator_base_module_open_ipc_handle_fn_t() + * opal_accelerator_base_module_close_ipc_handle_fn_t() + * + * must be implemented. + * + * @return true IPC supported + * @return false IPC not supported + */ +typedef bool (*opal_accelerator_base_module_is_ipc_enabled_fn_t)(void); + +/** + * Returns the size of the Inter Process Communication memory handle + * + * @return size_t Size of the IPC memory handle + */ +typedef size_t (*opal_accelerator_base_module_get_ipc_handle_size_fn_t)(void); + +/** + * Gets an interprocess memory handle for an existing device memory allocation. + * + * @param[IN] dev_id Associated device for the IPC memory handle or + * MCA_ACCELERATOR_NO_DEVICE_ID + * @param[IN] dev_ptr Base pointer to previously allocated device + * memory + * @param[OUT] handle Pointer to user allocated mem handle to return + * the memory handle in. + * + * @return OPAL_SUCCESS or error status on failure + * + */ +typedef int (*opal_accelerator_base_module_get_ipc_handle_fn_t)( + int dev_id, void *dev_ptr, void **handle); + +/** + * Opens an interprocess memory handle from another process and returns + * a device pointer usable in the local process. + * + * @param[IN] dev_id Associated device for the IPC memory handle or + * MCA_ACCELERATOR_NO_DEVICE_ID + * @param[IN] handle IPC memory handle from another process + * @param[IN] dev_id Device ID associated with the IPC memory handle + * @param[OUT] dev_ptr Returned device pointer + * + * @return OPAL_SUCCESS or error status on failure + */ +typedef int (*opal_accelerator_base_module_open_ipc_handle_fn_t)( + int dev_id, void *handle, void **dev_ptr); + +/** + * Closes memory mapped with opal_accelerator_base_module_open_ipc_handle_fn_t(). + * + * @param[IN] dev_id Associated device for the IPC memory handle or + * MCA_ACCELERATOR_NO_DEVICE_ID + * @param[IN] dev_ptr IPC device pointer returned from + * opal_accelerator_base_module_open_ipc_handle_fn_t() + */ +typedef int (*opal_accelerator_base_module_close_ipc_handle_fn_t)( + int dev_id, void *dev_ptr); + /** * Page-locks the memory range specified by ptr and size * @@ -394,6 +459,12 @@ typedef struct { opal_accelerator_base_module_mem_release_fn_t mem_release; opal_accelerator_base_module_get_address_range_fn_t get_address_range; + opal_accelerator_base_module_is_ipc_enabled_fn_t is_ipc_enabled; + opal_accelerator_base_module_get_ipc_handle_size_fn_t get_ipc_handle_size; + opal_accelerator_base_module_get_ipc_handle_fn_t get_ipc_handle; + opal_accelerator_base_module_open_ipc_handle_fn_t open_ipc_handle; + opal_accelerator_base_module_close_ipc_handle_fn_t close_ipc_handle; + opal_accelerator_base_module_host_register_fn_t host_register; opal_accelerator_base_module_host_unregister_fn_t host_unregister;