P4 to Git Change 1431618 by jatang@jatang-opencl-hsa-stg1 on 2017/07/07 16:47:09

SWDEV-126057 - Fix a segfault of libamdocl-rocr64.so when there's no vega10 is in the system.

	When there's no supported device, Device::devices_ is not created. So we add a check.

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#56 edit


[ROCm/clr commit: a00fa77a6e]
This commit is contained in:
foreman
2017-07-07 17:29:57 -04:00
والد a579ef4c46
کامیت 59fcaf4821
@@ -512,15 +512,17 @@ bool Device::init() {
}
}
// Loop through all available devices
for (auto device1: Device::devices()) {
// Find all agents that can have access to the current device
for (auto agent: static_cast<Device*>(device1)->p2pAgents()) {
// Find cl_device_id associated with the current agent
for (auto device2: Device::devices()) {
if (agent.handle == static_cast<Device*>(device2)->getBackendDevice().handle) {
// Device2 can have access to device1
device2->p2pDevices_.push_back(as_cl(device1));
if (0 != Device::numDevices(CL_DEVICE_TYPE_GPU, false)) {
// Loop through all available devices
for (auto device1: Device::devices()) {
// Find all agents that can have access to the current device
for (auto agent: static_cast<Device*>(device1)->p2pAgents()) {
// Find cl_device_id associated with the current agent
for (auto device2: Device::devices()) {
if (agent.handle == static_cast<Device*>(device2)->getBackendDevice().handle) {
// Device2 can have access to device1
device2->p2pDevices_.push_back(as_cl(device1));
}
}
}
}