SWDEV-283515 - Fix crashing in kernel launch on MGPUS

Fix wrong mixing of current device and stream device in
ihipModuleLaunchKernel() and hipLaunchCooperativeKernel().

Fix missing hipSetDevice() in hipMemcpyWithStream* tests.

Change-Id: I09333bb40d239bb42c832df5ea16d17eeaeff5e7
This commit is contained in:
Tao Sang
2021-04-27 19:03:22 -04:00
committed by Tao Sang
parent 6b14050424
commit a95ff95bf7
7 changed files with 25 additions and 20 deletions
+1 -7
View File
@@ -621,14 +621,8 @@ hipError_t ihipLaunchKernel(const void* hostFunction,
hipEvent_t stopEvent,
int flags)
{
hip::Stream* s = reinterpret_cast<hip::Stream*>(stream);
int deviceId = (s != nullptr)? s->DeviceId() : ihipGetDevice();
if (deviceId == -1) {
LogPrintfError("Wrong Device Id: %d \n", deviceId);
HIP_RETURN(hipErrorNoDevice);
}
hipFunction_t func = nullptr;
int deviceId = hip::Stream::DeviceId(stream);
hipError_t hip_error = PlatformState::instance().getStatFunc(&func, hostFunction, deviceId);
if ((hip_error != hipSuccess) || (func == nullptr)) {
HIP_RETURN(hipErrorInvalidDeviceFunction);