SWDEV-311271 - Avoid a crash with the default queue

Move device access after the queue look-up

Change-Id: I799f23ff0299b20437c9a8edae42c38daa3e9ceb
Цей коміт міститься в:
German Andryeyev
2022-07-07 13:05:35 -04:00
джерело 9eb45dd1e0
коміт ff23c5b716
+2 -2
Переглянути файл
@@ -61,10 +61,10 @@ hipError_t hipMallocAsync(void** dev_ptr, size_t size, hipStream_t stream) {
if ((dev_ptr == nullptr) || (size == 0) || (!hip::isValid(stream))) {
HIP_RETURN(hipErrorInvalidValue);
}
auto device = reinterpret_cast<hip::Stream*>(stream)->GetDevice();
auto mem_pool = device->GetCurrentMemoryPool();
auto hip_stream = (stream == nullptr) ? hip::getCurrentDevice()->GetNullStream() :
reinterpret_cast<hip::Stream*>(stream);
auto device = hip_stream->GetDevice();
auto mem_pool = device->GetCurrentMemoryPool();
*dev_ptr = reinterpret_cast<hip::MemoryPool*>(mem_pool)->AllocateMemory(size, hip_stream);
HIP_RETURN(hipSuccess);
}