aqlprofile extension version check

Change-Id: If824764f199eca15a0341cdf6177d8d6353e29f3


[ROCm/ROCR-Runtime commit: d788a53972]
This commit is contained in:
Evgeny
2018-10-12 19:13:09 -05:00
committed by Evgeny Shcherbakov
parent b8de13150b
commit e53c7c63c0
2 changed files with 20 additions and 4 deletions
@@ -467,6 +467,8 @@ hsa_status_t hsa_system_get_major_extension_table(uint16_t extension, uint16_t v
if (extension == HSA_EXTENSION_AMD_AQLPROFILE) {
if (version_major != hsa_ven_amd_aqlprofile_VERSION_MAJOR) {
debug_print("aqlprofile API incompatible ver %d, current ver %d\n",
version_major, hsa_ven_amd_aqlprofile_VERSION_MAJOR);
return HSA_STATUS_ERROR;
}
@@ -476,7 +478,7 @@ hsa_status_t hsa_system_get_major_extension_table(uint16_t extension, uint16_t v
return HSA_STATUS_ERROR;
}
hsa_ven_amd_aqlprofile_1_00_pfn_t ext_table;
hsa_ven_amd_aqlprofile_pfn_t ext_table;
ext_table.hsa_ven_amd_aqlprofile_version_major =
(decltype(::hsa_ven_amd_aqlprofile_version_major)*)
os::GetExportAddress(lib, "hsa_ven_amd_aqlprofile_version_major");
@@ -508,6 +510,19 @@ hsa_status_t hsa_system_get_major_extension_table(uint16_t extension, uint16_t v
(decltype(::hsa_ven_amd_aqlprofile_iterate_data)*)
os::GetExportAddress(lib, "hsa_ven_amd_aqlprofile_iterate_data");
bool version_incompatible = true;
uint32_t version_curr = 0;
version_major = HSA_AQLPROFILE_VERSION_MAJOR;
if (ext_table.hsa_ven_amd_aqlprofile_version_major != NULL) {
version_curr = ext_table.hsa_ven_amd_aqlprofile_version_major();
version_incompatible = (version_major != version_curr);
}
if (version_incompatible == true) {
debug_print("Loading '%s' failed, incompatible ver %d, current ver %d\n",
kAqlProfileLib, version_major, version_curr);
return HSA_STATUS_ERROR;
}
memcpy(table, &ext_table, Min(sizeof(ext_table), table_length));
return HSA_STATUS_SUCCESS;
@@ -292,12 +292,13 @@ hsa_status_t hsa_ven_amd_aqlprofile_error_string(
/**
* @brief Extension version.
*/
#define hsa_ven_amd_aqlprofile 001000
#define hsa_ven_amd_aqlprofile_VERSION_MAJOR 1
#define hsa_ven_amd_aqlprofile_LIB(suff) "libhsa-amd-aqlprofile" suff ".so"
#ifdef HSA_LARGE_MODEL
static const char kAqlProfileLib[] = "libhsa-amd-aqlprofile64.so.1";
static const char kAqlProfileLib[] = hsa_ven_amd_aqlprofile_LIB("64");
#else
static const char kAqlProfileLib[] = "libhsa-amd-aqlprofile.so.1";
static const char kAqlProfileLib[] = hsa_ven_amd_aqlprofile_LIB("");
#endif
/**