SWDEV-372153 - Add hipStreamGetDevice Implementation
Change-Id: Ifd1f13e311e8221ca6d94cf27f9131eb97678067
This commit is contained in:
committed by
Jatin Jaikishan Chaudhary
parent
3fc34b8bf5
commit
8ce9ec60f8
@@ -2507,6 +2507,20 @@ inline static hipError_t hipStreamAddCallback(hipStream_t stream, hipStreamCallb
|
||||
cudaStreamAddCallback(stream, (cudaStreamCallback_t)callback, userData, flags));
|
||||
}
|
||||
|
||||
inline static hipError_t hipStreamGetDevice(hipStream_t stream, hipDevice_t* device) {
|
||||
hipCtx_t context;
|
||||
auto err = hipCUResultTohipError(cuStreamGetCtx(stream, &context));
|
||||
if (err != hipSuccess) return err;
|
||||
|
||||
err = hipCUResultTohipError(cuCtxPushCurrent(context));
|
||||
if (err != hipSuccess) return err;
|
||||
|
||||
err = hipCUResultTohipError(cuCtxGetDevice(device));
|
||||
if (err != hipSuccess) return err;
|
||||
|
||||
return hipCUResultTohipError(cuCtxPopCurrent(&context));
|
||||
}
|
||||
|
||||
inline static hipError_t hipDriverGetVersion(int* driverVersion) {
|
||||
return hipCUDAErrorTohipError(cudaDriverGetVersion(driverVersion));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user