P4 to Git Change 1264764 by wchau@wchau_WIN_OCL_HSA on 2016/05/03 16:46:02

SWDEV-93075 - [OCL] Access violation in clCreateContext() in amdocl.dll when DX9 and DX11 devices are used.  Add support for multiple external devices for context creation to make sure the devices are initialized with proper type.

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_context.cpp#50 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_d3d10.cpp#12 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_d3d11.cpp#19 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_d3d9.cpp#29 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpudevice.hpp#95 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#274 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#547 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.hpp#160 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpumemory.cpp#128 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsadevice.cpp#62 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsadevice.hpp#30 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#4 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.hpp#5 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palmemory.cpp#3 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/context.cpp#41 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/context.hpp#25 edit
Ta zmiana jest zawarta w:
%! (template.HTML=foreman)złożyło 2016-05-03 17:00:14 -04:00
1 rodzic 0c54d874fb
złożenie 77a1f244b2
4 plików zmienionych
+24 -8

Żadne pliki nie pasują do Twojego wyszukiwania

+5 -5
Wyświetl plik
@@ -360,7 +360,7 @@ RUNTIME_ENTRY(cl_int, clGetContextInfo, (
*not_null(param_value_size_ret) = sizeof(intptr_t);
if (param_value != NULL) {
*(intptr_t*) param_value =
reinterpret_cast<intptr_t>(amdContext->info().hDev_);
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D10DeviceKhrIdx]);
}
return CL_SUCCESS;
}
@@ -387,7 +387,7 @@ RUNTIME_ENTRY(cl_int, clGetContextInfo, (
*not_null(param_value_size_ret) = sizeof(intptr_t);
if (param_value != NULL) {
*(intptr_t*) param_value =
reinterpret_cast<intptr_t>(amdContext->info().hDev_);
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D11DeviceKhrIdx]);
}
return CL_SUCCESS;
}
@@ -412,7 +412,7 @@ RUNTIME_ENTRY(cl_int, clGetContextInfo, (
*not_null(param_value_size_ret) = sizeof(intptr_t);
if (param_value != NULL) {
*(intptr_t*) param_value =
reinterpret_cast<intptr_t>(amdContext->info().hDev_);
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D9DeviceKhrIdx]);
}
return CL_SUCCESS;
}
@@ -427,7 +427,7 @@ RUNTIME_ENTRY(cl_int, clGetContextInfo, (
*not_null(param_value_size_ret) = sizeof(intptr_t);
if (param_value != NULL) {
*(intptr_t*) param_value =
reinterpret_cast<intptr_t>(amdContext->info().hDev_);
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D9DeviceEXKhrIdx]);
}
return CL_SUCCESS;
}
@@ -442,7 +442,7 @@ RUNTIME_ENTRY(cl_int, clGetContextInfo, (
*not_null(param_value_size_ret) = sizeof(intptr_t);
if (param_value != NULL) {
*(intptr_t*) param_value =
reinterpret_cast<intptr_t>(amdContext->info().hDev_);
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D9DeviceVAKhrIdx]);
}
return CL_SUCCESS;
}
+5 -1
Wyświetl plik
@@ -113,11 +113,15 @@ RUNTIME_ENTRY(cl_int, clGetDeviceIDsFromD3D10KHR, (
break;
}
void * external_device[amd::Context::DeviceFlagIdx::LastDeviceFlagIdx] = {};
external_device[amd::Context::DeviceFlagIdx::D3D10DeviceKhrIdx] = d3d10_device;
std::vector<amd::Device*> compatible_devices;
for (cl_uint i = 0; i < num_gpu_devices; ++i) {
cl_device_id device = gpu_devices[i];
if (is_valid(device) &&
as_amd(device)->bindExternalDevice(amd::Context::Flags::D3D10DeviceKhr, d3d10_device, NULL, VALIDATE_ONLY)) {
as_amd(device)->bindExternalDevice(amd::Context::Flags::D3D10DeviceKhr,
external_device, NULL, VALIDATE_ONLY)) {
compatible_devices.push_back(as_amd(device));
}
}
+6 -1
Wyświetl plik
@@ -117,9 +117,14 @@ RUNTIME_ENTRY(cl_int, clGetDeviceIDsFromD3D11KHR, (
std::vector<amd::Device*> compatible_devices;
for (cl_uint i = 0; i < num_gpu_devices; ++i) {
void * external_device[amd::Context::DeviceFlagIdx::LastDeviceFlagIdx] = {};
external_device[amd::Context::DeviceFlagIdx::D3D11DeviceKhrIdx] = d3d11_device;
cl_device_id device = gpu_devices[i];
if (is_valid(device) &&
as_amd(device)->bindExternalDevice(amd::Context::Flags::D3D11DeviceKhr, d3d11_device, NULL, VALIDATE_ONLY)) {
as_amd(device)->bindExternalDevice(amd::Context::Flags::D3D11DeviceKhr,
external_device, NULL, VALIDATE_ONLY)) {
compatible_devices.push_back(as_amd(device));
}
}
+8 -1
Wyświetl plik
@@ -70,23 +70,30 @@ RUNTIME_ENTRY(cl_int, clGetDeviceIDsFromDX9MediaAdapterKHR, (
for (cl_uint i = 0; i < num_gpu_devices; ++i) {
cl_device_id device = gpu_devices[i];
amd::Context::Flags context_flag;
amd::Context::DeviceFlagIdx devIdx;
switch (media_adapters_type[i]) {
case CL_ADAPTER_D3D9_KHR:
context_flag = amd::Context::Flags::D3D9DeviceKhr;
devIdx = amd::Context::DeviceFlagIdx::D3D9DeviceKhrIdx;
break;
case CL_ADAPTER_D3D9EX_KHR:
context_flag = amd::Context::Flags::D3D9DeviceEXKhr;
devIdx = amd::Context::DeviceFlagIdx::D3D9DeviceEXKhrIdx;
break;
case CL_ADAPTER_DXVA_KHR:
context_flag = amd::Context::Flags::D3D9DeviceVAKhr;
devIdx = amd::Context::DeviceFlagIdx::D3D9DeviceVAKhrIdx;
break;
}
for (cl_uint j = 0; j < num_media_adapters; ++j) {
//Since there can be multiple DX9 adapters passed in the array we need to validate interopability with each.
void * external_device[amd::Context::DeviceFlagIdx::LastDeviceFlagIdx] = {};
external_device[devIdx] = d3d9_device[j];
if (is_valid(device) && (media_adapters_type[j] == CL_ADAPTER_D3D9EX_KHR) &&
as_amd(device)->bindExternalDevice(context_flag,
d3d9_device[j], NULL, VALIDATE_ONLY)) {
external_device, NULL, VALIDATE_ONLY)) {
compatible_devices.push_back(as_amd(device));
}
}