rocr/driver: add PC sampling support to driver interface
Add PC sampling functionality to the driver interface: 1. Add new PC sampling methods to Driver base class: - PcSamplingQueryCapabilities - PcSamplingCreate - PcSamplingDestroy - PcSamplingStart - PcSamplingStop 2. Implement PC sampling methods in KfdDriver using HSAKMT APIs: - Map HSAKMT status codes to HSA status codes - Handle resource busy conditions - Proper error handling for all operations Signed-off-by: Honglei Huang <Honglei1.Huang@amd.com>
This commit is contained in:
committed by
Huang, Honglei1
parent
a47c060d6a
commit
56cb9390ff
@@ -730,5 +730,64 @@ hsa_status_t KfdDriver::ReturnAsanHeaderPage(void* mem) const {
|
||||
return HSA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
hsa_status_t KfdDriver::PcSamplingQueryCapabilities(uint32_t node_id, void* sample_info,
|
||||
uint32_t sample_info_sz,
|
||||
uint32_t* sz_needed) const {
|
||||
HSAKMT_STATUS status = HSAKMT_CALL(
|
||||
hsaKmtPcSamplingQueryCapabilities(node_id, sample_info, sample_info_sz, sz_needed));
|
||||
if (status == HSAKMT_STATUS_KERNEL_ALREADY_OPENED) {
|
||||
return static_cast<hsa_status_t>(HSA_STATUS_ERROR_RESOURCE_BUSY);
|
||||
}
|
||||
if (status != HSAKMT_STATUS_SUCCESS) {
|
||||
return HSA_STATUS_ERROR;
|
||||
}
|
||||
return HSA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
hsa_status_t KfdDriver::PcSamplingCreate(uint32_t node_id, HsaPcSamplingInfo* sample_info,
|
||||
uint32_t* trace_id) const {
|
||||
HSAKMT_STATUS status = HSAKMT_CALL(hsaKmtPcSamplingCreate(node_id, sample_info, trace_id));
|
||||
if (status == HSAKMT_STATUS_KERNEL_ALREADY_OPENED) {
|
||||
return static_cast<hsa_status_t>(HSA_STATUS_ERROR_RESOURCE_BUSY);
|
||||
}
|
||||
if (status != HSAKMT_STATUS_SUCCESS) {
|
||||
return HSA_STATUS_ERROR;
|
||||
}
|
||||
return HSA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
hsa_status_t KfdDriver::PcSamplingDestroy(uint32_t node_id, uint32_t trace_id) const {
|
||||
HSAKMT_STATUS status = HSAKMT_CALL(hsaKmtPcSamplingDestroy(node_id, trace_id));
|
||||
if (status == HSAKMT_STATUS_KERNEL_ALREADY_OPENED) {
|
||||
return static_cast<hsa_status_t>(HSA_STATUS_ERROR_RESOURCE_BUSY);
|
||||
}
|
||||
if (status != HSAKMT_STATUS_SUCCESS) {
|
||||
return HSA_STATUS_ERROR;
|
||||
}
|
||||
return HSA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
hsa_status_t KfdDriver::PcSamplingStart(uint32_t node_id, uint32_t trace_id) const {
|
||||
HSAKMT_STATUS status = HSAKMT_CALL(hsaKmtPcSamplingStart(node_id, trace_id));
|
||||
if (status == HSAKMT_STATUS_KERNEL_ALREADY_OPENED) {
|
||||
return static_cast<hsa_status_t>(HSA_STATUS_ERROR_RESOURCE_BUSY);
|
||||
}
|
||||
if (status != HSAKMT_STATUS_SUCCESS) {
|
||||
return HSA_STATUS_ERROR;
|
||||
}
|
||||
return HSA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
hsa_status_t KfdDriver::PcSamplingStop(uint32_t node_id, uint32_t trace_id) const {
|
||||
HSAKMT_STATUS status = HSAKMT_CALL(hsaKmtPcSamplingStop(node_id, trace_id));
|
||||
if (status == HSAKMT_STATUS_KERNEL_ALREADY_OPENED) {
|
||||
return static_cast<hsa_status_t>(HSA_STATUS_ERROR_RESOURCE_BUSY);
|
||||
}
|
||||
if (status != HSAKMT_STATUS_SUCCESS) {
|
||||
return HSA_STATUS_ERROR;
|
||||
}
|
||||
return HSA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
} // namespace AMD
|
||||
} // namespace rocr
|
||||
|
||||
Reference in New Issue
Block a user