diff --git a/cmake_modules/env.cmake b/cmake_modules/env.cmake index 0aaa2ddc1d..8f2396779f 100644 --- a/cmake_modules/env.cmake +++ b/cmake_modules/env.cmake @@ -66,6 +66,11 @@ if ( DEFINED ENV{CMAKE_DEBUG_TRACE} ) add_definitions ( -DDEBUG_TRACE=1 ) endif() +## Enable AQL-profile new API +if ( NOT DEFINED ENV{CMAKE_CURR_API} ) + add_definitions ( -DAQLPROF_NEW_API=1 ) +endif() + ## Enable direct loading of AQL-profile HSA extension if ( DEFINED ENV{CMAKE_LD_AQLPROFILE} ) add_definitions ( -DROCP_LD_AQLPROFILE=1 ) diff --git a/src/core/profile.h b/src/core/profile.h index 7064a75e24..b702f456fb 100644 --- a/src/core/profile.h +++ b/src/core/profile.h @@ -142,10 +142,14 @@ class Profile { if (status != HSA_STATUS_SUCCESS) AQL_EXC_RAISING(status, "aqlprofile_start"); status = api->hsa_ven_amd_aqlprofile_stop(&profile_, &stop); if (status != HSA_STATUS_SUCCESS) AQL_EXC_RAISING(status, "aqlprofile_stop"); +#ifdef AQLPROF_NEW_API hsa_status_t rd_status = api->hsa_ven_amd_aqlprofile_read(&profile_, &read); #if 0 // Read API returns error if disabled if (rd_status != HSA_STATUS_SUCCESS) AQL_EXC_RAISING(status, "aqlprofile_read"); #endif +#else + hsa_status_t rd_status = HSA_STATUS_ERROR; +#endif // Set completion signal hsa_signal_t dummy_signal{}; diff --git a/src/util/hsa_rsrc_factory.cpp b/src/util/hsa_rsrc_factory.cpp index 4ae225c6c1..5dccc8a031 100644 --- a/src/util/hsa_rsrc_factory.cpp +++ b/src/util/hsa_rsrc_factory.cpp @@ -162,8 +162,10 @@ hsa_status_t HsaRsrcFactory::LoadAqlProfileLib(aqlprofile_pfn_t* api) { (decltype(::hsa_ven_amd_aqlprofile_start)*)dlsym(handle, "hsa_ven_amd_aqlprofile_start"); api->hsa_ven_amd_aqlprofile_stop = (decltype(::hsa_ven_amd_aqlprofile_stop)*)dlsym(handle, "hsa_ven_amd_aqlprofile_stop"); +#ifdef AQLPROF_NEW_API api->hsa_ven_amd_aqlprofile_read = (decltype(::hsa_ven_amd_aqlprofile_read)*)dlsym(handle, "hsa_ven_amd_aqlprofile_read"); +#endif api->hsa_ven_amd_aqlprofile_legacy_get_pm4 = (decltype(::hsa_ven_amd_aqlprofile_legacy_get_pm4)*)dlsym( handle, "hsa_ven_amd_aqlprofile_legacy_get_pm4"); diff --git a/test/tool/tool.cpp b/test/tool/tool.cpp index 736d3b6c09..106bb6546e 100644 --- a/test/tool/tool.cpp +++ b/test/tool/tool.cpp @@ -919,8 +919,10 @@ extern "C" PUBLIC_API void OnLoadToolProp(rocprofiler_settings_t* settings) HSA_VEN_AMD_AQLPROFILE_PARAMETER_NAME_TOKEN_MASK; parameters_dict["TOKEN_MASK2"] = HSA_VEN_AMD_AQLPROFILE_PARAMETER_NAME_TOKEN_MASK2; +#ifdef AQLPROF_NEW_API parameters_dict["SE_MASK"] = HSA_VEN_AMD_AQLPROFILE_PARAMETER_NAME_SE_MASK; +#endif printf(" %s (", name.c_str()); features[index] = {}; diff --git a/test/util/hsa_rsrc_factory.cpp b/test/util/hsa_rsrc_factory.cpp index dadb7c12ab..3f201e62cb 100644 --- a/test/util/hsa_rsrc_factory.cpp +++ b/test/util/hsa_rsrc_factory.cpp @@ -159,8 +159,10 @@ hsa_status_t HsaRsrcFactory::LoadAqlProfileLib(aqlprofile_pfn_t* api) { (decltype(::hsa_ven_amd_aqlprofile_start)*)dlsym(handle, "hsa_ven_amd_aqlprofile_start"); api->hsa_ven_amd_aqlprofile_stop = (decltype(::hsa_ven_amd_aqlprofile_stop)*)dlsym(handle, "hsa_ven_amd_aqlprofile_stop"); +#ifdef AQLPROF_NEW_API api->hsa_ven_amd_aqlprofile_read = (decltype(::hsa_ven_amd_aqlprofile_read)*)dlsym(handle, "hsa_ven_amd_aqlprofile_read"); +#endif api->hsa_ven_amd_aqlprofile_legacy_get_pm4 = (decltype(::hsa_ven_amd_aqlprofile_legacy_get_pm4)*)dlsym( handle, "hsa_ven_amd_aqlprofile_legacy_get_pm4");