SWDEV-274821 SPM initialization fix

Change-Id: I5e27928a60083eff328bab3e79937ce11bce11bd
This commit is contained in:
Evgeny
2021-03-22 09:18:20 +00:00
orang tua 567f457f25
melakukan e2c9d13e5b
4 mengubah file dengan 32 tambahan dan 17 penghapusan
+2 -5
Melihat File
@@ -75,6 +75,8 @@ export ROCP_METRICS=$PKG_DIR/lib/metrics.xml
export AQLPROFILE_READ_API=0
# ROC Profiler package path
export ROCP_PACKAGE_DIR=$PKG_DIR
# enabled SPM KFD mode
export ROCP_SPM_KFD_MODE=1
# error handling
fatal() {
@@ -184,7 +186,6 @@ usage() {
echo " --flush-rate <rate> - to enable trace flush rate (time period)"
echo " Supported time formats: <number(m|s|ms|us)>"
echo " --parallel-kernels - to enable cnocurrent kernels"
echo " --spm-mode <on|off> - to enable collecting time-based sampling of HW counter data [off]"
echo ""
echo "Configuration file:"
echo " You can set your parameters defaults preferences in the configuration file 'rpl_rc.xml'. The search path sequence: .:${HOME}:<package path>"
@@ -445,10 +446,6 @@ while [ 1 ] ; do
ARG_VAL=0
export ROCP_K_CONCURRENT=1
export AQLPROFILE_READ_API=1
elif [ "$1" = "--spm-mode" ] ; then
if [ "$2" = "on" ] ; then
export ROCP_SPM_KFD_MODE=1
fi
elif [ "$1" = "--verbose" ] ; then
ARG_VAL=0
export ROCP_VERBOSE_MODE=1
+14 -2
Melihat File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash -x
################################################################################
# Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
@@ -64,7 +64,7 @@ parse() {
gpu_index=$line
fi
else
found=$(echo $feature | sed -n "/^\(pmc\|sqtt\|hsa\)$/ p")
found=$(echo $feature | sed -n "/^\(pmc\|sqtt\|hip\|hsa\|kfd\)$/ p")
if [ -n "$found" ] ; then
output=$outdir/input${index}.xml
header="# $timestamp '$output' generated with '$0 $*'"
@@ -85,9 +85,21 @@ EOF
EOF
fi
if [ "$feature" == "hip" ] ; then
cat >> $output <<EOF
<trace name="HIP"><parameters api="$line"></parameters></trace>
EOF
fi
if [ "$feature" == "hsa" ] ; then
cat >> $output <<EOF
<trace name="HSA"><parameters api="$line"></parameters></trace>
EOF
fi
if [ "$feature" == "kfd" ] ; then
cat >> $output <<EOF
<trace name="KFD"><parameters api="$line"></parameters></trace>
EOF
fi
fi
+1 -1
Melihat File
@@ -323,7 +323,7 @@ class Context {
for (auto& tuple : profile_vector) {
if (pcsmp_mode_) const_cast<profile_t*>(tuple.profile)->event_count = UINT32_MAX;
const hsa_status_t status =
api_->hsa_ven_amd_aqlprofile_iterate_data(tuple.profile, callback, data);
api_->hsa_ven_amd_aqlprofile_iterate_data(tuple.profile, callback, data);
if (status != HSA_STATUS_SUCCESS) AQL_EXC_RAISING(status, "context iterate data failed");
}
}
+15 -9
Melihat File
@@ -443,7 +443,8 @@ hsa_status_t trace_data_cb(hsa_ven_amd_aqlprofile_info_type_t info_type,
}
// SPM counter trace start/stop methods
std::vector<rocprofiler_t*> spm_ctx_vec;
typedef std::vector<rocprofiler_t*> spm_ctx_vec_t;
spm_ctx_vec_t *spm_ctx_vec = NULL;
void spm_ctrl_start(rocprofiler_feature_t* features, uint32_t features_found) {
// Start SPM trace collection for all GPUs
uint32_t gpu_count = HsaRsrcFactory::Instance().GetCountOfGpuAgents();
@@ -459,6 +460,14 @@ void spm_ctrl_start(rocprofiler_feature_t* features, uint32_t features_found) {
rocprofiler_properties_t properties{};
properties.queue_depth = 256;
for (rocprofiler_feature_t* p = features; p < features + features_found; ++p) {
int val = p->kind;
if (val == ROCPROFILER_FEATURE_KIND_METRIC) {
val = ROCPROFILER_FEATURE_KIND_TRACE | ROCPROFILER_FEATURE_KIND_SPM_MOD;
p->kind = (rocprofiler_feature_kind_t)val;
}
}
// Creating SPM context
rocprofiler_t* context = NULL;
hsa_status_t status = rocprofiler_open(agent, features, features_found, &context,
@@ -472,13 +481,16 @@ void spm_ctrl_start(rocprofiler_feature_t* features, uint32_t features_found) {
status = rocprofiler_start(context, 0);
check_status(status);
// saving the context in the vectort
spm_ctx_vec.push_back(context);
if (spm_ctx_vec == NULL) spm_ctx_vec = new spm_ctx_vec_t;
spm_ctx_vec->push_back(context);
}
}
void spm_ctrl_stop() {
for (rocprofiler_t* context : spm_ctx_vec) {
for (rocprofiler_t* context : *spm_ctx_vec) {
hsa_status_t status = rocprofiler_stop(context, 0);
check_status(status);
status = rocprofiler_iterate_trace_data(context, NULL, NULL);
check_status(status);
rocprofiler_close(context);
}
}
@@ -1565,12 +1577,6 @@ extern "C" PUBLIC_API void OnLoadToolProp(rocprofiler_settings_t* settings)
// set a value to indicate tracing mode
if (settings->k_concurrent != 0) settings->k_concurrent = (traces_found == 0) ? 1 : 2;
if (is_spm_trace) {
for (uint32_t index = 0; index < features_found; index++) {
features[index].kind = ROCPROFILER_FEATURE_KIND_TRACE;
}
}
// Context array aloocation
context_array = new context_array_t;