[vdi] Add device assertion support.

- Once device assertion occurs, abort the host execution as well.
- TODO: This's the initial support. As we need to drain hostcall queue
  to ensure device assertion message being flushed out, hostcall
  listener needs an interface to explicitly drain its queue.

Change-Id: I8a04400aa7109bfd054ae5777c41a4abbf0db4a9
This commit is contained in:
Michael LIAO
2020-04-21 17:09:17 -04:00
committed by Michael Hong Bin Liao
parent 43a8e929a2
commit 97f55b5c7f
2 changed files with 16 additions and 2 deletions
+8 -1
View File
@@ -1901,6 +1901,13 @@ bool Device::SetClockMode(const cl_set_device_clock_mode_input_amd setClockModeI
return result;
}
static void callbackQueue(hsa_status_t status, hsa_queue_t* queue, void* data) {
if (status != HSA_STATUS_SUCCESS && status != HSA_STATUS_INFO_BREAK) {
// Abort on device exceptions.
abort();
}
}
hsa_queue_t* Device::acquireQueue(uint32_t queue_size_hint, bool coop_queue) {
assert(queuePool_.size() <= GPU_MAX_HW_QUEUES);
ClPrint(amd::LOG_INFO, amd::LOG_QUEUE, "number of allocated hardware queues: %d, maximum: %d",
@@ -1938,7 +1945,7 @@ hsa_queue_t* Device::acquireQueue(uint32_t queue_size_hint, bool coop_queue) {
queue_type = HSA_QUEUE_TYPE_COOPERATIVE;
}
while (hsa_queue_create(_bkendDevice, queue_size, queue_type, nullptr, nullptr,
while (hsa_queue_create(_bkendDevice, queue_size, queue_type, callbackQueue, this,
std::numeric_limits<uint>::max(), std::numeric_limits<uint>::max(),
&queue) != HSA_STATUS_SUCCESS) {
queue_size >>= 1;