SWDEV-352197 - Destroy virtual device in thread destructor

Windows kills threads on exit without any notification. However,
runtime can still destroy VirtualGPU object from the host thread with
HostQueue destruction.
This change also forces RGP trace transfer on the last capture without
any delays.

Change-Id: I768e87e99e1d23a021e63c12f36e450817743759


[ROCm/clr commit: ad33a021cb]
Tá an tiomantas seo le fáil i:
German
2023-01-30 13:11:14 -05:00
tiomanta ag German Andryeyev
tuismitheoir 9eeb99a842
tiomantas f857dcc48d
D'athraigh 4 comhad le 28 breiseanna agus 10 scriosta
+9 -5
Féach ar an gComhad
@@ -162,15 +162,21 @@ class HostQueue : public CommandQueue {
Thread()
: amd::Thread("Command Queue Thread", CQ_THREAD_STACK_SIZE, !AMD_DIRECT_DISPATCH),
acceptingCommands_(false),
virtualDevice_(NULL) {}
virtualDevice_(nullptr) {}
virtual ~Thread() {
if (virtualDevice_ != nullptr) {
delete virtualDevice_;
virtualDevice_ = nullptr;
}
}
//! The command queue thread entry point.
void run(void* data) {
HostQueue* queue = static_cast<HostQueue*>(data);
virtualDevice_ = queue->device().createVirtualDevice(queue);
if (virtualDevice_ != NULL) {
if (virtualDevice_ != nullptr) {
queue->loop(virtualDevice_);
Release();
} else {
acceptingCommands_ = false;
queue->flush();
@@ -184,8 +190,6 @@ class HostQueue : public CommandQueue {
}
}
void Release() const { delete virtualDevice_; }
//! Get virtual device for the current thread
device::VirtualDevice* vdev() const { return virtualDevice_; }