SWDEV-433371 - Support new comgr unbundling action

Support new comgr unbundling action api to extract codebjects
in compressed and uncompressed modes.

Create HIP_ALWAYS_USE_NEW_COMGR_UNBUNDLING_ACTION ENV to
toggle new path and old path.
If HIP_ALWAYS_USE_NEW_COMGR_UNBUNDLING_ACTION=false(default),
   uncompressed codeobject will go old path for better perf,
   compressed   codeobject will go new path.
If HIP_ALWAYS_USE_NEW_COMGR_UNBUNDLING_ACTION=true,
   both uncompressed and compressed codeobjects will go new
   path.

Add comgr wrapper for
   amd_comgr_action_info_set_bundle_entry_ids()

Change-Id: I79952f132fe21249296685ee12cae05a4f9aec32
This commit is contained in:
Tao Sang
2024-05-15 14:57:13 -04:00
committed by Maneesh Gupta
parent 63ccbef0d8
commit d0050ce309
7 changed files with 552 additions and 34 deletions
+5 -1
View File
@@ -114,12 +114,16 @@ bool Comgr::LoadLib(bool is_versioned) {
GET_COMGR_SYMBOL(amd_comgr_iterate_symbols)
GET_COMGR_SYMBOL(amd_comgr_symbol_lookup)
GET_COMGR_SYMBOL(amd_comgr_symbol_get_info)
GET_COMGR_OPTIONAL_SYMBOL(amd_comgr_demangle_symbol_name)
GET_COMGR_SYMBOL(amd_comgr_demangle_symbol_name)
GET_COMGR_SYMBOL(amd_comgr_populate_mangled_names)
GET_COMGR_SYMBOL(amd_comgr_get_mangled_name)
GET_COMGR_SYMBOL(amd_comgr_populate_name_expression_map)
GET_COMGR_SYMBOL(amd_comgr_map_name_expression_to_symbol_name)
GET_COMGR_OPTIONAL_SYMBOL(amd_comgr_action_info_set_bundle_entry_ids)
is_ready_ = true;
size_t major = 0, minor = 0;
get_version(&major, &minor);
ClPrint(amd::LOG_INFO, amd::LOG_CODE, "Loaded COMGR library version %zu.%zu.", major, minor);
return true;
}
+18 -10
View File
@@ -76,6 +76,7 @@ typedef amd_comgr_status_t (*t_amd_comgr_populate_mangled_names)(amd_comgr_data_
typedef amd_comgr_status_t (*t_amd_comgr_get_mangled_name)(amd_comgr_data_t data, size_t index, size_t *size, char *mangled_name);
typedef amd_comgr_status_t (*t_amd_comgr_populate_name_expression_map)(amd_comgr_data_t data, size_t *count);
typedef amd_comgr_status_t (*t_amd_comgr_map_name_expression_to_symbol_name)(amd_comgr_data_t data, size_t *size, char *name_expression, char* symbol_name);
typedef amd_comgr_status_t (*t_amd_comgr_action_info_set_bundle_entry_ids)(amd_comgr_action_info_t action_info, const char* bundle_entry_ids[], size_t count);
struct ComgrEntryPoints {
void* handle;
@@ -129,13 +130,16 @@ struct ComgrEntryPoints {
t_amd_comgr_get_mangled_name amd_comgr_get_mangled_name;
t_amd_comgr_populate_name_expression_map amd_comgr_populate_name_expression_map;
t_amd_comgr_map_name_expression_to_symbol_name amd_comgr_map_name_expression_to_symbol_name;
t_amd_comgr_action_info_set_bundle_entry_ids amd_comgr_action_info_set_bundle_entry_ids;
};
#ifdef COMGR_DYN_DLL
#define COMGR_DYN(NAME) cep_.NAME
#define GET_COMGR_SYMBOL(NAME) cep_.NAME = \
reinterpret_cast<t_##NAME>(Os::getSymbol(cep_.handle, #NAME)); \
if (nullptr == cep_.NAME) { return false; }
if (nullptr == cep_.NAME) { \
ClPrint(amd::LOG_ERROR, amd::LOG_CODE, "Failed to load COMGR function %s", #NAME); \
return false; }
#define GET_COMGR_OPTIONAL_SYMBOL(NAME) cep_.NAME = \
reinterpret_cast<t_##NAME>(Os::getSymbol(cep_.handle, #NAME));
#else
@@ -289,13 +293,6 @@ public:
}
static amd_comgr_status_t demangle_symbol_name(amd_comgr_data_t MangledSymbolName,
amd_comgr_data_t* DemangledSymbolName) {
#if defined(COMGR_DYN_DLL)
if (cep_.amd_comgr_demangle_symbol_name == nullptr) {
ClPrint(amd::LOG_ERROR, amd::LOG_CODE,
"Failed to load COMGR function amd_comgr_demangle_symbol_name");
return AMD_COMGR_STATUS_ERROR;
}
#endif
return COMGR_DYN(amd_comgr_demangle_symbol_name)(MangledSymbolName, DemangledSymbolName);
}
static amd_comgr_status_t populate_mangled_names(amd_comgr_data_t data, size_t *count) {
@@ -310,8 +307,19 @@ public:
static amd_comgr_status_t map_name_expression_to_symbol_name(amd_comgr_data_t data, size_t *size, char *name_expression, char* symbol_name) {
return COMGR_DYN(amd_comgr_map_name_expression_to_symbol_name)(data, size, name_expression, symbol_name);
}
static amd_comgr_status_t action_info_set_bundle_entry_ids(amd_comgr_action_info_t action_info,
const char* bundle_entry_ids[], size_t count) {
#if defined(COMGR_DYN_DLL)
if (cep_.amd_comgr_action_info_set_bundle_entry_ids == nullptr) {
// comgr version 2.7 or less is loaded
ClPrint(amd::LOG_ERROR, amd::LOG_CODE,
"Failed to load COMGR function amd_comgr_action_info_set_bundle_entry_ids");
return AMD_COMGR_STATUS_ERROR;
}
#endif
return COMGR_DYN(amd_comgr_action_info_set_bundle_entry_ids)(action_info, bundle_entry_ids,
count);
}
private:
static ComgrEntryPoints cep_;
static bool is_ready_;