2
0

Add initial context implementation.

APIs: hipInit, hipCtxCreate.
Track TLS default ctx.  Set deviceID now changes the ctx.
Add first context test.

Change-Id: If1cb9989b5a04a36147e25e84904336c7b6f3d88
Este cometimento está contido em:
Ben Sander
2016-08-08 17:49:02 -05:00
ascendente ed0a2c02fe
cometimento 8f402132ba
9 ficheiros modificados com 201 adições e 36 eliminações
+8 -7
Ver ficheiro
@@ -28,11 +28,11 @@ THE SOFTWARE.
/**
* @return #hipSuccess
*/
hipError_t hipGetDevice(int *device)
hipError_t hipGetDevice(int *deviceId)
{
HIP_INIT_API(device);
HIP_INIT_API(deviceId);
*device = tls_defaultDevice;
*deviceId = tls_defaultDeviceId;
return ihipLogStatus(hipSuccess);
}
@@ -130,13 +130,14 @@ hipError_t hipDeviceGetSharedMemConfig ( hipSharedMemConfig * pConfig )
/**
* @return #hipSuccess, #hipErrorInvalidDevice
*/
hipError_t hipSetDevice(int device)
hipError_t hipSetDevice(int deviceId)
{
HIP_INIT_API(device);
if ((device < 0) || (device >= g_deviceCnt)) {
HIP_INIT_API(deviceId);
if ((deviceId < 0) || (deviceId >= g_deviceCnt)) {
return ihipLogStatus(hipErrorInvalidDevice);
} else {
tls_defaultDevice = device;
tls_defaultDeviceId = deviceId;
tls_defaultCtx = ihipGetPrimaryCtx(deviceId);
return ihipLogStatus(hipSuccess);
}
}