Report internal queue creation to tools.
Debug agent requires handles to internal queues for single step debugging.
Added tools only API hsa_amd_runtime_queue_create_register for reporting.
hsa_amd_runtime_queue_create_register sets a callback which is invoked
when internal queues are created.
Change-Id: Ia5190ae724fadba686c15f25b2cd085350eeff0e
[ROCm/ROCR-Runtime commit: 757502ccd6]
Cette révision appartient à :
@@ -328,6 +328,11 @@ class Runtime {
|
||||
return system_event_handler_;
|
||||
}
|
||||
|
||||
hsa_status_t SetInternalQueueCreateNotifier(hsa_amd_runtime_queue_notifier callback,
|
||||
void* user_data);
|
||||
|
||||
void InternalQueueCreateNotify(const hsa_queue_t* queue, hsa_agent_t agent);
|
||||
|
||||
protected:
|
||||
static void AsyncEventsLoop(void*);
|
||||
|
||||
@@ -503,6 +508,11 @@ class Runtime {
|
||||
|
||||
void* system_event_handler_user_data_;
|
||||
|
||||
// Internal queue creation notifier
|
||||
AMD::callback_t<hsa_amd_runtime_queue_notifier> internal_queue_create_notifier_;
|
||||
|
||||
void* internal_queue_create_notifier_user_data_;
|
||||
|
||||
// Holds reference count to runtime object.
|
||||
std::atomic<uint32_t> ref_count_;
|
||||
|
||||
|
||||
@@ -513,6 +513,9 @@ core::Queue* GpuAgent::CreateInterceptibleQueue() {
|
||||
// Disabled intercept of internal queues pending tools updates.
|
||||
core::Queue* queue = nullptr;
|
||||
QueueCreate(minAqlSize_, HSA_QUEUE_TYPE_MULTI, NULL, NULL, 0, 0, &queue);
|
||||
if (queue != nullptr)
|
||||
core::Runtime::runtime_singleton_->InternalQueueCreateNotify(core::Queue::Convert(queue),
|
||||
this->public_handle());
|
||||
return queue;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,9 @@ hsa_status_t hsa_amd_queue_intercept_create(
|
||||
hsa_agent_t agent_handle, uint32_t size, hsa_queue_type32_t type,
|
||||
void (*callback)(hsa_status_t status, hsa_queue_t* source, void* data), void* data,
|
||||
uint32_t private_segment_size, uint32_t group_segment_size, hsa_queue_t** queue);
|
||||
|
||||
hsa_status_t hsa_amd_runtime_queue_create_register(hsa_amd_runtime_queue_notifier callback,
|
||||
void* user_data);
|
||||
}
|
||||
|
||||
namespace core {
|
||||
@@ -382,6 +385,7 @@ void HsaApiTable::UpdateAmdExts() {
|
||||
amd_ext_api.hsa_amd_queue_intercept_register_fn = AMD::hsa_amd_queue_intercept_register;
|
||||
amd_ext_api.hsa_amd_queue_set_priority_fn = AMD::hsa_amd_queue_set_priority;
|
||||
amd_ext_api.hsa_amd_memory_async_copy_rect_fn = AMD::hsa_amd_memory_async_copy_rect;
|
||||
amd_ext_api.hsa_amd_runtime_queue_create_register_fn = AMD::hsa_amd_runtime_queue_create_register;
|
||||
}
|
||||
|
||||
class Init {
|
||||
|
||||
@@ -924,4 +924,12 @@ hsa_status_t HSA_API hsa_amd_queue_set_priority(hsa_queue_t* queue,
|
||||
CATCH;
|
||||
}
|
||||
|
||||
hsa_status_t hsa_amd_runtime_queue_create_register(hsa_amd_runtime_queue_notifier callback,
|
||||
void* user_data) {
|
||||
TRY;
|
||||
IS_OPEN();
|
||||
return core::Runtime::runtime_singleton_->SetInternalQueueCreateNotifier(callback, user_data);
|
||||
CATCH;
|
||||
}
|
||||
|
||||
} // end of AMD namespace
|
||||
|
||||
@@ -1476,4 +1476,20 @@ hsa_status_t Runtime::SetCustomSystemEventHandler(hsa_amd_system_event_callback_
|
||||
}
|
||||
}
|
||||
|
||||
hsa_status_t Runtime::SetInternalQueueCreateNotifier(hsa_amd_runtime_queue_notifier callback,
|
||||
void* user_data) {
|
||||
if (internal_queue_create_notifier_) {
|
||||
return HSA_STATUS_ERROR;
|
||||
} else {
|
||||
internal_queue_create_notifier_ = callback;
|
||||
internal_queue_create_notifier_user_data_ = user_data;
|
||||
return HSA_STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
void Runtime::InternalQueueCreateNotify(const hsa_queue_t* queue, hsa_agent_t agent) {
|
||||
if (internal_queue_create_notifier_)
|
||||
internal_queue_create_notifier_(queue, agent, internal_queue_create_notifier_user_data_);
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
|
||||
@@ -92,6 +92,11 @@ hsa_status_t hsa_amd_queue_intercept_create(
|
||||
void (*callback)(hsa_status_t status, hsa_queue_t* source, void* data), void* data,
|
||||
uint32_t private_segment_size, uint32_t group_segment_size, hsa_queue_t** queue);
|
||||
|
||||
typedef void (*hsa_amd_runtime_queue_notifier)(const hsa_queue_t* queue, hsa_agent_t agent,
|
||||
void* data);
|
||||
hsa_status_t hsa_amd_runtime_queue_create_register(hsa_amd_runtime_queue_notifier callback,
|
||||
void* user_data);
|
||||
|
||||
// Structure of Version used to identify an instance of Api table
|
||||
// Must be the first member (offsetof == 0) of all API tables.
|
||||
// This is the root of the table passing ABI.
|
||||
@@ -173,6 +178,7 @@ struct AmdExtTable {
|
||||
decltype(hsa_amd_queue_intercept_register)* hsa_amd_queue_intercept_register_fn;
|
||||
decltype(hsa_amd_queue_set_priority)* hsa_amd_queue_set_priority_fn;
|
||||
decltype(hsa_amd_memory_async_copy_rect)* hsa_amd_memory_async_copy_rect_fn;
|
||||
decltype(hsa_amd_runtime_queue_create_register)* hsa_amd_runtime_queue_create_register_fn;
|
||||
};
|
||||
|
||||
// Table to export HSA Core Runtime Apis
|
||||
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur