Fixed exception thrown when ROCP_HSA_INTERCEPT not set or set to 0;
Fixed ROCM hsa_init() failed with error 4096 when trying to read hardware performance counters;
Fixed LD_LIBRARY_PATH to include necessary library;

Change-Id: Idcb7ff807a79f4267374c34041d3bca33d85f532


[ROCm/rocprofiler commit: a8b5d6cf33]
Этот коммит содержится в:
Chun Yang
2021-09-29 18:51:36 -07:00
коммит произвёл Ammar Elwazir
родитель 7978c0b16b
Коммит b02e28f286
2 изменённых файлов: 17 добавлений и 21 удалений
+16 -20
Просмотреть файл
@@ -400,42 +400,38 @@ PUBLIC_API bool OnLoad(HsaApiTable* table, uint64_t runtime_version, uint64_t fa
ONLOAD_TRACE_BEG();
rocprofiler::SaveHsaApi(table);
rocprofiler::ProxyQueue::InitFactory();
bool intercept_mode = false;
// Checking environment to enable intercept mode
const char* intercept_env = getenv("ROCP_HSA_INTERCEPT");
int intercept_env_value = 0;
if (intercept_env != NULL) {
switch (atoi(intercept_env)) {
// Intercepting disabled
intercept_env_value = atoi(intercept_env);
switch (intercept_env_value) {
case 0:
intercept_mode = false;
rocprofiler::InterceptQueue::TrackerOn(false);
break;
// Intercepting enabled without timestamping
case 1:
intercept_mode = true;
// 0: Intercepting disabled
// 1: Intercepting enabled without timestamping
rocprofiler::InterceptQueue::TrackerOn(false);
break;
// Intercepting enabled with timestamping
case 2:
intercept_mode = true;
// Intercepting enabled with timestamping
rocprofiler::InterceptQueue::TrackerOn(true);
break;
default:
ERR_LOGGING("Bad ROCP_HSA_INTERCEPT env var value (" << intercept_env << ")");
ERR_LOGGING("Bad ROCP_HSA_INTERCEPT env var value (" << intercept_env << "): " <<
"valid values are 0 (standalone), 1 (intercepting without timestamp), 2 (intercepting with timestamp)");
return false;
}
}
// always enable excutable tracking
rocprofiler::util::HsaRsrcFactory::EnableExecutableTracking(table);
// Loading a tool lib and setting of intercept mode
const uint32_t intercept_mode_mask = rocprofiler::LoadTool();
if (intercept_mode_mask & rocprofiler::DISPATCH_INTERCEPT_MODE) {
intercept_mode = true;
}
if (intercept_mode_mask & rocprofiler::CODE_OBJ_TRACKING_MODE) {
if (intercept_mode == false) EXC_RAISING(HSA_STATUS_ERROR, "code objects tracking without intercept mode enabled");
rocprofiler::util::HsaRsrcFactory::EnableExecutableTracking(table);
}
if (intercept_mode_mask & rocprofiler::MEMCOPY_INTERCEPT_MODE) {
hsa_status_t status = hsa_amd_profiling_async_copy_enable(true);
if (status != HSA_STATUS_SUCCESS) EXC_ABORT(status, "hsa_amd_profiling_async_copy_enable");
@@ -453,14 +449,14 @@ PUBLIC_API bool OnLoad(HsaApiTable* table, uint64_t runtime_version, uint64_t fa
}
// HSA intercepting
if (intercept_mode) {
if (intercept_env_value != 0) {
rocprofiler::ProxyQueue::HsaIntercept(table);
rocprofiler::InterceptQueue::HsaIntercept(table);
} else {
rocprofiler::StandaloneIntercept();
}
ONLOAD_TRACE("end intercept_mode(" << std::hex << intercept_mode << ")" <<
ONLOAD_TRACE("end intercept_mode(" << std::hex << intercept_env_value << ")" <<
" intercept_mode_mask(" << std::hex << intercept_mode_mask << ")" << std::dec);
return true;
}
+1 -1
Просмотреть файл
@@ -57,7 +57,7 @@ eval_test() {
}
# paths to ROC profiler and oher libraries
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD:$PWD/../../lib:/home/jenkins/compute-package/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD:$PWD/../../lib:/opt/rocm/lib
# enable tools load failure reporting
export HSA_TOOLS_REPORT_LOAD_FAILURE=1