Fixed hipDeviceGetPCIBusId for HIP/HCC

Change-Id: I3688fa2476e1baada2d3c5fc3735cec3f15a1e21
Este commit está contenido en:
Rahul Garg
2017-06-28 23:48:27 +05:30
padre c782c68b1f
commit a7c727f352
Se han modificado 3 ficheros con 6 adiciones y 10 borrados
+4 -9
Ver fichero
@@ -376,15 +376,10 @@ hipError_t hipDeviceGetPCIBusId (char *pciBusId,int len, int device)
e = hipErrorInvalidDevice;
} else {
if((pciBusId != nullptr) && (len > 0)) {
int tempPciBusId = 0;
e = ihipDeviceGetAttribute( &tempPciBusId, hipDeviceAttributePciBusId, device);
if( e == hipSuccess) {
std::string tempPciStr = std::to_string(tempPciBusId);
if( len < tempPciStr.length()){
e = hipErrorInvalidValue;
} else {
memcpy( pciBusId , tempPciStr.c_str() , tempPciStr.length() );
}
auto deviceHandle = ihipGetDevice(device);
int retVal = snprintf(pciBusId,len, "%04x:%02x:%02x.0",deviceHandle->_props.pciDomainID,deviceHandle->_props.pciBusID,deviceHandle->_props.pciDeviceID);
if( retVal > 0 && retVal < len) {
e = hipSuccess;
}
}
}