SWDEV-283942 SWDEV-292075
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]
This commit is contained in:
@@ -400,42 +400,38 @@ PUBLIC_API bool OnLoad(HsaApiTable* table, uint64_t runtime_version, uint64_t fa
|
|||||||
ONLOAD_TRACE_BEG();
|
ONLOAD_TRACE_BEG();
|
||||||
rocprofiler::SaveHsaApi(table);
|
rocprofiler::SaveHsaApi(table);
|
||||||
rocprofiler::ProxyQueue::InitFactory();
|
rocprofiler::ProxyQueue::InitFactory();
|
||||||
bool intercept_mode = false;
|
|
||||||
|
|
||||||
// Checking environment to enable intercept mode
|
// Checking environment to enable intercept mode
|
||||||
const char* intercept_env = getenv("ROCP_HSA_INTERCEPT");
|
const char* intercept_env = getenv("ROCP_HSA_INTERCEPT");
|
||||||
|
|
||||||
|
int intercept_env_value = 0;
|
||||||
if (intercept_env != NULL) {
|
if (intercept_env != NULL) {
|
||||||
switch (atoi(intercept_env)) {
|
intercept_env_value = atoi(intercept_env);
|
||||||
// Intercepting disabled
|
|
||||||
|
switch (intercept_env_value) {
|
||||||
case 0:
|
case 0:
|
||||||
intercept_mode = false;
|
|
||||||
rocprofiler::InterceptQueue::TrackerOn(false);
|
|
||||||
break;
|
|
||||||
// Intercepting enabled without timestamping
|
|
||||||
case 1:
|
case 1:
|
||||||
intercept_mode = true;
|
// 0: Intercepting disabled
|
||||||
|
// 1: Intercepting enabled without timestamping
|
||||||
rocprofiler::InterceptQueue::TrackerOn(false);
|
rocprofiler::InterceptQueue::TrackerOn(false);
|
||||||
break;
|
break;
|
||||||
// Intercepting enabled with timestamping
|
|
||||||
case 2:
|
case 2:
|
||||||
intercept_mode = true;
|
// Intercepting enabled with timestamping
|
||||||
rocprofiler::InterceptQueue::TrackerOn(true);
|
rocprofiler::InterceptQueue::TrackerOn(true);
|
||||||
break;
|
break;
|
||||||
default:
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// always enable excutable tracking
|
||||||
|
rocprofiler::util::HsaRsrcFactory::EnableExecutableTracking(table);
|
||||||
|
|
||||||
// Loading a tool lib and setting of intercept mode
|
// Loading a tool lib and setting of intercept mode
|
||||||
const uint32_t intercept_mode_mask = rocprofiler::LoadTool();
|
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) {
|
if (intercept_mode_mask & rocprofiler::MEMCOPY_INTERCEPT_MODE) {
|
||||||
hsa_status_t status = hsa_amd_profiling_async_copy_enable(true);
|
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");
|
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
|
// HSA intercepting
|
||||||
if (intercept_mode) {
|
if (intercept_env_value != 0) {
|
||||||
rocprofiler::ProxyQueue::HsaIntercept(table);
|
rocprofiler::ProxyQueue::HsaIntercept(table);
|
||||||
rocprofiler::InterceptQueue::HsaIntercept(table);
|
rocprofiler::InterceptQueue::HsaIntercept(table);
|
||||||
} else {
|
} else {
|
||||||
rocprofiler::StandaloneIntercept();
|
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);
|
" intercept_mode_mask(" << std::hex << intercept_mode_mask << ")" << std::dec);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ eval_test() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# paths to ROC profiler and oher libraries
|
# 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
|
# enable tools load failure reporting
|
||||||
export HSA_TOOLS_REPORT_LOAD_FAILURE=1
|
export HSA_TOOLS_REPORT_LOAD_FAILURE=1
|
||||||
|
|||||||
Reference in New Issue
Block a user