Added further hipCtxXXX Apis

Change-Id: I286d962a06cee656c1c652b3f6b45078587fbc41
This commit is contained in:
Rahul Garg
2016-08-17 16:28:22 +05:30
parent a3cb0f37c4
commit 96de030c2d
2 changed files with 93 additions and 32 deletions
@@ -1070,6 +1070,16 @@ hipError_t hipCtxGetCurrent(hipCtx_t* ctx);
hipError_t hipCtxGetDevice(hipDevice_t *device); hipError_t hipCtxGetDevice(hipDevice_t *device);
hipError_t hipCtxGetApiVersion (hipCtx_t ctx,int *apiVersion);
hipError_t hipCtxGetCacheConfig ( hipFuncCache *cacheConfig );
hipError_t hipCtxSetCacheConfig ( hipFuncCache cacheConfig );
hipError_t hipCtxSetSharedMemConfig ( hipSharedMemConfig config );
hipError_t hipCtxGetSharedMemConfig ( hipSharedMemConfig * pConfig );
// TODO-ctx // TODO-ctx
/** /**
* @return hipSuccess, hipErrorInvalidDevice * @return hipSuccess, hipErrorInvalidDevice
+55 -4
View File
@@ -103,15 +103,19 @@ hipError_t hipCtxDestroy(hipCtx_t ctx)
hipError_t hipCtxPopCurrent(hipCtx_t* ctx) hipError_t hipCtxPopCurrent(hipCtx_t* ctx)
{ {
hipError_t e = hipSuccess; hipError_t e = hipSuccess;
tls_ctxStack.pop(); ihipCtx_t* tempCtx;
*ctx = ihipGetTlsDefaultCtx();
if(!tls_ctxStack.empty()) { if(!tls_ctxStack.empty()) {
*ctx= tls_ctxStack.top(); tls_ctxStack.pop();
}
if(!tls_ctxStack.empty()) {
tempCtx= tls_ctxStack.top();
} }
else { else {
*ctx = nullptr; tempCtx = nullptr;
} }
ihipSetTlsDefaultCtx(*ctx); //TOD0 - Shall check for NULL? ihipSetTlsDefaultCtx(tempCtx); //TOD0 - Shall check for NULL?
return ihipLogStatus(e); return ihipLogStatus(e);
} }
@@ -166,3 +170,50 @@ hipError_t hipCtxGetDevice(hipDevice_t *device)
} }
return ihipLogStatus(e); return ihipLogStatus(e);
} }
hipError_t hipCtxGetApiVersion (hipCtx_t ctx,int *apiVersion)
{
HIP_INIT_API(apiVersion);
if (apiVersion) {
*apiVersion = 4;
}
return ihipLogStatus(hipSuccess);
}
hipError_t hipCtxGetCacheConfig ( hipFuncCache *cacheConfig )
{
HIP_INIT_API(cacheConfig);
*cacheConfig = hipFuncCachePreferNone;
return ihipLogStatus(hipSuccess);
}
hipError_t hipCtxSetCacheConfig ( hipFuncCache cacheConfig )
{
HIP_INIT_API(cacheConfig);
// Nop, AMD does not support variable cache configs.
return ihipLogStatus(hipSuccess);
}
hipError_t hipCtxSetSharedMemConfig ( hipSharedMemConfig config )
{
HIP_INIT_API(config);
// Nop, AMD does not support variable shared mem configs.
return ihipLogStatus(hipSuccess);
}
hipError_t hipCtxGetSharedMemConfig ( hipSharedMemConfig * pConfig )
{
HIP_INIT_API(pConfig);
*pConfig = hipSharedMemBankSizeFourByte;
return ihipLogStatus(hipSuccess);
}