P4 to Git Change 1548476 by cpaquot@cpaquot-ocl-lc-lnx on 2018/05/01 15:50:51
SWDEV-145570 - [HIP] Added support for null stream avoiding creating/destroying dummy streams. Added basic event class for hipEvent* support. Refactored some common functionality: No more direct access to g_context. Support hipStreamSynchronize(0). Affected files ... ... //depot/stg/opencl/drivers/opencl/api/hip/hip_context.cpp#9 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_device_runtime.cpp#7 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_event.cpp#3 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_event.hpp#1 add ... //depot/stg/opencl/drivers/opencl/api/hip/hip_internal.hpp#8 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_memory.cpp#15 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_module.cpp#8 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_platform.cpp#9 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_stream.cpp#4 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_texture.cpp#7 edit
Tá an tiomantas seo le fáil i:
@@ -94,13 +94,13 @@ hipError_t hipModuleLoadData(hipModule_t *module, const void *image)
|
||||
|
||||
hipError_t ihipModuleLoadData(hipModule_t *module, const void *image)
|
||||
{
|
||||
amd::Program* program = new amd::Program(*g_context);
|
||||
amd::Program* program = new amd::Program(*hip::getCurrentContext());
|
||||
if (program == NULL) {
|
||||
return hipErrorOutOfMemory;
|
||||
}
|
||||
|
||||
if (CL_SUCCESS != program->addDeviceProgram(*g_context->devices()[0], image, ElfSize(image)) ||
|
||||
CL_SUCCESS != program->build(g_context->devices(), nullptr, nullptr, nullptr)) {
|
||||
if (CL_SUCCESS != program->addDeviceProgram(*hip::getCurrentContext()->devices()[0], image, ElfSize(image)) ||
|
||||
CL_SUCCESS != program->build(hip::getCurrentContext()->devices(), nullptr, nullptr, nullptr)) {
|
||||
return hipErrorUnknown;
|
||||
}
|
||||
|
||||
@@ -142,13 +142,11 @@ hipError_t hipModuleLaunchKernel(hipFunction_t f,
|
||||
kernelParams, extra);
|
||||
|
||||
amd::Kernel* kernel = as_amd(reinterpret_cast<cl_kernel>(f));
|
||||
amd::Device* device = g_context->devices()[0];
|
||||
amd::Device* device = hip::getCurrentContext()->devices()[0];
|
||||
|
||||
amd::HostQueue* queue;
|
||||
if (hStream == nullptr) {
|
||||
queue = new amd::HostQueue(*g_context, *device, 0,
|
||||
amd::CommandQueue::RealTimeDisabled,
|
||||
amd::CommandQueue::Priority::Normal);
|
||||
queue = hip::getNullStream();
|
||||
} else {
|
||||
queue = as_amd(reinterpret_cast<cl_command_queue>(hStream))->asHostQueue();
|
||||
}
|
||||
@@ -200,10 +198,6 @@ hipError_t hipModuleLaunchKernel(hipFunction_t f,
|
||||
command->awaitCompletion();
|
||||
command->release();
|
||||
|
||||
if (hStream == nullptr) {
|
||||
queue->release();
|
||||
}
|
||||
|
||||
return hipSuccess;
|
||||
}
|
||||
|
||||
|
||||
Tagairt in Eagrán Nua
Cuir bac ar úsáideoir