P4 to Git Change 1738965 by cpaquot@cpaquot-ocl-lc-lnx on 2019/02/01 13:17:10
SWDEV-145570 - [HIP] Handle multi device setup Affected files ... ... //depot/stg/opencl/drivers/opencl/api/hip/hip_device_runtime.cpp#13 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_internal.hpp#21 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_platform.cpp#21 edit
This commit is contained in:
@@ -391,21 +391,27 @@ hipError_t hipDeviceSynchronize ( void ) {
|
||||
HIP_RETURN(hipSuccess);
|
||||
}
|
||||
|
||||
int ihipGetDevice() {
|
||||
for (unsigned int i = 0; i < g_devices.size(); i++) {
|
||||
if (g_devices[i] == hip::getCurrentContext()) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
assert(0 && "Current device not found?!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
hipError_t hipGetDevice ( int* deviceId ) {
|
||||
HIP_INIT_API(deviceId);
|
||||
|
||||
if (deviceId != nullptr) {
|
||||
for (unsigned int i = 0; i < g_devices.size(); i++) {
|
||||
if (g_devices[i] == hip::getCurrentContext()) {
|
||||
*deviceId = i;
|
||||
HIP_RETURN(hipSuccess);
|
||||
}
|
||||
}
|
||||
int dev = ihipGetDevice();
|
||||
assert(dev != -1);
|
||||
*deviceId = dev;
|
||||
HIP_RETURN(hipSuccess);
|
||||
} else {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
HIP_RETURN(hipErrorUnknown);
|
||||
}
|
||||
|
||||
hipError_t hipGetDeviceCount ( int* count ) {
|
||||
|
||||
Reference in New Issue
Block a user