Skip to content

Commit da138cc

Browse files
authored
[SYCL][ROCm] Fix rocm_piPlatformsGet when there are no devices (#4314)
hipGetDeviceCount returns the hipErrorNoDevice error when there are no available devices. Instead of treating it as a PI error, we now properly report that the platform is not available.
1 parent afd59c6 commit da138cc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sycl/plugins/rocm/pi_rocm.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,12 @@ pi_result rocm_piPlatformsGet(pi_uint32 num_entries, pi_platform *platforms,
696696
return;
697697
}
698698
int numDevices = 0;
699-
err = PI_CHECK_ERROR(hipGetDeviceCount(&numDevices));
699+
hipError_t hipErrorCode = hipGetDeviceCount(&numDevices);
700+
if (hipErrorCode == hipErrorNoDevice) {
701+
numPlatforms = 0;
702+
return;
703+
}
704+
err = PI_CHECK_ERROR(hipErrorCode);
700705
if (numDevices == 0) {
701706
numPlatforms = 0;
702707
return;

0 commit comments

Comments
 (0)