Add API entrypoints for IPC functionality
Implement three new APIs for IPC buffer sharing:
-hsaKmtShareMemory()
-hsaKmtRegisterSharedHandle()
-hsaKmtRegisterSharedHandleToNodes()
Add new ioclts necessary for the above APIs.
Change-Id: Ia2b4d0dc91ec64bff959395d11c0536467404792
Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
[ROCm/ROCR-Runtime commit: 559e31d6ff]
Cette révision appartient à :
1 Parent
bd81b76c5a
révision
5d2336f1ca
8 fichiers modifiés
+367
-11
Aucun fichier ne correspond à votre recherche
@@ -267,6 +267,79 @@ hsaKmtRegisterGraphicsHandleToNodes(
|
||||
return ret;
|
||||
}
|
||||
|
||||
HSAKMT_STATUS
|
||||
HSAKMTAPI
|
||||
hsaKmtShareMemory(
|
||||
void *MemoryAddress, /* IN */
|
||||
HSAuint64 SizeInBytes, /* IN */
|
||||
HsaSharedMemoryHandle *SharedMemoryHandle /* OUT */
|
||||
)
|
||||
{
|
||||
CHECK_KFD_OPEN();
|
||||
|
||||
if (!SharedMemoryHandle)
|
||||
return HSAKMT_STATUS_INVALID_PARAMETER;
|
||||
|
||||
return fmm_share_memory(MemoryAddress, SizeInBytes, SharedMemoryHandle);
|
||||
}
|
||||
|
||||
HSAKMT_STATUS
|
||||
HSAKMTAPI
|
||||
hsaKmtRegisterSharedHandle(
|
||||
const HsaSharedMemoryHandle *SharedMemoryHandle, /* IN */
|
||||
void **MemoryAddress, /* OUT */
|
||||
HSAuint64 *SizeInBytes /* OUT */
|
||||
)
|
||||
{
|
||||
CHECK_KFD_OPEN();
|
||||
|
||||
return hsaKmtRegisterSharedHandleToNodes(SharedMemoryHandle,
|
||||
MemoryAddress,
|
||||
SizeInBytes,
|
||||
0,
|
||||
NULL);
|
||||
}
|
||||
|
||||
HSAKMT_STATUS
|
||||
HSAKMTAPI
|
||||
hsaKmtRegisterSharedHandleToNodes(
|
||||
const HsaSharedMemoryHandle *SharedMemoryHandle, /* IN */
|
||||
void **MemoryAddress, /* OUT */
|
||||
HSAuint64 *SizeInBytes, /* OUT */
|
||||
HSAuint64 NumberOfNodes, /* OUT */
|
||||
HSAuint32* NodeArray /* OUT */
|
||||
)
|
||||
{
|
||||
CHECK_KFD_OPEN();
|
||||
|
||||
uint32_t *gpu_id_array = NULL;
|
||||
HSAKMT_STATUS ret = HSAKMT_STATUS_SUCCESS;
|
||||
|
||||
if (!SharedMemoryHandle)
|
||||
return HSAKMT_STATUS_INVALID_PARAMETER;
|
||||
|
||||
if (NodeArray) {
|
||||
ret = validate_nodeid_array(&gpu_id_array, NumberOfNodes, NodeArray);
|
||||
if (ret != HSAKMT_STATUS_SUCCESS)
|
||||
goto error;
|
||||
}
|
||||
|
||||
ret = fmm_register_shared_memory(SharedMemoryHandle,
|
||||
SizeInBytes,
|
||||
MemoryAddress,
|
||||
gpu_id_array,
|
||||
NumberOfNodes*sizeof(uint32_t));
|
||||
if (ret != HSAKMT_STATUS_SUCCESS)
|
||||
goto error;
|
||||
|
||||
return ret;
|
||||
|
||||
error:
|
||||
if (gpu_id_array)
|
||||
free(gpu_id_array);
|
||||
return ret;
|
||||
}
|
||||
|
||||
HSAKMT_STATUS
|
||||
HSAKMTAPI
|
||||
hsaKmtDeregisterMemory(
|
||||
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur