Files
rocm-systems/projects/rocprofiler/src/core/proxy_queue.cpp
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

45 строки
1.5 KiB
C++
Исходник Обычный вид История

2025-09-19 10:31:12 +05:30
// Copyright © Advanced Micro Devices, Inc., or its affiliates.
// SPDX-License-Identifier: MIT
2018-06-25 19:22:36 -05:00
2017-11-09 17:26:19 -06:00
#include "core/proxy_queue.h"
#include "core/hsa_proxy_queue.h"
#include "core/simple_proxy_queue.h"
namespace rocprofiler {
void ProxyQueue::HsaIntercept(HsaApiTable* table) {
if (rocp_type_) SimpleProxyQueue::HsaIntercept(table);
}
2017-11-29 13:53:12 -06:00
ProxyQueue* ProxyQueue::Create(hsa_agent_t agent, 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* status) {
2017-11-09 17:26:19 -06:00
hsa_status_t suc = HSA_STATUS_ERROR;
2017-11-29 13:53:12 -06:00
ProxyQueue* instance =
2023-07-13 19:48:38 +00:00
(rocp_type_) ? (ProxyQueue*)new SimpleProxyQueue() : (ProxyQueue*)new HsaProxyQueue();
2017-11-09 17:26:19 -06:00
if (instance != NULL) {
suc = instance->Init(agent, size, type, callback, data, private_segment_size,
2023-07-13 19:48:38 +00:00
group_segment_size, queue);
2017-11-09 17:26:19 -06:00
if (suc != HSA_STATUS_SUCCESS) {
delete instance;
instance = NULL;
}
}
*status = suc;
assert(*status == HSA_STATUS_SUCCESS);
2017-11-09 17:26:19 -06:00
return instance;
}
hsa_status_t ProxyQueue::Destroy(const ProxyQueue* obj) {
assert(obj != NULL);
2017-11-09 17:26:19 -06:00
auto suc = obj->Cleanup();
delete obj;
return suc;
}
bool ProxyQueue::rocp_type_ = false;
2017-11-29 13:53:12 -06:00
} // namespace rocprofiler