SWDEV-485866 - Return OOM if stream creation fails due to insufficient memory.

Change-Id: I4e57ecc81921bde274bb6a4e0890f0fc6a17955a
This commit is contained in:
Jaydeep Patel
2024-09-19 06:59:43 +00:00
committed by Jaydeepkumar Patel
parent b977101893
commit 5ccc140e1b
4 changed files with 11 additions and 3 deletions
+4
View File
@@ -36,6 +36,10 @@ hip::Stream* Device::NullStream(bool wait) {
amd::ScopedLock lock(lock_);
if (null_stream_ == nullptr) {
null_stream_ = new Stream(this, Stream::Priority::Normal, 0, true);
// Stream creation might be failed from rcor and in that case, vdev is null.
if (null_stream_->vdev() == nullptr) {
Stream::Destroy(null_stream_);
}
}
}
if (null_stream_ == nullptr) {
+1
View File
@@ -3328,6 +3328,7 @@ hipError_t ihipMemset(void* dst, int64_t value, size_t valueSize, size_t sizeByt
}
std::vector<amd::Command*> commands;
hip::Stream* hip_stream = hip::getStream(stream);
if (hip_stream == nullptr) { return hipErrorOutOfMemory; }
hip_error = ihipMemsetCommand(commands, dst, value, valueSize, sizeBytes, hip_stream);
if (hip_error != hipSuccess) {
break;
+1
View File
@@ -75,6 +75,7 @@ bool Stream::Create() {
void Stream::Destroy(hip::Stream* stream) {
stream->device_->RemoveStream(stream);
stream->release();
stream = nullptr;
}
// ================================================================================================