[HIP] Fixed hipStreamAddCallback [SWDEV#165185] (#1425)

Fixed hipStreamAddCallback() as requested in SWDEV#165185
Added unit test to test the behavior


[ROCm/clr commit: 97fca3439d]
This commit is contained in:
Sarbojit2019
2019-11-07 13:18:12 +05:30
committed by Maneesh Gupta
parent f5a92e5cb6
commit 4d0b7e65bb
6 changed files with 593 additions and 9 deletions
+9 -6
View File
@@ -1497,18 +1497,21 @@ hipError_t ihipStreamSynchronize(TlsData *tls, hipStream_t stream) {
return e;
}
void ihipStreamCallbackHandler(ihipStreamCallback_t* cb) {
bool ihipStreamCallbackHandler(hsa_signal_value_t value, void* cbArgs) {
hipError_t e = hipSuccess;
// Synchronize stream
tprintf(DB_SYNC, "ihipStreamCallbackHandler wait on stream %s\n",
ToString(cb->_stream).c_str());
GET_TLS();
e = ihipStreamSynchronize(tls, cb->_stream);
ihipStreamCallback_t* cb = static_cast<ihipStreamCallback_t*> (cbArgs);
if(cb->comFuture.valid())
cb->comFuture.wait();
// Call registered callback function
cb->_callback(cb->_stream, e, cb->_userData);
hsa_signal_store_screlease(cb->_signal,0);
delete cb;
return false;
}
//---