Match hipStreamAddCallback capture behavior with nvidia (#386)

Co-authored-by: Anusha GodavarthySurya <Anusha.GodavarthySurya@amd.com>

[ROCm/clr commit: a0e946c2cc]
Этот коммит содержится в:
Stojiljkovic, Vladana
2025-05-22 17:24:04 +02:00
коммит произвёл GitHub
родитель 9af11abb42
Коммит 1a36230bf2
+13
Просмотреть файл
@@ -609,6 +609,19 @@ hipError_t hipStreamAddCallback_common(hipStream_t stream, hipStreamCallback_t c
if (callback == nullptr || flags != 0) {
return hipErrorInvalidValue;
}
if (stream != nullptr && stream != hipStreamLegacy && hip::isValid(stream)) {
hip::Stream* s = reinterpret_cast<hip::Stream*>(stream);
if (s->GetCaptureStatus() != hipStreamCaptureStatusNone) {
s->SetCaptureStatus(hipStreamCaptureStatusInvalidated);
return hipErrorStreamCaptureUnsupported;
}
} else if (Stream::StreamCaptureBlocking() == true) {
// If any of the blocking streams is capturing, return error for implicit capture and
// invalidate capture for all capturing streams
CHECK_STREAM_CAPTURING();
}
StreamCallback* cbo = new StreamAddCallback(stream, callback, userData);
return streamCallback_common(stream, cbo, userData);
}