Update error codes for hipGetDevice for doxygen and move up null check (#1668)
* [docs] Update error codes for hipGetDevice
* Move up out ptr check
[ROCm/clr commit: 13c2a31d7e]
이 커밋은 다음에 포함됨:
1 부모
29bb65f6e0
커밋
81dd3751a6
2 파일이 변경됨
+7
-9
검색과 일치하는 파일 없음
@@ -391,7 +391,7 @@ hipError_t hipSetDevice(int deviceId);
|
||||
* This device is used implicitly for HIP runtime APIs called by this thread.
|
||||
* hipGetDevice returns in * @p device the default device for the calling host thread.
|
||||
*
|
||||
* @returns #hipSuccess
|
||||
* @returns #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue
|
||||
*
|
||||
* @see hipSetDevice, hipGetDevicesizeBytes
|
||||
*/
|
||||
|
||||
@@ -33,18 +33,16 @@ hipError_t hipGetDevice(int* deviceId) {
|
||||
HIP_INIT_API(hipGetDevice, deviceId);
|
||||
|
||||
hipError_t e = hipSuccess;
|
||||
if (deviceId == nullptr)
|
||||
return ihipLogStatus(hipErrorInvalidValue);
|
||||
|
||||
auto ctx = ihipGetTlsDefaultCtx();
|
||||
|
||||
if (deviceId != nullptr) {
|
||||
if (ctx == nullptr) {
|
||||
e = hipErrorInvalidDevice; // TODO, check error code.
|
||||
*deviceId = -1;
|
||||
} else {
|
||||
*deviceId = ctx->getDevice()->_deviceId;
|
||||
}
|
||||
if (ctx == nullptr) {
|
||||
e = hipErrorInvalidDevice; // TODO, check error code.
|
||||
*deviceId = -1;
|
||||
} else {
|
||||
e = hipErrorInvalidValue;
|
||||
*deviceId = ctx->getDevice()->_deviceId;
|
||||
}
|
||||
|
||||
return ihipLogStatus(e);
|
||||
|
||||
새 이슈에서 참조
사용자 차단