P4 to Git Change 1534050 by lmoriche@lmoriche_opencl_dev2 on 2018/03/28 19:09:26

SWDEV-145570 - Add support for clang offload bundles

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/hip/hip_context.cpp#5 edit
... //depot/stg/opencl/drivers/opencl/api/hip/hip_internal.hpp#6 edit
... //depot/stg/opencl/drivers/opencl/api/hip/hip_platform.cpp#3 edit
Этот коммит содержится в:
foreman
2018-03-28 19:23:57 -04:00
родитель a2b71e69ef
Коммит 01c8c585f4
3 изменённых файлов: 116 добавлений и 33 удалений
+13 -5
Просмотреть файл
@@ -25,16 +25,16 @@ THE SOFTWARE.
#include "platform/runtime.hpp"
#include "utils/versions.hpp"
#include <stack>
#include <thread>
thread_local amd::Context* g_context = nullptr;
thread_local std::stack<amd::Context*> g_ctxtStack;
std::vector<amd::Context*> g_devices;
std::once_flag g_ihipInitialized;
hipError_t hipInit(unsigned int flags)
void ihipInit()
{
HIP_INIT_API(flags);
if (!amd::Runtime::initialized()) {
amd::Runtime::init();
}
@@ -44,18 +44,26 @@ hipError_t hipInit(unsigned int flags)
for (unsigned int i=0; i<devices.size(); i++) {
const std::vector<amd::Device*> device(1, devices[i]);
amd::Context* context = new amd::Context(device, amd::Context::Info());
if (!context) return hipErrorOutOfMemory;
if (!context) return;
if (context && CL_SUCCESS != context->create(nullptr)) {
context->release();
} else {
g_devices.push_back(context);
g_context = context;
}
}
}
hipError_t hipInit(unsigned int flags)
{
HIP_INIT_API(flags);
return hipSuccess;
}
hipError_t hipCtxCreate(hipCtx_t *ctx, unsigned int flags, hipDevice_t device)
{
HIP_INIT_API(ctx, flags, device);
@@ -171,4 +179,4 @@ hipError_t hipCtxPushCurrent(hipCtx_t ctx)
g_ctxtStack.push(g_context);
return hipSuccess;
}
}