Add Stream Performance Monitor(SPM) APIs
Change-Id: I0d48782887814ef245b7e0182e2d5570aa8c3f50
Αυτή η υποβολή περιλαμβάνεται σε:
1 γονέας
ecdebef0b9
υποβολή
6bfe57aeb2
8 files changed
+139
-1
No files matched your search
@@ -1178,6 +1178,24 @@ hsa_status_t HSA_API hsa_amd_svm_prefetch_async(void* ptr, size_t size, hsa_agen
|
||||
return amdExtTable->hsa_amd_svm_prefetch_async_fn(ptr, size, agent, num_dep_signals, dep_signals, completion_signal);
|
||||
}
|
||||
|
||||
// Mirrors Amd Extension Apis
|
||||
hsa_status_t HSA_API hsa_amd_spm_acquire(hsa_agent_t agent) {
|
||||
return amdExtTable->hsa_amd_spm_acquire_fn(agent);
|
||||
}
|
||||
|
||||
// Mirrors Amd Extension Apis
|
||||
hsa_status_t HSA_API hsa_amd_spm_release(hsa_agent_t agent) {
|
||||
return amdExtTable->hsa_amd_spm_release_fn(agent);
|
||||
}
|
||||
|
||||
// Mirrors Amd Extension Apis
|
||||
hsa_status_t HSA_API hsa_amd_spm_set_dest_buffer(hsa_agent_t agent, size_t size, uint32_t* timeout,
|
||||
uint32_t* size_copied, void* dest,
|
||||
bool* is_data_loss) {
|
||||
return amdExtTable->hsa_amd_spm_set_dest_buffer_fn(agent, size, timeout, size_copied, dest,
|
||||
is_data_loss);
|
||||
}
|
||||
|
||||
// Tools only table interfaces.
|
||||
namespace rocr {
|
||||
|
||||
|
||||
@@ -265,6 +265,17 @@ hsa_status_t HSA_API hsa_amd_svm_prefetch_async(void* ptr, size_t size, hsa_agen
|
||||
uint32_t num_dep_signals, const hsa_signal_t* dep_signals,
|
||||
hsa_signal_t completion_signal);
|
||||
|
||||
// Mirrors Amd Extension Apis
|
||||
hsa_status_t HSA_API hsa_amd_spm_acquire(hsa_agent_t agent);
|
||||
|
||||
// Mirrors Amd Extension Apis
|
||||
hsa_status_t HSA_API hsa_amd_spm_release(hsa_agent_t agent);
|
||||
|
||||
// Mirrors Amd Extension Apis
|
||||
hsa_status_t HSA_API hsa_amd_spm_set_dest_buffer(hsa_agent_t agent, size_t size, uint32_t* timeout,
|
||||
uint32_t* size_copied, void* dest,
|
||||
bool* is_data_loss);
|
||||
|
||||
} // namespace amd
|
||||
} // namespace rocr
|
||||
|
||||
|
||||
@@ -395,6 +395,9 @@ void HsaApiTable::UpdateAmdExts() {
|
||||
amd_ext_api.hsa_amd_svm_attributes_set_fn = AMD::hsa_amd_svm_attributes_set;
|
||||
amd_ext_api.hsa_amd_svm_attributes_get_fn = AMD::hsa_amd_svm_attributes_get;
|
||||
amd_ext_api.hsa_amd_svm_prefetch_async_fn = AMD::hsa_amd_svm_prefetch_async;
|
||||
amd_ext_api.hsa_amd_spm_acquire_fn = AMD::hsa_amd_spm_acquire;
|
||||
amd_ext_api.hsa_amd_spm_release_fn = AMD::hsa_amd_spm_release;
|
||||
amd_ext_api.hsa_amd_spm_set_dest_buffer_fn = AMD::hsa_amd_spm_set_dest_buffer;
|
||||
}
|
||||
|
||||
void LoadInitialHsaApiTable() {
|
||||
|
||||
@@ -1069,5 +1069,52 @@ hsa_status_t hsa_amd_svm_prefetch_async(void* ptr, size_t size, hsa_agent_t agen
|
||||
CATCH;
|
||||
}
|
||||
|
||||
hsa_status_t hsa_amd_spm_acquire(hsa_agent_t preferred_agent) {
|
||||
TRY;
|
||||
IS_OPEN();
|
||||
const core::Agent* agent = core::Agent::Convert(preferred_agent);
|
||||
if (agent == NULL || !agent->IsValid() || agent->device_type() != core::Agent::kAmdGpuDevice)
|
||||
return HSA_STATUS_ERROR_INVALID_AGENT;
|
||||
|
||||
if (hsaKmtSPMAcquire(agent->node_id()) != HSAKMT_STATUS_SUCCESS) return HSA_STATUS_ERROR;
|
||||
return HSA_STATUS_SUCCESS;
|
||||
|
||||
CATCH;
|
||||
}
|
||||
|
||||
hsa_status_t hsa_amd_spm_release(hsa_agent_t preferred_agent) {
|
||||
TRY;
|
||||
IS_OPEN();
|
||||
|
||||
const core::Agent* agent = core::Agent::Convert(preferred_agent);
|
||||
if (agent == NULL || !agent->IsValid() || agent->device_type() != core::Agent::kAmdGpuDevice)
|
||||
return HSA_STATUS_ERROR_INVALID_AGENT;
|
||||
|
||||
if (hsaKmtSPMRelease(agent->node_id()) != HSAKMT_STATUS_SUCCESS) return HSA_STATUS_ERROR;
|
||||
|
||||
return HSA_STATUS_SUCCESS;
|
||||
|
||||
CATCH;
|
||||
}
|
||||
|
||||
hsa_status_t hsa_amd_spm_set_dest_buffer(hsa_agent_t preferred_agent, size_t size_in_bytes,
|
||||
uint32_t* timeout, uint32_t* size_copied, void* dest,
|
||||
bool* is_data_loss) {
|
||||
TRY;
|
||||
IS_OPEN();
|
||||
|
||||
const core::Agent* agent = core::Agent::Convert(preferred_agent);
|
||||
if (agent == NULL || !agent->IsValid() || agent->device_type() != core::Agent::kAmdGpuDevice)
|
||||
return HSA_STATUS_ERROR_INVALID_AGENT;
|
||||
|
||||
if (hsaKmtSPMSetDestBuffer(agent->node_id(), size_in_bytes, timeout, size_copied, dest,
|
||||
is_data_loss) != HSAKMT_STATUS_SUCCESS)
|
||||
return HSA_STATUS_ERROR;
|
||||
|
||||
return HSA_STATUS_SUCCESS;
|
||||
|
||||
CATCH;
|
||||
}
|
||||
|
||||
} // namespace amd
|
||||
} // namespace rocr
|
||||
Reference in new issue
Block a user