PC Sampling: Add start stop and flush APIs
Create PC Sampling APIs for start and stop functions. And create stub
for flush function.
Change-Id: I7a093b29dc87e34ac06faaae6cac2be50e4663e1
[ROCm/ROCR-Runtime commit: a842247482]
Αυτή η υποβολή περιλαμβάνεται σε:
@@ -104,7 +104,7 @@ PcsRuntime::PcSamplingSession::PcSamplingSession(
|
||||
core::Agent* _agent, hsa_ven_amd_pcs_method_kind_t method, hsa_ven_amd_pcs_units_t units,
|
||||
size_t interval, size_t latency, size_t buffer_size,
|
||||
hsa_ven_amd_pcs_data_ready_callback_t data_ready_callback, void* client_callback_data)
|
||||
: agent(_agent), thunkId_(0), valid_(true), sample_size_(0) {
|
||||
: agent(_agent), thunkId_(0), active_(false), valid_(true), sample_size_(0) {
|
||||
switch (method) {
|
||||
case HSA_VEN_AMD_PCS_METHOD_HOSTTRAP_V1:
|
||||
sample_size_ = sizeof(perf_sample_hosttrap_v1_t);
|
||||
@@ -240,6 +240,41 @@ hsa_status_t PcsRuntime::PcSamplingDestroy(hsa_ven_amd_pcs_t handle) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
hsa_status_t PcsRuntime::PcSamplingStart(hsa_ven_amd_pcs_t handle) {
|
||||
ScopedAcquire<KernelMutex> lock(&pc_sampling_lock_);
|
||||
auto pcSamplingSessionIt = pc_sampling_.find(reinterpret_cast<uint64_t>(handle.handle));
|
||||
if (pcSamplingSessionIt == pc_sampling_.end()) {
|
||||
debug_warning(false && "Cannot find PcSampling session");
|
||||
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
AMD::GpuAgentInt* gpu_agent = static_cast<AMD::GpuAgentInt*>(pcSamplingSessionIt->second.agent);
|
||||
|
||||
return gpu_agent->PcSamplingStart(pcSamplingSessionIt->second);
|
||||
}
|
||||
|
||||
hsa_status_t PcsRuntime::PcSamplingStop(hsa_ven_amd_pcs_t handle) {
|
||||
ScopedAcquire<KernelMutex> lock(&pc_sampling_lock_);
|
||||
auto pcSamplingSessionIt = pc_sampling_.find(reinterpret_cast<uint64_t>(handle.handle));
|
||||
if (pcSamplingSessionIt == pc_sampling_.end()) {
|
||||
debug_warning(false && "Cannot find PcSampling session");
|
||||
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
AMD::GpuAgentInt* gpu_agent = static_cast<AMD::GpuAgentInt*>(pcSamplingSessionIt->second.agent);
|
||||
|
||||
return gpu_agent->PcSamplingStop(pcSamplingSessionIt->second);
|
||||
}
|
||||
|
||||
hsa_status_t PcsRuntime::PcSamplingFlush(hsa_ven_amd_pcs_t handle) {
|
||||
ScopedAcquire<KernelMutex> lock(&pc_sampling_lock_);
|
||||
auto pcSamplingSessionIt = pc_sampling_.find(reinterpret_cast<uint64_t>(handle.handle));
|
||||
if (pcSamplingSessionIt == pc_sampling_.end()) {
|
||||
debug_warning(false && "Cannot find PcSampling session");
|
||||
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
AMD::GpuAgentInt* gpu_agent = static_cast<AMD::GpuAgentInt*>(pcSamplingSessionIt->second.agent);
|
||||
|
||||
return gpu_agent->PcSamplingFlush(pcSamplingSessionIt->second);
|
||||
}
|
||||
|
||||
} // namespace pcs
|
||||
} // namespace rocr
|
||||
|
||||
Αναφορά σε νέο ζήτημα
Block a user