Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions libkineto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ set(KINETO_LIBRARY_TYPE "default" CACHE STRING
"Type of library (default, static or shared) to build")
set_property(CACHE KINETO_LIBRARY_TYPE PROPERTY STRINGS default shared static)
option(KINETO_BUILD_TESTS "Build kineto unit tests" ON)
option(KINETO_BUILD_MSPTI_PLUGIN "Build MSPTI dynamic plugin for Kineto" OFF)

set(LIBKINETO_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(LIBKINETO_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
Expand Down Expand Up @@ -84,6 +85,10 @@ if(NOT DEFINED LIBKINETO_NOAIUPTI)
add_subdirectory(src/plugin/aiupti)
endif()

if(KINETO_BUILD_MSPTI_PLUGIN)
add_subdirectory(src/plugin/mspti_dynamic)
endif()

# Define file lists
if(LIBKINETO_NOCUPTI AND LIBKINETO_NOROCTRACER AND LIBKINETO_NOXPUPTI AND LIBKINETO_NOAIUPTI)
get_filelist("get_libkineto_cpu_only_srcs(with_api=False)" LIBKINETO_SRCS)
Expand Down
6 changes: 3 additions & 3 deletions libkineto/src/dynamic_plugin/PluginLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
namespace libkineto {

#ifdef _WIN32
constexpr const char* kPluginExtension = "dll";
constexpr const char* kPluginExtension = ".dll";
#elif defined(__linux__) || defined(__APPLE__)
constexpr const char* kPluginExtension = "so";
constexpr const char* kPluginExtension = ".so";
#else
constexpr const char* kPluginExtension = "DONOTMATCHANYTHING";
constexpr const char* kPluginExtension = ".DONOTMATCHANYTHING";
#endif

class PluginRegistry {
Expand Down
2 changes: 1 addition & 1 deletion libkineto/src/dynamic_plugin/PluginTraceBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class PluginTraceBuilder {
// Handle versioning
// Currently expect the exact same version
if (pProfileEvent->unpaddedStructSize <
KINETO_PLUGIN_PROFILER_PROCESS_EVENTS_PARAMS_UNPADDED_STRUCT_SIZE) {
KINETO_PLUGIN_PROFILE_EVENT_UNPADDED_STRUCT_SIZE) {
LOG(ERROR) << "Profile event has an incompatible version";
return -1;
}
Expand Down
37 changes: 37 additions & 0 deletions libkineto/src/plugin/mspti_dynamic/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
cmake_minimum_required(VERSION 3.16)

set(MSPTI_ROOT "" CACHE PATH "Path to MSPTI SDK root (contains include/ and lib64/)")

if("${MSPTI_ROOT}" STREQUAL "")
if(DEFINED ENV{MSPTI_ROOT})
set(MSPTI_ROOT "$ENV{MSPTI_ROOT}")
elseif(DEFINED ENV{ASCEND_HOME_PATH})
set(MSPTI_ROOT "$ENV{ASCEND_HOME_PATH}/tools/mspti")
else()
set(MSPTI_ROOT "/root/miniconda3/envs/ascend/Ascend/ascend-toolkit/latest/toolkit/tools/mspti")
endif()
endif()

set(MSPTI_INCLUDE_DIR "${MSPTI_ROOT}/include")
set(MSPTI_LIBRARY_DIR "${MSPTI_ROOT}/lib64")

find_path(MSPTI_INCLUDE_PATH mspti.h PATHS "${MSPTI_INCLUDE_DIR}" NO_DEFAULT_PATH)
find_library(MSPTI_LIBRARY mspti PATHS "${MSPTI_LIBRARY_DIR}" NO_DEFAULT_PATH)

if(NOT MSPTI_INCLUDE_PATH OR NOT MSPTI_LIBRARY)
message(WARNING "MSPTI plugin skipped: cannot find mspti headers/libs under ${MSPTI_ROOT}")
return()
endif()

add_library(mspti_kineto_plugin SHARED MsptiKinetoDynamicPlugin.cpp)
target_compile_features(mspti_kineto_plugin PRIVATE cxx_std_17)

target_include_directories(mspti_kineto_plugin PRIVATE
${LIBKINETO_INCLUDE_DIR}
${MSPTI_INCLUDE_PATH})

target_link_libraries(mspti_kineto_plugin PRIVATE ${MSPTI_LIBRARY})

set_target_properties(mspti_kineto_plugin PROPERTIES
OUTPUT_NAME "mspti_kineto_plugin"
POSITION_INDEPENDENT_CODE ON)
Loading
Loading