SWDEV-372153 - Add hipStreamGetDevice Implementation

Change-Id: Ifd1f13e311e8221ca6d94cf27f9131eb97678067


[ROCm/clr commit: a7049bf7a0]
This commit is contained in:
Jatin Chaudhary
2023-01-17 10:40:05 +00:00
committed by Jatin Jaikishan Chaudhary
parent 37769589f3
commit 2bcde46b12
6 changed files with 66 additions and 1 deletions
+1
View File
@@ -193,6 +193,7 @@ hipStreamCreate
hipStreamCreateWithFlags
hipStreamCreateWithPriority
hipStreamDestroy
hipStreamGetDevice
hipStreamGetFlags
hipStreamQuery
hipStreamSynchronize
+1
View File
@@ -194,6 +194,7 @@ hipStreamCreate
hipStreamCreateWithFlags
hipStreamCreateWithPriority
hipStreamDestroy
hipStreamGetDevice
hipStreamGetFlags
hipStreamQuery
hipStreamSynchronize
+1
View File
@@ -169,6 +169,7 @@ global:
hipStreamCreateWithFlags;
hipStreamCreateWithPriority;
hipStreamDestroy;
hipStreamGetDevice;
hipStreamGetFlags;
hipStreamQuery;
hipStreamSynchronize;
+24
View File
@@ -795,3 +795,27 @@ hipError_t hipExtStreamGetCUMask(hipStream_t stream, uint32_t cuMaskSize, uint32
}
HIP_RETURN(hipSuccess);
}
// ================================================================================================
hipError_t hipStreamGetDevice(hipStream_t stream, hipDevice_t* device) {
HIP_INIT_API(hipStreamGetDevice, stream, device);
if (device == nullptr) {
HIP_RETURN(hipErrorInvalidValue);
}
if (!hip::isValid(stream)) {
return HIP_RETURN(hipErrorContextIsDestroyed);
}
if (stream == nullptr) { // handle null stream
// null stream is associated with current device, return the device id associated with the
// current device
*device = hip::getCurrentDevice()->deviceId();
} else {
getStreamPerThread(stream);
*device = reinterpret_cast<hip::Stream*>(stream)->DeviceId();
}
HIP_RETURN(hipSuccess);
}