SWDEV-452364 - Check if no GPUs are available when hsa_init fails
* When no GPUs are available, hsa_init fails with HSA_STATUS_ERROR_OUT_OF_RESOURCES, and device and runtime initialization fails. In order for NoGpu tests to pass, true needs to be returned which will cause HIP_INIT_API to return proper error hipErrorNoDevice instead of hipErrorInvalidDevice. Change-Id: I982d4416c92ed1b36893354d8b10d73df34f2478
Este commit está contenido en:
cometido por
Maneesh Gupta
padre
d543ab6a0b
commit
fdaa7141af
@@ -475,6 +475,15 @@ bool Device::init() {
|
||||
}
|
||||
|
||||
status = hsa_init();
|
||||
|
||||
// If there are no GPUs available, hsa_init will fail with HSA_STATUS_ERROR_OUT_OF_RESOURCES
|
||||
// but for NoGpu tests to pass, true needs to be returned
|
||||
constexpr bool kNoOfflineDevices = false;
|
||||
std::vector<amd::Device*> devices = getDevices(CL_DEVICE_TYPE_GPU, kNoOfflineDevices);
|
||||
if (status == HSA_STATUS_ERROR_OUT_OF_RESOURCES && devices.size() == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (status != HSA_STATUS_SUCCESS) {
|
||||
LogPrintfError("hsa_init failed with %x", status);
|
||||
return false;
|
||||
@@ -577,8 +586,7 @@ bool Device::init() {
|
||||
}
|
||||
|
||||
// Query active devices only
|
||||
constexpr bool kNoOfflineDevices = false;
|
||||
std::vector<amd::Device*> devices = getDevices(CL_DEVICE_TYPE_GPU, kNoOfflineDevices);
|
||||
devices = getDevices(CL_DEVICE_TYPE_GPU, kNoOfflineDevices);
|
||||
if (devices.size() > 0) {
|
||||
bool p2p_available = false;
|
||||
// Loop through all available devices
|
||||
|
||||
Referencia en una nueva incidencia
Block a user