Update rocprofiler-register support
- add rocprofiler-register to CPACK_DEBIAN_BINARY_PACKAGE_DEPENDS when found - add rocprofiler-register to CPACK_RPM_BINARY_PACKAGE_REQUIRES when found - remove report_tool_load_failures_explicit_ - add HSA_TOOLS_DISABLE_REGISTER flag - add HSA_TOOLS_REPORT_REGISTER_FAILURE - use HSA_TOOLS_REPORT_REGISTER_FAILURE instead of HSA_TOOLS_REPORT_LOAD_FAILURE - changed rocprofiler-register message to not include the word "error" Change-Id: Ib7fd7f14c42758a54c347874018281bb1b5477a6
This commit is contained in:
committed by
David Yat Sin
parent
24633c7a85
commit
7ce263b0e4
@@ -289,6 +289,9 @@ if(rocprofiler-register_FOUND)
|
|||||||
HSA_VERSION_MINOR=${VERSION_MINOR}
|
HSA_VERSION_MINOR=${VERSION_MINOR}
|
||||||
HSA_VERSION_PATCH=${VERSION_PATCH})
|
HSA_VERSION_PATCH=${VERSION_PATCH})
|
||||||
target_link_libraries(${CORE_RUNTIME_TARGET} PRIVATE rocprofiler-register::rocprofiler-register)
|
target_link_libraries(${CORE_RUNTIME_TARGET} PRIVATE rocprofiler-register::rocprofiler-register)
|
||||||
|
set(HSA_DEP_ROCPROFILER_REGISTER ON)
|
||||||
|
else()
|
||||||
|
set(HSA_DEP_ROCPROFILER_REGISTER OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
## Set the VERSION and SOVERSION values
|
## Set the VERSION and SOVERSION values
|
||||||
@@ -463,6 +466,9 @@ if ( ROCM_DEP_ROCMCORE )
|
|||||||
string ( APPEND CPACK_DEBIAN_BINARY_PACKAGE_DEPENDS ", rocm-core" )
|
string ( APPEND CPACK_DEBIAN_BINARY_PACKAGE_DEPENDS ", rocm-core" )
|
||||||
string ( APPEND CPACK_DEBIAN_ASAN_PACKAGE_DEPENDS ", rocm-core-asan" )
|
string ( APPEND CPACK_DEBIAN_ASAN_PACKAGE_DEPENDS ", rocm-core-asan" )
|
||||||
endif()
|
endif()
|
||||||
|
if ( HSA_DEP_ROCPROFILER_REGISTER )
|
||||||
|
string ( APPEND CPACK_DEBIAN_BINARY_PACKAGE_DEPENDS ", rocprofiler-register" )
|
||||||
|
endif()
|
||||||
# Declare package relationships (hsa-ext-rocr-dev is a legacy package that we subsume)
|
# Declare package relationships (hsa-ext-rocr-dev is a legacy package that we subsume)
|
||||||
set ( CPACK_DEBIAN_PACKAGE_BREAKS "hsa-ext-rocr-dev" )
|
set ( CPACK_DEBIAN_PACKAGE_BREAKS "hsa-ext-rocr-dev" )
|
||||||
set ( CPACK_DEBIAN_PACKAGE_REPLACES "hsa-ext-rocr-dev" )
|
set ( CPACK_DEBIAN_PACKAGE_REPLACES "hsa-ext-rocr-dev" )
|
||||||
@@ -505,6 +511,9 @@ if ( ROCM_DEP_ROCMCORE )
|
|||||||
string ( APPEND CPACK_RPM_BINARY_PACKAGE_REQUIRES " rocm-core" )
|
string ( APPEND CPACK_RPM_BINARY_PACKAGE_REQUIRES " rocm-core" )
|
||||||
string ( APPEND CPACK_RPM_ASAN_PACKAGE_REQUIRES " rocm-core-asan" )
|
string ( APPEND CPACK_RPM_ASAN_PACKAGE_REQUIRES " rocm-core-asan" )
|
||||||
endif()
|
endif()
|
||||||
|
if ( HSA_DEP_ROCPROFILER_REGISTER )
|
||||||
|
string ( APPEND CPACK_RPM_BINARY_PACKAGE_REQUIRES " rocprofiler-register" )
|
||||||
|
endif()
|
||||||
# Declare package relationships (hsa-ext-rocr-dev is a legacy package that we subsume)
|
# Declare package relationships (hsa-ext-rocr-dev is a legacy package that we subsume)
|
||||||
set ( CPACK_RPM_PACKAGE_PROVIDES "hsa-ext-rocr-dev hsa-rocr-dev" )
|
set ( CPACK_RPM_PACKAGE_PROVIDES "hsa-ext-rocr-dev hsa-rocr-dev" )
|
||||||
set ( CPACK_RPM_PACKAGE_OBSOLETES "hsa-ext-rocr-dev" )
|
set ( CPACK_RPM_PACKAGE_OBSOLETES "hsa-ext-rocr-dev" )
|
||||||
|
|||||||
@@ -2102,48 +2102,39 @@ void Runtime::LoadTools() {
|
|||||||
typedef void (*tool_add_t)(Runtime*);
|
typedef void (*tool_add_t)(Runtime*);
|
||||||
|
|
||||||
#if defined(HSA_ROCPROFILER_REGISTER) && HSA_ROCPROFILER_REGISTER > 0
|
#if defined(HSA_ROCPROFILER_REGISTER) && HSA_ROCPROFILER_REGISTER > 0
|
||||||
auto* profiler_api_table_ = static_cast<void*>(&hsa_api_table_);
|
if (!flag().disable_tool_register()) {
|
||||||
auto lib_id = rocprofiler_register_library_indentifier_t{};
|
auto* profiler_api_table_ = static_cast<void*>(&hsa_api_table_);
|
||||||
auto rocp_reg_status =
|
auto lib_id = rocprofiler_register_library_indentifier_t{};
|
||||||
rocprofiler_register_library_api_table("hsa", &ROCPROFILER_REGISTER_IMPORT_FUNC(hsa),
|
auto rocp_reg_status =
|
||||||
ROCP_REG_VERSION, &profiler_api_table_, 1, &lib_id);
|
rocprofiler_register_library_api_table("hsa", &ROCPROFILER_REGISTER_IMPORT_FUNC(hsa),
|
||||||
|
ROCP_REG_VERSION, &profiler_api_table_, 1, &lib_id);
|
||||||
|
|
||||||
if (rocp_reg_status != ROCP_REG_SUCCESS && flag().report_tool_load_failures()) {
|
if (rocp_reg_status != ROCP_REG_SUCCESS && flag().report_tool_register_failures()) {
|
||||||
// hsa-runtime, in non-debug mode, enables reporting tool load failures by default,
|
fprintf(stderr, "[hsa-runtime][%i] rocprofiler-register returned status code %i: %s\n",
|
||||||
// which is good scheme for when tools were only loaded via the HSA_TOOLS_LIB env variable
|
|
||||||
// but, with automatic detection, this will result in reporting that no tools were available.
|
|
||||||
// So if no tools were available and flag().report_tool_load_failures() is true, we make
|
|
||||||
// sure that HSA_TOOLS_REPORT_LOAD_FAILURE was explicitly set and, if not, we suppress
|
|
||||||
// reporting that no tools were found
|
|
||||||
if (rocp_reg_status != ROCP_REG_NO_TOOLS ||
|
|
||||||
(rocp_reg_status == ROCP_REG_NO_TOOLS &&
|
|
||||||
flag().report_tool_load_failures_explicitly_set())) {
|
|
||||||
fprintf(stderr, "[hsa-runtime][%i] rocprofiler-register failed with error code %i: %s\n",
|
|
||||||
getpid(), rocp_reg_status, rocprofiler_register_error_string(rocp_reg_status));
|
getpid(), rocp_reg_status, rocprofiler_register_error_string(rocp_reg_status));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool allow_v1_registration = false;
|
bool allow_v1_registration = false;
|
||||||
if(os::IsEnvVarSet("HSA_TOOLS_ROCPROFILER_V1_TOOLS"))
|
if (os::IsEnvVarSet("HSA_TOOLS_ROCPROFILER_V1_TOOLS")) {
|
||||||
{
|
// assume true if env variable is set
|
||||||
// assume true if env variable is set
|
allow_v1_registration = true;
|
||||||
allow_v1_registration = true;
|
auto allow_v1_value = os::GetEnvVar("HSA_TOOLS_ROCPROFILER_V1_TOOLS");
|
||||||
auto allow_v1_value = os::GetEnvVar("HSA_TOOLS_ROCPROFILER_V1_TOOLS");
|
// support using numbers, off, false, no, n, or f
|
||||||
// support using numbers, off, false, no, n, or f
|
if (!allow_v1_value.empty()) {
|
||||||
if (!allow_v1_value.empty()) {
|
if (allow_v1_value.find_first_not_of("0123456789") == std::string::npos) {
|
||||||
if (allow_v1_value.find_first_not_of("0123456789") == std::string::npos) {
|
allow_v1_registration = (std::stoi(allow_v1_value) != 0);
|
||||||
allow_v1_registration = (std::stoi(allow_v1_value) != 0);
|
} else if (std::regex_match(
|
||||||
} else if (std::regex_match(
|
allow_v1_value,
|
||||||
allow_v1_value,
|
std::regex{"^(off|false|no|n|f)$", std::regex_constants::icase})) {
|
||||||
std::regex{"^(off|false|no|n|f)$", std::regex_constants::icase})) {
|
allow_v1_registration = false;
|
||||||
allow_v1_registration = false;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// if rocprofiler library supports registration and v1 support not explicitly requested,
|
// if rocprofiler library supports registration and v1 support not explicitly requested,
|
||||||
// do not use old method
|
// do not use old method
|
||||||
if (rocp_reg_status == ROCP_REG_SUCCESS && !allow_v1_registration) return;
|
if (rocp_reg_status == ROCP_REG_SUCCESS && !allow_v1_registration) return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::vector<const char*> failed;
|
std::vector<const char*> failed;
|
||||||
|
|||||||
@@ -151,13 +151,18 @@ class Flag {
|
|||||||
|
|
||||||
var = os::GetEnvVar("HSA_TOOLS_REPORT_LOAD_FAILURE");
|
var = os::GetEnvVar("HSA_TOOLS_REPORT_LOAD_FAILURE");
|
||||||
|
|
||||||
report_tool_load_failures_explicit_ = (var.empty()) ? false : true;
|
|
||||||
ifdebug {
|
ifdebug {
|
||||||
report_tool_load_failures_ = (var == "1") ? true : false;
|
report_tool_load_failures_ = (var == "1") ? true : false;
|
||||||
} else {
|
} else {
|
||||||
report_tool_load_failures_ = (var == "0") ? false : true;
|
report_tool_load_failures_ = (var == "0") ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var = os::GetEnvVar("HSA_TOOLS_DISABLE_REGISTER");
|
||||||
|
disable_tool_register_ = (var == "1") ? true : false;
|
||||||
|
|
||||||
|
var = os::GetEnvVar("HSA_TOOLS_REPORT_REGISTER_FAILURE");
|
||||||
|
report_tool_register_failures_ = (var == "1") ? true : false;
|
||||||
|
|
||||||
var = os::GetEnvVar("HSA_DISABLE_FRAGMENT_ALLOCATOR");
|
var = os::GetEnvVar("HSA_DISABLE_FRAGMENT_ALLOCATOR");
|
||||||
disable_fragment_alloc_ = (var == "1") ? true : false;
|
disable_fragment_alloc_ = (var == "1") ? true : false;
|
||||||
|
|
||||||
@@ -250,9 +255,9 @@ class Flag {
|
|||||||
|
|
||||||
bool report_tool_load_failures() const { return report_tool_load_failures_; }
|
bool report_tool_load_failures() const { return report_tool_load_failures_; }
|
||||||
|
|
||||||
bool report_tool_load_failures_explicitly_set() const {
|
bool report_tool_register_failures() const { return report_tool_register_failures_; }
|
||||||
return report_tool_load_failures_explicit_;
|
|
||||||
}
|
bool disable_tool_register() const { return disable_tool_register_; }
|
||||||
|
|
||||||
bool disable_fragment_alloc() const { return disable_fragment_alloc_; }
|
bool disable_fragment_alloc() const { return disable_fragment_alloc_; }
|
||||||
|
|
||||||
@@ -340,7 +345,8 @@ class Flag {
|
|||||||
bool sdma_wait_idle_;
|
bool sdma_wait_idle_;
|
||||||
bool enable_queue_fault_message_;
|
bool enable_queue_fault_message_;
|
||||||
bool report_tool_load_failures_;
|
bool report_tool_load_failures_;
|
||||||
bool report_tool_load_failures_explicit_;
|
bool report_tool_register_failures_ = false;
|
||||||
|
bool disable_tool_register_ = false;
|
||||||
bool disable_fragment_alloc_;
|
bool disable_fragment_alloc_;
|
||||||
bool rev_copy_dir_;
|
bool rev_copy_dir_;
|
||||||
bool fine_grain_pcie_;
|
bool fine_grain_pcie_;
|
||||||
|
|||||||
Reference in New Issue
Block a user