Added support for Primary Context Management APIs
Change-Id: I70f91b4492e112dd8e12ecf511fdc18a27944a06
Этот коммит содержится в:
@@ -283,3 +283,79 @@ hipError_t hipCtxGetFlags ( unsigned int* flags )
|
||||
*flags = tempCtx->_ctxFlags;
|
||||
return ihipLogStatus(e);
|
||||
}
|
||||
|
||||
hipError_t hipDevicePrimaryCtxGetState ( hipDevice_t dev, unsigned int* flags, int* active )
|
||||
{
|
||||
HIP_INIT_API(dev, flags, active);
|
||||
hipError_t e = hipSuccess;
|
||||
auto deviceHandle = ihipGetDevice(dev);
|
||||
|
||||
if (deviceHandle == NULL) {
|
||||
e = hipErrorInvalidDevice;
|
||||
}
|
||||
|
||||
ihipCtx_t* tempCtx;
|
||||
tempCtx = ihipGetTlsDefaultCtx();
|
||||
ihipCtx_t* primaryCtx = deviceHandle->_primaryCtx;
|
||||
if(tempCtx == primaryCtx) {
|
||||
*active = 1;
|
||||
*flags = tempCtx->_ctxFlags;
|
||||
} else {
|
||||
*active = 0;
|
||||
*flags = primaryCtx->_ctxFlags;
|
||||
}
|
||||
return ihipLogStatus(e);
|
||||
}
|
||||
|
||||
hipError_t hipDevicePrimaryCtxRelease ( hipDevice_t dev)
|
||||
{
|
||||
HIP_INIT_API(dev);
|
||||
hipError_t e = hipSuccess;
|
||||
auto deviceHandle = ihipGetDevice(dev);
|
||||
|
||||
if (deviceHandle == NULL) {
|
||||
e = hipErrorInvalidDevice;
|
||||
}
|
||||
return ihipLogStatus(e);
|
||||
}
|
||||
|
||||
hipError_t hipDevicePrimaryCtxRetain ( hipCtx_t* pctx, hipDevice_t dev )
|
||||
{
|
||||
HIP_INIT_API(pctx, dev);
|
||||
hipError_t e = hipSuccess;
|
||||
auto deviceHandle = ihipGetDevice(dev);
|
||||
|
||||
if (deviceHandle == NULL) {
|
||||
e = hipErrorInvalidDevice;
|
||||
}
|
||||
*pctx = deviceHandle->_primaryCtx;
|
||||
return ihipLogStatus(e);
|
||||
}
|
||||
|
||||
hipError_t hipDevicePrimaryCtxReset ( hipDevice_t dev )
|
||||
{
|
||||
HIP_INIT_API(dev);
|
||||
hipError_t e = hipSuccess;
|
||||
auto deviceHandle = ihipGetDevice(dev);
|
||||
|
||||
if (deviceHandle == NULL) {
|
||||
e = hipErrorInvalidDevice;
|
||||
}
|
||||
ihipCtx_t* primaryCtx = deviceHandle->_primaryCtx;
|
||||
primaryCtx->locked_reset();
|
||||
return ihipLogStatus(e);
|
||||
}
|
||||
|
||||
hipError_t hipDevicePrimaryCtxSetFlags ( hipDevice_t dev, unsigned int flags )
|
||||
{
|
||||
HIP_INIT_API(dev, flags);
|
||||
hipError_t e = hipSuccess;
|
||||
auto deviceHandle = ihipGetDevice(dev);
|
||||
|
||||
if (deviceHandle == NULL) {
|
||||
e = hipErrorInvalidDevice;
|
||||
} else {
|
||||
e = hipErrorContextAlreadyInUse;
|
||||
}
|
||||
return ihipLogStatus(e);
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user