From 1a4364558ab6e874ee3b339774c68a9b29fcd09d Mon Sep 17 00:00:00 2001
From: foreman
Date: Wed, 7 Aug 2019 11:44:31 -0400
Subject: [PATCH] P4 to Git Change 1979482 by zukhan@zukhan-ocl-win10 on
2019/08/07 11:30:33
SWDEV-196326 - [hipclang-vdi-rocm]: [FBA-80]: Runtime error when all GPUs are hidden by ROCR_VISIBLE_DEVICES
- Adjusted hipGetDeviceCount to return "hipErrorNoDevice".
- This was done to match the same behaviour as HIP-HCC, and API spec for when no devices are found. Rather then return "count = 0" as it did.
ReviewBoardURL = http://ocltc.amd.com/reviews/r/17789/diff/
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/hip/hip_device.cpp#22 edit
[ROCm/hip commit: 7f0373f2e3ef8688053724be677232b527447b24]
---
projects/hip/api/hip/hip_device.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/projects/hip/api/hip/hip_device.cpp b/projects/hip/api/hip/hip_device.cpp
index dc63666876..010e46a33b 100644
--- a/projects/hip/api/hip/hip_device.cpp
+++ b/projects/hip/api/hip/hip_device.cpp
@@ -99,6 +99,10 @@ hipError_t ihipDeviceGetCount(int* count) {
// Get all available devices
*count = g_devices.size();
+ if (*count < 1) {
+ return hipErrorNoDevice;
+ }
+
return hipSuccess;
}