Change ihipDevice_t -> ihipCtx_t (new)
Change ihipGetTlsDefaultDevice->ihipGetTlsDefaultCtx
Some other changes from device->ctx where appropriate.

Change-Id: I5c4ae93b2fd42c6303aa23d748eb166b7431925d
Этот коммит содержится в:
Ben Sander
2016-08-07 21:46:51 -05:00
родитель 3c604b6430
Коммит 0d16565061
7 изменённых файлов: 163 добавлений и 155 удалений
+11 -11
Просмотреть файл
@@ -30,8 +30,8 @@ THE SOFTWARE.
//---
hipError_t ihipStreamCreate(hipStream_t *stream, unsigned int flags)
{
ihipDevice_t *device = ihipGetTlsDefaultDevice();
hc::accelerator acc = device->_acc;
ihipCtx_t *ctx = ihipGetTlsDefaultCtx();
hc::accelerator acc = ctx->_acc;
// TODO - se try-catch loop to detect memory exception?
//
@@ -39,9 +39,9 @@ hipError_t ihipStreamCreate(hipStream_t *stream, unsigned int flags)
//Note this is an execute_in_order queue, so all kernels submitted will atuomatically wait for prev to complete:
//This matches CUDA stream behavior:
auto istream = new ihipStream_t(device->_device_index, acc.create_view(), flags);
auto istream = new ihipStream_t(ctx, acc.create_view(), flags);
device->locked_addStream(istream);
ctx->locked_addStream(istream);
*stream = istream;
tprintf(DB_SYNC, "hipStreamCreate, stream=%p\n", *stream);
@@ -98,8 +98,8 @@ hipError_t hipStreamSynchronize(hipStream_t stream)
hipError_t e = hipSuccess;
if (stream == NULL) {
ihipDevice_t *device = ihipGetTlsDefaultDevice();
device->locked_syncDefaultStream(true/*waitOnSelf*/);
ihipCtx_t *ctx = ihipGetTlsDefaultCtx();
ctx->locked_syncDefaultStream(true/*waitOnSelf*/);
} else {
stream->locked_wait();
e = hipSuccess;
@@ -122,17 +122,17 @@ hipError_t hipStreamDestroy(hipStream_t stream)
//--- Drain the stream:
if (stream == NULL) {
ihipDevice_t *device = ihipGetTlsDefaultDevice();
device->locked_syncDefaultStream(true/*waitOnSelf*/);
ihipCtx_t *ctx = ihipGetTlsDefaultCtx();
ctx->locked_syncDefaultStream(true/*waitOnSelf*/);
} else {
stream->locked_wait();
e = hipSuccess;
}
ihipDevice_t *device = stream->getDevice();
ihipCtx_t *ctx = stream->getDevice();
if (device) {
device->locked_removeStream(stream);
if (ctx) {
ctx->locked_removeStream(stream);
delete stream;
} else {
e = hipErrorInvalidResourceHandle;