Fix building w/ hip, etc. but w/o rocprofiler (#159)
- Fixes builds with `OMNITRACE_USE_ROCPROFILER=OFF` but
`OMNITRACE_USE_ROCTRACER=ON`
- Move rocprofiler/hsa_rsrc_factory.{hpp,cpp}` to rocm folder
Цей коміт міститься в:
зафіксовано
GitHub
джерело
d4d44e744b
коміт
472e96a084
@@ -70,6 +70,13 @@ find_library(
|
||||
PATHS ${roctracer_ROOT_DIR} ${_ROCM_ROCTRACER_PATHS}
|
||||
PATH_SUFFIXES lib lib64)
|
||||
|
||||
find_library(
|
||||
roctracer_hsa-runtime_LIBRARY
|
||||
NAMES hsa-runtime64 hsa-runtime
|
||||
HINTS ${roctracer_ROOT_DIR} ${_ROCM_ROCTRACER_PATHS}
|
||||
PATHS ${roctracer_ROOT_DIR} ${_ROCM_ROCTRACER_PATHS}
|
||||
PATH_SUFFIXES lib lib64)
|
||||
|
||||
# try not to directly use the hsakmt::hsakmt target because it hardcodes the
|
||||
# INTERFACE_LINK_LIBRARIES used when it was built
|
||||
find_package(hsakmt HINTS ${_ROCM_ROCTRACER_PATHS} PATHS ${_ROCM_ROCTRACER_PATHS})
|
||||
@@ -124,7 +131,8 @@ if(roctracer_LIBRARY)
|
||||
get_filename_component(roctracer_LIBRARY_DIR "${roctracer_LIBRARY}" PATH CACHE)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(roctracer_LIBRARY roctracer_roctx_LIBRARY roctracer_hsakmt_LIBRARY)
|
||||
mark_as_advanced(roctracer_LIBRARY roctracer_roctx_LIBRARY roctracer_hsakmt_LIBRARY
|
||||
roctracer_hsa-runtime_LIBRARY)
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
@@ -163,6 +171,12 @@ if(roctracer_FOUND)
|
||||
target_link_libraries(roctracer::roctx INTERFACE ${roctracer_hsakmt_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(roctracer_hsa-runtime_LIBRARY)
|
||||
list(APPEND roctracer_LIBRARIES ${roctracer_hsa-runtime_LIBRARY})
|
||||
target_link_libraries(roctracer::roctracer
|
||||
INTERFACE ${roctracer_hsa-runtime_LIBRARY})
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
@@ -58,9 +58,7 @@ target_sources(omnitrace-object-library PRIVATE ${library_sources} ${library_hea
|
||||
${CMAKE_CURRENT_BINARY_DIR}/defines.hpp)
|
||||
|
||||
if(OMNITRACE_USE_ROCTRACER OR OMNITRACE_USE_ROCPROFILER)
|
||||
target_sources(
|
||||
omnitrace-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/rocprofiler.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/rocm.cpp)
|
||||
target_sources(omnitrace-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/rocm.cpp)
|
||||
endif()
|
||||
|
||||
if(OMNITRACE_USE_ROCTRACER)
|
||||
@@ -84,4 +82,4 @@ if(OMNITRACE_USE_ROCM_SMI)
|
||||
endif()
|
||||
|
||||
add_subdirectory(components)
|
||||
add_subdirectory(rocprofiler)
|
||||
add_subdirectory(rocm)
|
||||
|
||||
@@ -35,7 +35,7 @@ set(component_headers
|
||||
|
||||
target_sources(omnitrace-object-library PRIVATE ${component_sources} ${component_headers})
|
||||
|
||||
if(OMNITRACE_USE_ROCTRACER OR OMNITRACE_USE_ROCPROFILER)
|
||||
if(OMNITRACE_USE_ROCPROFILER)
|
||||
target_sources(omnitrace-object-library
|
||||
PRIVATE ${CMAKE_CURRENT_LIST_DIR}/rocprofiler.cpp)
|
||||
endif()
|
||||
|
||||
@@ -131,7 +131,7 @@ struct rocprofiler
|
||||
[[nodiscard]] static scope::transient_destructor protect_flush_activity();
|
||||
};
|
||||
|
||||
#if !defined(OMNITRACE_USE_ROCTRACER)
|
||||
#if !defined(OMNITRACE_USE_ROCPROFILER)
|
||||
inline void
|
||||
rocprofiler::setup()
|
||||
{}
|
||||
@@ -215,7 +215,7 @@ struct get_storage<component::rocm_data_tracker>
|
||||
} // namespace operation
|
||||
} // namespace tim
|
||||
|
||||
#if !defined(OMNITRACE_USE_ROCTRACER)
|
||||
#if !defined(OMNITRACE_USE_ROCPROFILER)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::rocprofiler_data, false_type)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
#include "library/debug.hpp"
|
||||
#include "library/dynamic_library.hpp"
|
||||
#include "library/gpu.hpp"
|
||||
#include "library/rocm/hsa_rsrc_factory.hpp"
|
||||
#include "library/rocm_smi.hpp"
|
||||
#include "library/rocprofiler.hpp"
|
||||
#include "library/rocprofiler/hsa_rsrc_factory.hpp"
|
||||
#include "library/roctracer.hpp"
|
||||
#include "library/runtime.hpp"
|
||||
#include "library/sampling.hpp"
|
||||
@@ -62,7 +62,9 @@
|
||||
# define OMNITRACE_HIP_API_ARGS 0
|
||||
#endif
|
||||
|
||||
#include <rocprofiler.h>
|
||||
#if defined(OMNITRACE_USE_ROCPROFILER) && OMNITRACE_USE_ROCPROFILER > 0
|
||||
# include <rocprofiler.h>
|
||||
#endif
|
||||
|
||||
using namespace omnitrace;
|
||||
|
||||
@@ -162,12 +164,12 @@ extern "C"
|
||||
const char* const* failed_tool_names)
|
||||
{
|
||||
OMNITRACE_BASIC_VERBOSE_F(2 || rocm::on_load_trace, "Loading...\n");
|
||||
OMNITRACE_SCOPED_SAMPLING_ON_CHILD_THREADS(false);
|
||||
|
||||
if(!tim::get_env("OMNITRACE_INIT_TOOLING", true)) return true;
|
||||
if(!tim::settings::enabled()) return true;
|
||||
|
||||
roctracer_is_init() = true;
|
||||
OMNITRACE_SCOPED_SAMPLING_ON_CHILD_THREADS(false);
|
||||
OMNITRACE_BASIC_VERBOSE_F(1 || rocm::on_load_trace, "Loading ROCm tooling...\n");
|
||||
|
||||
tim::consume_parameters(table, runtime_version, failed_tool_count,
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
#
|
||||
if(OMNITRACE_USE_ROCPROFILER)
|
||||
if(OMNITRACE_USE_ROCPROFILER OR OMNITRACE_USE_ROCTRACER)
|
||||
target_sources(
|
||||
omnitrace-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/hsa_rsrc_factory.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/hsa_rsrc_factory.cpp)
|
||||
+1
-7
@@ -20,18 +20,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*******************************************************************************/
|
||||
|
||||
#include "library/rocprofiler/hsa_rsrc_factory.hpp"
|
||||
#include "library/rocm/hsa_rsrc_factory.hpp"
|
||||
#include "library/debug.hpp"
|
||||
#include "library/defines.hpp"
|
||||
|
||||
#include <timemory/manager.hpp>
|
||||
|
||||
#include <rocprofiler.h>
|
||||
|
||||
#define PUBLIC_API __attribute__((visibility("default")))
|
||||
#define CONSTRUCTOR_API __attribute__((constructor))
|
||||
#define DESTRUCTOR_API __attribute__((destructor))
|
||||
|
||||
#include <atomic>
|
||||
#include <cassert>
|
||||
#include <dlfcn.h>
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "library/gpu.hpp"
|
||||
#include "library/perfetto.hpp"
|
||||
#include "library/rocm.hpp"
|
||||
#include "library/rocprofiler/hsa_rsrc_factory.hpp"
|
||||
#include "library/rocm/hsa_rsrc_factory.hpp"
|
||||
|
||||
#include <timemory/backends/hardware_counters.hpp>
|
||||
#include <timemory/manager.hpp>
|
||||
@@ -144,8 +144,6 @@ void
|
||||
rocm_dump_context_entry(context_entry_t* entry, rocprofiler_feature_t* features,
|
||||
unsigned feature_count)
|
||||
{
|
||||
// static rocm_metric_type last_timestamp = get_last_timestamp_ns();
|
||||
|
||||
volatile std::atomic<bool>* valid =
|
||||
reinterpret_cast<std::atomic<bool>*>(&entry->valid);
|
||||
while(valid->load() == false)
|
||||
@@ -191,8 +189,8 @@ rocm_context_handler(const rocprofiler_pool_entry_t* entry, void* arg)
|
||||
context_entry_t* ctx_entry = reinterpret_cast<context_entry_t*>(entry->payload);
|
||||
handler_arg_t* handler_arg = reinterpret_cast<handler_arg_t*>(arg);
|
||||
|
||||
rocm::lock_t _lk{ rocm::rocm_mutex, std::defer_lock };
|
||||
if(!_lk.owns_lock()) _lk.lock();
|
||||
// rocm::lock_t _lk{ rocm::rocm_mutex, std::defer_lock };
|
||||
// if(!_lk.owns_lock()) _lk.lock();
|
||||
|
||||
rocm_dump_context_entry(ctx_entry, handler_arg->features, handler_arg->feature_count);
|
||||
|
||||
|
||||
Посилання в новій задачі
Заблокувати користувача